aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Colascione <[email protected]>2012-09-17 04:07:36 -0800
committerDaniel Colascione <[email protected]>2012-09-17 04:07:36 -0800
commit2ab329f3b5d52a39f0a45c3d9c129f1c19560142 (patch)
tree6dd6784d63e54cb18071df8e28fbdbc27d418728
parentf701ab72dd55460d23c8b029550aa4d7ecef3cfa (diff)
parentbb7dce392f6d9d5fc4b9d7de09ff920a52f07669 (diff)
Merge from trunk
-rw-r--r--ChangeLog142
-rw-r--r--INSTALL6
-rw-r--r--Makefile.in37
-rw-r--r--README11
-rw-r--r--admin/CPP-DEFINES17
-rw-r--r--admin/ChangeLog46
-rw-r--r--admin/admin.el96
-rw-r--r--admin/notes/bugtracker10
-rwxr-xr-xautogen.sh2
-rw-r--r--autogen/Makefile.in3
-rw-r--r--autogen/config.in74
-rwxr-xr-xautogen/configure635
-rw-r--r--configure.ac245
-rw-r--r--doc/emacs/ChangeLog27
-rw-r--r--doc/emacs/building.texi4
-rw-r--r--doc/emacs/emacs.texi3
-rw-r--r--doc/emacs/regs.texi26
-rw-r--r--doc/emacs/trouble.texi39
-rw-r--r--doc/emacs/windows.texi2
-rw-r--r--doc/lispref/ChangeLog53
-rw-r--r--doc/lispref/commands.texi11
-rw-r--r--doc/lispref/debugging.texi5
-rw-r--r--doc/lispref/eval.texi1
-rw-r--r--doc/lispref/lists.texi33
-rw-r--r--doc/lispref/markers.texi6
-rw-r--r--doc/lispref/minibuf.texi49
-rw-r--r--doc/lispref/numbers.texi35
-rw-r--r--doc/lispref/positions.texi29
-rw-r--r--doc/lispref/searching.texi8
-rw-r--r--doc/lispref/syntax.texi64
-rw-r--r--doc/lispref/variables.texi7
-rw-r--r--doc/lispref/windows.texi36
-rw-r--r--doc/misc/ChangeLog16
-rw-r--r--doc/misc/texinfo.tex84
-rw-r--r--doc/misc/tramp.texi3
-rw-r--r--doc/misc/trampver.texi2
-rw-r--r--etc/ChangeLog49
-rw-r--r--etc/NEWS115
-rw-r--r--etc/TODO7
-rw-r--r--etc/refcards/Makefile27
-rw-r--r--etc/refcards/calccard.tex5
-rw-r--r--etc/refcards/cs-dired-ref.tex3
-rw-r--r--etc/refcards/cs-refcard.tex3
-rw-r--r--etc/refcards/cs-survival.tex3
-rw-r--r--etc/refcards/de-refcard.tex3
-rw-r--r--etc/refcards/dired-ref.tex3
-rw-r--r--etc/refcards/emacsver.tex4
-rw-r--r--etc/refcards/fr-dired-ref.tex3
-rw-r--r--etc/refcards/fr-refcard.tex3
-rw-r--r--etc/refcards/fr-survival.tex3
-rw-r--r--etc/refcards/orgcard.tex2
-rw-r--r--etc/refcards/pl-refcard.tex3
-rw-r--r--etc/refcards/pt-br-refcard.tex3
-rw-r--r--etc/refcards/refcard.tex3
-rw-r--r--etc/refcards/sk-dired-ref.tex3
-rw-r--r--etc/refcards/sk-refcard.tex3
-rw-r--r--etc/refcards/sk-survival.tex3
-rw-r--r--etc/refcards/survival.tex3
-rw-r--r--etc/refcards/vipcard.tex2
-rw-r--r--etc/refcards/viperCard.tex2
-rw-r--r--leim/ChangeLog4
-rw-r--r--leim/quail/hebrew.el6
-rw-r--r--lib-src/ChangeLog10
-rw-r--r--lib-src/ebrowse.c3
-rw-r--r--lib-src/etags.c3
-rw-r--r--lib-src/pop.c2
-rw-r--r--lib/stdbool.in.h51
-rw-r--r--lisp/ChangeLog616
-rw-r--r--lisp/align.el7
-rw-r--r--lisp/autoinsert.el2
-rw-r--r--lisp/bookmark.el5
-rw-r--r--lisp/calc/calc-ext.el4
-rw-r--r--lisp/calc/calc-forms.el2
-rw-r--r--lisp/calc/calc.el2
-rw-r--r--lisp/calendar/calendar.el4
-rw-r--r--lisp/calendar/diary-lib.el24
-rw-r--r--lisp/calendar/holidays.el8
-rw-r--r--lisp/calendar/lunar.el2
-rw-r--r--lisp/calendar/solar.el2
-rw-r--r--lisp/calendar/timeclock.el4
-rw-r--r--lisp/comint.el2
-rw-r--r--lisp/custom.el47
-rw-r--r--lisp/desktop.el2
-rw-r--r--lisp/dired-aux.el63
-rw-r--r--lisp/dired.el61
-rw-r--r--lisp/ehelp.el13
-rw-r--r--lisp/emacs-lisp/advice.el193
-rw-r--r--lisp/emacs-lisp/benchmark.el6
-rw-r--r--lisp/emacs-lisp/byte-run.el9
-rw-r--r--lisp/emacs-lisp/bytecomp.el4
-rw-r--r--lisp/emacs-lisp/cl-lib.el2
-rw-r--r--lisp/emacs-lisp/cl-loaddefs.el28
-rw-r--r--lisp/emacs-lisp/cl-macs.el83
-rw-r--r--lisp/emacs-lisp/debug.el198
-rw-r--r--lisp/emacs-lisp/easymenu.el2
-rw-r--r--lisp/emacs-lisp/edebug.el751
-rw-r--r--lisp/emacs-lisp/lisp-mode.el77
-rw-r--r--lisp/emacs-lisp/macroexp.el110
-rw-r--r--lisp/emacs-lisp/map-ynp.el10
-rw-r--r--lisp/emacs-lisp/pcase.el2
-rw-r--r--lisp/emacs-lisp/timer.el6
-rw-r--r--lisp/emulation/cua-rect.el2
-rw-r--r--lisp/emulation/edt-mapper.el4
-rw-r--r--lisp/emulation/edt.el10
-rw-r--r--lisp/emulation/tpu-edt.el6
-rw-r--r--lisp/emulation/tpu-extras.el2
-rw-r--r--lisp/emulation/tpu-mapper.el2
-rw-r--r--lisp/emulation/vi.el2
-rw-r--r--lisp/emulation/viper.el4
-rw-r--r--lisp/epa-mail.el38
-rw-r--r--lisp/erc/ChangeLog6
-rw-r--r--lisp/erc/erc-button.el2
-rw-r--r--lisp/erc/erc-capab.el2
-rw-r--r--lisp/erc/erc-match.el2
-rw-r--r--lisp/erc/erc-netsplit.el2
-rw-r--r--lisp/erc/erc-page.el2
-rw-r--r--lisp/erc/erc-replace.el2
-rw-r--r--lisp/erc/erc-stamp.el2
-rw-r--r--lisp/erc/erc-track.el2
-rw-r--r--lisp/eshell/em-alias.el8
-rw-r--r--lisp/eshell/em-unix.el2
-rw-r--r--lisp/eshell/esh-util.el2
-rw-r--r--lisp/ffap.el4
-rw-r--r--lisp/files.el145
-rw-r--r--lisp/filesets.el2
-rw-r--r--lisp/flow-ctrl.el2
-rw-r--r--lisp/font-lock.el2
-rw-r--r--lisp/frame.el6
-rw-r--r--lisp/generic-x.el2
-rw-r--r--lisp/gnus/ChangeLog128
-rw-r--r--lisp/gnus/gnus-art.el2
-rw-r--r--lisp/gnus/gnus-demon.el9
-rw-r--r--lisp/gnus/gnus-fun.el4
-rw-r--r--lisp/gnus/gnus-group.el7
-rw-r--r--lisp/gnus/gnus-logic.el73
-rw-r--r--lisp/gnus/gnus-notifications.el22
-rw-r--r--lisp/gnus/gnus-score.el231
-rw-r--r--lisp/gnus/gnus-srvr.el3
-rw-r--r--lisp/gnus/gnus-util.el17
-rw-r--r--lisp/gnus/gnus.el45
-rw-r--r--lisp/gnus/message.el32
-rw-r--r--lisp/gnus/nnmaildir.el286
-rw-r--r--lisp/gnus/qp.el16
-rw-r--r--lisp/help-fns.el2
-rw-r--r--lisp/help.el71
-rw-r--r--lisp/hi-lock.el6
-rw-r--r--lisp/ibuffer.el12
-rw-r--r--lisp/ielm.el2
-rw-r--r--lisp/image.el4
-rw-r--r--lisp/info.el49
-rw-r--r--lisp/international/ogonek.el7
-rw-r--r--lisp/isearch.el19
-rw-r--r--lisp/language/chinese.el10
-rw-r--r--lisp/loadup.el28
-rw-r--r--lisp/locate.el2
-rw-r--r--lisp/mail/feedmail.el5
-rw-r--r--lisp/mail/mail-hist.el2
-rw-r--r--lisp/mail/mailabbrev.el47
-rw-r--r--lisp/mail/smtpmail.el12
-rw-r--r--lisp/mail/uce.el2
-rw-r--r--lisp/minibuffer.el2
-rw-r--r--lisp/mouse-copy.el2
-rw-r--r--lisp/mouse-drag.el2
-rw-r--r--lisp/net/ange-ftp.el14
-rw-r--r--lisp/net/browse-url.el5
-rw-r--r--lisp/net/goto-addr.el2
-rw-r--r--lisp/net/newsticker.el2
-rw-r--r--lisp/net/quickurl.el2
-rw-r--r--lisp/net/tramp-cmds.el2
-rw-r--r--lisp/net/tramp.el4
-rw-r--r--lisp/net/trampver.el4
-rw-r--r--lisp/net/webjump.el2
-rw-r--r--lisp/novice.el4
-rw-r--r--lisp/pcomplete.el2
-rw-r--r--lisp/play/blackbox.el2
-rw-r--r--lisp/play/bubbles.el2
-rw-r--r--lisp/play/decipher.el14
-rw-r--r--lisp/play/handwrite.el2
-rw-r--r--lisp/printing.el10
-rw-r--r--lisp/progmodes/antlr-mode.el2
-rw-r--r--lisp/progmodes/cc-cmds.el17
-rw-r--r--lisp/progmodes/cc-defs.el2
-rw-r--r--lisp/progmodes/cc-engine.el8
-rw-r--r--lisp/progmodes/cc-langs.el7
-rw-r--r--lisp/progmodes/cc-styles.el4
-rw-r--r--lisp/progmodes/cmacexp.el2
-rw-r--r--lisp/progmodes/compile.el22
-rw-r--r--lisp/progmodes/ebnf2ps.el4
-rw-r--r--lisp/progmodes/ebrowse.el2
-rw-r--r--lisp/progmodes/f90.el5
-rw-r--r--lisp/progmodes/flymake.el5
-rw-r--r--lisp/progmodes/hideshow.el2
-rw-r--r--lisp/progmodes/idlw-complete-structtag.el4
-rw-r--r--lisp/progmodes/idlw-shell.el6
-rw-r--r--lisp/progmodes/idlwave.el4
-rw-r--r--lisp/progmodes/inf-lisp.el4
-rw-r--r--lisp/progmodes/mixal-mode.el2
-rw-r--r--lisp/progmodes/octave-mod.el4
-rw-r--r--lisp/progmodes/perl-mode.el4
-rw-r--r--lisp/progmodes/prolog.el4
-rw-r--r--lisp/progmodes/python.el16
-rw-r--r--lisp/progmodes/ruby-mode.el173
-rw-r--r--lisp/progmodes/sh-script.el31
-rw-r--r--lisp/progmodes/sql.el57
-rw-r--r--lisp/progmodes/verilog-mode.el4
-rw-r--r--lisp/progmodes/vhdl-mode.el15
-rw-r--r--lisp/ps-print.el2
-rw-r--r--lisp/register.el51
-rw-r--r--lisp/replace.el110
-rw-r--r--lisp/saveplace.el12
-rw-r--r--lisp/ses.el4
-rw-r--r--lisp/shell.el36
-rw-r--r--lisp/simple.el8
-rw-r--r--lisp/speedbar.el8
-rw-r--r--lisp/startup.el27
-rw-r--r--lisp/strokes.el9
-rw-r--r--lisp/subr.el81
-rw-r--r--lisp/term/iris-ansi.el2
-rw-r--r--lisp/term/lk201.el2
-rw-r--r--lisp/term/rxvt.el2
-rw-r--r--lisp/term/tvi970.el2
-rw-r--r--lisp/term/wyse50.el2
-rw-r--r--lisp/term/xterm.el2
-rw-r--r--lisp/textmodes/flyspell.el6
-rw-r--r--lisp/textmodes/ispell.el5
-rw-r--r--lisp/textmodes/picture.el8
-rw-r--r--lisp/textmodes/reftex.el4
-rw-r--r--lisp/textmodes/rst.el2
-rw-r--r--lisp/textmodes/sgml-mode.el2
-rw-r--r--lisp/textmodes/table.el10
-rw-r--r--lisp/textmodes/two-column.el5
-rw-r--r--lisp/time-stamp.el4
-rw-r--r--lisp/time.el3
-rw-r--r--lisp/url/url-methods.el2
-rw-r--r--lisp/userlock.el48
-rw-r--r--lisp/vc/diff-mode.el2
-rw-r--r--lisp/vc/pcvs-defs.el4
-rw-r--r--lisp/vc/vc-bzr.el14
-rw-r--r--lisp/vc/vc-git.el2
-rw-r--r--lisp/vc/vc.el8
-rw-r--r--lisp/version.el103
-rw-r--r--lisp/windmove.el2
-rw-r--r--lisp/window.el318
-rw-r--r--m4/manywarnings.m4153
-rwxr-xr-xmake-dist20
-rw-r--r--nextstep/ChangeLog19
-rw-r--r--nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings6
-rw-r--r--nextstep/Makefile.in67
-rw-r--r--nextstep/templates/Emacs.desktop.in (renamed from nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop)2
-rw-r--r--nextstep/templates/Info-gnustep.plist.in (renamed from nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist)6
-rw-r--r--nextstep/templates/Info.plist.in (renamed from nextstep/Cocoa/Emacs.base/Contents/Info.plist)4
-rw-r--r--nextstep/templates/InfoPlist.strings.in6
-rw-r--r--nt/ChangeLog47
-rw-r--r--nt/config.nt76
-rwxr-xr-xnt/configure.bat2
-rw-r--r--nt/inc/ms-w32.h11
-rw-r--r--nt/inc/unistd.h6
-rw-r--r--src/.gdbinit11
-rw-r--r--src/ChangeLog924
-rw-r--r--src/Makefile.in11
-rw-r--r--src/alloc.c608
-rw-r--r--src/atimer.c80
-rw-r--r--src/bidi.c84
-rw-r--r--src/blockinput.h16
-rw-r--r--src/buffer.c98
-rw-r--r--src/buffer.h11
-rw-r--r--src/bytecode.c21
-rw-r--r--src/callint.c1
-rw-r--r--src/callproc.c30
-rw-r--r--src/casefiddle.c2
-rw-r--r--src/casetab.c2
-rw-r--r--src/category.c1
-rw-r--r--src/ccl.c1
-rw-r--r--src/character.c3
-rw-r--r--src/charset.c7
-rw-r--r--src/chartab.c2
-rw-r--r--src/cm.c3
-rw-r--r--src/cmds.c2
-rw-r--r--src/coding.c21
-rw-r--r--src/composite.c1
-rw-r--r--src/composite.h2
-rw-r--r--src/conf_post.h27
-rw-r--r--src/data.c112
-rw-r--r--src/dbusbind.c2
-rw-r--r--src/dired.c3
-rw-r--r--src/dispextern.h6
-rw-r--r--src/dispnew.c53
-rw-r--r--src/doc.c2
-rw-r--r--src/doprnt.c5
-rw-r--r--src/dosfns.c2
-rw-r--r--src/editfns.c17
-rw-r--r--src/emacs.c235
-rw-r--r--src/emacsgtkfixed.c9
-rw-r--r--src/eval.c130
-rw-r--r--src/fileio.c202
-rw-r--r--src/filelock.c25
-rw-r--r--src/firstfile.c5
-rw-r--r--src/floatfns.c628
-rw-r--r--src/fns.c122
-rw-r--r--src/font.c109
-rw-r--r--src/font.h46
-rw-r--r--src/fontset.c29
-rw-r--r--src/frame.c28
-rw-r--r--src/frame.h5
-rw-r--r--src/fringe.c10
-rw-r--r--src/ftfont.c32
-rw-r--r--src/ftxfont.c23
-rw-r--r--src/gnutls.c1
-rw-r--r--src/gtkutil.c30
-rw-r--r--src/image.c231
-rw-r--r--src/indent.c5
-rw-r--r--src/insdel.c56
-rw-r--r--src/intervals.c22
-rw-r--r--src/keyboard.c321
-rw-r--r--src/keyboard.h2
-rw-r--r--src/keymap.c4
-rw-r--r--src/lisp.h288
-rw-r--r--src/lisp.mk1
-rw-r--r--src/lread.c23
-rw-r--r--src/macros.c2
-rw-r--r--src/makefile.w32-in2
-rw-r--r--src/marker.c28
-rw-r--r--src/menu.c5
-rw-r--r--src/minibuf.c6
-rw-r--r--src/msdos.c30
-rw-r--r--src/ns.mk39
-rw-r--r--src/nsfns.m15
-rw-r--r--src/nsfont.m16
-rw-r--r--src/nsimage.m1
-rw-r--r--src/nsmenu.m8
-rw-r--r--src/nsselect.m1
-rw-r--r--src/nsterm.h1
-rw-r--r--src/nsterm.m459
-rw-r--r--src/print.c12
-rw-r--r--src/process.c399
-rw-r--r--src/ralloc.c34
-rw-r--r--src/regex.c7
-rw-r--r--src/region-cache.c25
-rw-r--r--src/scroll.c6
-rw-r--r--src/search.c8
-rw-r--r--src/sheap.c3
-rw-r--r--src/sound.c40
-rw-r--r--src/syntax.c12
-rw-r--r--src/sysdep.c280
-rw-r--r--src/syssignal.h99
-rw-r--r--src/systty.h18
-rw-r--r--src/term.c45
-rw-r--r--src/termcap.c1
-rw-r--r--src/termchar.h2
-rw-r--r--src/terminal.c9
-rw-r--r--src/terminfo.c3
-rw-r--r--src/textprop.c5
-rw-r--r--src/tparam.c4
-rw-r--r--src/undo.c2
-rw-r--r--src/unexaix.c1
-rw-r--r--src/unexcoff.c1
-rw-r--r--src/unexcw.c1
-rw-r--r--src/unexsol.c1
-rw-r--r--src/vm-limit.c1
-rw-r--r--src/w16select.c1
-rw-r--r--src/w32.c60
-rw-r--r--src/w32console.c1
-rw-r--r--src/w32fns.c27
-rw-r--r--src/w32font.c12
-rw-r--r--src/w32font.h2
-rw-r--r--src/w32heap.c1
-rw-r--r--src/w32inevt.c1
-rw-r--r--src/w32menu.c2
-rw-r--r--src/w32proc.c41
-rw-r--r--src/w32reg.c1
-rw-r--r--src/w32select.c3
-rw-r--r--src/w32term.c19
-rw-r--r--src/w32uniscribe.c7
-rw-r--r--src/w32xfns.c3
-rw-r--r--src/widget.c15
-rw-r--r--src/window.c49
-rw-r--r--src/window.h15
-rw-r--r--src/xdisp.c107
-rw-r--r--src/xfaces.c72
-rw-r--r--src/xfns.c1
-rw-r--r--src/xfont.c15
-rw-r--r--src/xftfont.c33
-rw-r--r--src/xgselect.c6
-rw-r--r--src/xmenu.c32
-rw-r--r--src/xml.c1
-rw-r--r--src/xrdb.c1
-rw-r--r--src/xselect.c7
-rw-r--r--src/xsettings.c5
-rw-r--r--src/xsmfns.c1
-rw-r--r--src/xterm.c80
-rw-r--r--test/ChangeLog11
-rw-r--r--test/automated/ruby-mode-tests.el52
392 files changed, 8365 insertions, 6547 deletions
diff --git a/ChangeLog b/ChangeLog
index cf4506f0c7..7b9da90255 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,145 @@
+2012-09-17 Paul Eggert <[email protected]>
+
+ Remove no-longer-needed Solaris 2.4 vfork bug workaround.
+ * configure.ac (ac_cv_func_vfork_works): Default to 'no' on
+ Solaris 2.4, so that AC_FUNC_VFORK doesn't think vfork works.
+
+2012-09-17 Glenn Morris <[email protected]>
+
+ * configure.ac (copyright): New output variable.
+ (COPYRIGHT): New AC_DEFINE.
+
+2012-09-16 Paul Eggert <[email protected]>
+
+ Remove configure's --without-sync-input option (Bug#12450).
+ * configure.ac (SYNC_INPUT, BROKEN_SA_RESTART): Remove.
+
+2012-09-16 Glenn Morris <[email protected]>
+
+ Increase compartmentalization of Nextstep builds rules,
+ and store Emacs version number in fewer versioned files.
+ * configure.ac (ns_appsrc): Use relative names.
+ (ns_frag): Remove.
+ (Info-gnustep.plist, Emacs.desktop, Info.plist, InfoPlist.strings)
+ (nextstep/Makefile): Generate these nextstep files.
+ (SUBDIR_MAKEFILES): Add nextstep.
+ * Makefile.in (clean, distclean, bootstrap-clean): Add nextstep.
+ * make-dist (nextstep/templates): Add directory.
+ (nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj): Remove.
+ (nextstep/Cocoa/Emacs.base/Contents)
+ (nextstep, nextstep/GNUstep/Emacs.base/Resources): Update contents.
+
+2012-09-15 Paul Eggert <[email protected]>
+
+ Port better to POSIX hosts lacking _setjmp (Bug#12446).
+ * configure.ac (HAVE__SETJMP, HAVE_SIGSETJMP): New symbols.
+ (_setjmp, _longjmp): Remove.
+
+2012-09-14 Paul Eggert <[email protected]>
+
+ * configure.ac (--without-sync-input): Fix typo in usage message.
+
+ * configure.ac: Port to hosts lacking gtk.
+ (PKG_CHECK_MODULES): Capture pkg-config diagnostics
+ better, in particular, problems in invoking pkg-config itself.
+ This is useful on hosts that don't have pkg-config.
+ (GTK_MODULES): Do not exit 'configure' simply because gtk3
+ and gtk2 are both missing. Problem found on Solaris 8.
+
+2012-09-13 Jan Djärv <[email protected]>
+
+ * configure.ac: Reorder Xaw3d messages.
+ Report Gtk+ 3 as GTK.
+
+2012-09-13 Paul Eggert <[email protected]>
+
+ Simplify SIGIO usage (Bug#12408).
+ * configure.ac (NO_TERMIO, BROKEN_FIONREAD, BROKEN_SIGAIO)
+ (BROKEN_SIGPOLL, BROKEN_SIGPTY): Remove.
+ (USABLE_FIONREAD, USABLE_SIGIO): New symbols. All uses of
+ 'defined SIGIO' replaced with 'defined USABLE_SIGIO', with no need
+ to #undef SIGIO now (which was error-prone). Likewise, all uses
+ of 'defined FIONREAD' replaced with 'defined USABLE_FIONREAD'.
+
+2012-09-12 Jan Djärv <[email protected]>
+
+ * configure.ac: No --with-x-toolkit given: Try gtk3 toolkit first
+ and then gtk2 if not found.
+ --with-x-toolkit=gtk|yes: As above, but fail if gtk2 or gt3 not found.
+ --with-x-toolkit=gtk2: Only try gtk2, fail if not found.
+ --with-x-toolkit=gtk3: Only try gtk3, fail if not found.
+
+2012-09-11 Glenn Morris <[email protected]>
+
+ * Makefile.in (install-arch-dep, install-arch-indep, install-doc):
+ Be more explicit about dependencies, for parallel `make install'.
+
+2012-09-11 Paul Eggert <[email protected]>
+
+ Simplify, document, and port floating-point (Bug#12381).
+ * configure.ac (logb, cbrt): Do not check for these functions,
+ as they are not being used.
+
+2012-09-10 Paul Eggert <[email protected]>
+
+ Improve robustness of 'make bootstrap' (Bug#12376).
+ Run autogen.sh after bootstrap-clean, to avoid bzr pull issues.
+ * INSTALL, README: Document autogen.sh.
+ * Makefile.in (Makefile): Mark it as precious, since it's updated
+ atomically.
+ (MAKE_CONFIG_STATUS): New macro.
+ (config.status, bootstrap): Use it. This causes 'make bootstrap'
+ to run config.status with the --recheck option, which is more
+ appropriate for a bootstrap.
+ (bootstrap): Run autogen.sh right after cleaning. Don't worry
+ about failures due to missing tools.
+ * autogen.sh: Exit with status 101 when failing due to missing tools.
+ * make-dist: Distribute autogen.sh.
+
+2012-09-09 Paul Eggert <[email protected]>
+
+ Assume C89 or later for math functions (Bug#12381).
+ * configure.ac (frexp, fmod): Remove checks for these functions,
+ as we now assume them.
+ (FLOAT_CHECK_DOMAIN, HAVE_INVERSE_HYPERBOLIC, NO_MATHERR)
+ (HAVE_EXCEPTION):
+ Remove; no longer needed.
+
+2012-09-07 Paul Eggert <[email protected]>
+
+ More signal-handler cleanup (Bug#12327).
+ * configure.ac (FLOAT_CHECK_DOMAIN): Comment fix (Bug#12327).
+
+2012-09-06 Paul Eggert <[email protected]>
+
+ Signal-handler cleanup (Bug#12327).
+ * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF):
+ Adjust to syssignal.h changes.
+ (SIGNAL_H_AB): Remove; no longer needed.
+
+2012-09-04 Paul Eggert <[email protected]>
+
+ Simplify redefinition of 'abort' (Bug#12316).
+ * configure.ac (NO_ABRT): Remove.
+
+ * configure.ac (_setjmp, _longjmp): Check by compiling
+ instead of by guessing. The guesses were wrong for
+ recent versions of Solaris, such as Solaris 11.
+
+2012-09-03 Paul Eggert <[email protected]>
+
+ * configure.ac (WARN_CFLAGS): Omit -Wjump-misses-init.
+ It generates false alarms in doc.c, regex.c, xdisp.c. See
+ <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00040.html>.
+
+ Merge from gnulib, incorporating:
+ 2012-08-29 stdbool: be more compatible with mixed C/C++ compiles
+ 2011-11-30 manywarnings: update the list of "all" warnings
+
+2012-09-02 Jan Djärv <[email protected]>
+
+ * configure.ac (HAVE_GOBJECT): Check for gobject-2.0 (Bug#12332).
+
2012-09-01 Paul Eggert <[email protected]>
* configure.ac (_FORTIFY_SOURCE): Define only when optimizing.
diff --git a/INSTALL b/INSTALL
index f0cf5d68db..4716bbecf9 100644
--- a/INSTALL
+++ b/INSTALL
@@ -695,9 +695,9 @@ running the `configure' program, you have to perform the following steps.
corresponding `Makefile.in' files. This isn't so hard, just a matter
of editing in appropriate substitutions for the @...@ constructs.
-The `configure' script is built from `configure.ac' by the `autoconf'
-program. You need at least the version of autoconf specified in the
-AC_PREREQ(...) command to rebuild `configure' from `configure.ac'.
+The `configure' script is built from `configure.ac' by the
+`autogen.sh' script, which checks that `autoconf' and other build
+tools are sufficiently up to date and then runs the build tools.
BUILDING GNU EMACS BY HAND
diff --git a/Makefile.in b/Makefile.in
index 122a35d441..9bb8596793 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -360,15 +360,17 @@ $(MAKEFILE_NAME): config.status $(srcdir)/src/config.in \
$(srcdir)/Makefile.in $(SUBDIR_MAKEFILES_IN)
./config.status
-# Don't erase config.status if make is interrupted while refreshing it.
-.PRECIOUS: config.status
+# Don't erase these files if make is interrupted while refreshing them.
+.PRECIOUS: Makefile config.status
-config.status: ${srcdir}/configure ${srcdir}/lisp/version.el
+MAKE_CONFIG_STATUS = \
if [ -x ./config.status ]; then \
./config.status --recheck; \
else \
./configure $(CONFIGURE_FLAGS); \
fi
+config.status: ${srcdir}/configure ${srcdir}/lisp/version.el
+ $(MAKE_CONFIG_STATUS)
AUTOCONF_INPUTS = $(srcdir)/configure.ac $(srcdir)/aclocal.m4
@@ -383,6 +385,10 @@ AUTOMAKE_INPUTS = $(srcdir)/aclocal.m4 $(srcdir)/lib/Makefile.am \
$(srcdir)/lib/gnulib.mk
$(srcdir)/lib/Makefile.in: $(AUTOMAKE_INPUTS)
cd $(srcdir) && automake --gnu -a -c lib/Makefile
+
+# Regenerate files that this makefile would have made, if this makefile
+# had been built by Automake. The name 'am--refresh' is for
+# compatibility with subsidiary Automake-generated makefiles.
am--refresh: $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/src/config.in
.PHONY: am--refresh
@@ -427,7 +433,7 @@ write_subdir=if [ -f $${subdir}/subdirs.el ]; \
### Install the executables that were compiled specifically for this machine.
### We do install-arch-indep first because the executable needs the
### Lisp files and DOC file to work properly.
-install-arch-dep: install-arch-indep install-doc
+install-arch-dep: src install-arch-indep install-doc
umask 022; ${MKDIR_P} $(DESTDIR)${bindir}
cd lib-src && \
$(MAKE) install $(MFLAGS) prefix=${prefix} \
@@ -496,7 +502,7 @@ set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \
## work correctly, and therefore no idea when tar can be replaced.
## See also these comments from 2004 about cp -r working fine:
## http://lists.gnu.org/archive/html/autoconf-patches/2004-11/msg00005.html
-install-arch-indep: install-info install-man ${INSTALL_ARCH_INDEP_EXTRA}
+install-arch-indep: lisp leim install-info install-man ${INSTALL_ARCH_INDEP_EXTRA}
umask 022 ; \
locallisppath='${locallisppath}'; \
IFS=:; \
@@ -567,7 +573,7 @@ install-arch-indep: install-info install-man ${INSTALL_ARCH_INDEP_EXTRA}
## Note that install-arch-indep deletes and recreates the entire
## installed etc/ directory, so we need it to run before this does.
-install-doc: install-arch-indep
+install-doc: src install-arch-indep
-unset CDPATH; \
umask 022; ${MKDIR_P} $(DESTDIR)${docdir} ; \
if [ `cd ./etc; /bin/pwd` != `cd $(DESTDIR)${docdir}; /bin/pwd` ]; \
@@ -731,6 +737,7 @@ clean: FRC
-(cd doc/lispref && $(MAKE) $(MFLAGS) clean)
-(cd doc/lispintro && $(MAKE) $(MFLAGS) clean)
(cd leim; $(MAKE) $(MFLAGS) clean)
+ (cd nextstep && $(MAKE) $(MFLAGS) clean)
### `bootclean'
### Delete all files that need to be remade for a clean bootstrap.
@@ -757,6 +764,7 @@ distclean: FRC
(cd doc/lispintro && $(MAKE) $(MFLAGS) distclean)
(cd leim; $(MAKE) $(MFLAGS) distclean)
(cd lisp; $(MAKE) $(MFLAGS) distclean)
+ (cd nextstep && $(MAKE) $(MFLAGS) distclean)
${top_distclean}
### `bootstrap-clean'
@@ -774,10 +782,9 @@ bootstrap-clean: FRC
-(cd doc/lispintro && $(MAKE) $(MFLAGS) maintainer-clean)
(cd leim; $(MAKE) $(MFLAGS) maintainer-clean)
(cd lisp; $(MAKE) $(MFLAGS) bootstrap-clean)
+ (cd nextstep && $(MAKE) $(MFLAGS) maintainer-clean)
[ ! -f config.log ] || mv -f config.log config.log~
${top_bootclean}
-## configure; make bootstrap replaces the real config.log from configure
-## with the truncated one from config.status. The former is more useful.
### `maintainer-clean'
### Delete everything from the current directory that can be
@@ -883,14 +890,14 @@ dvi:
.PHONY: bootstrap
-## configure; make bootstrap replaces the real config.log from configure
-## with the truncated one from config.status. The former is more useful.
+# Bootstrapping does the following:
+# * Remove files to start from a clean slate.
+# * Run autogen.sh, but don't worry about exit status 101 (missing tools).
+# * Build Makefile, to build the build procedure itself.
+# * Do the actual build.
bootstrap: bootstrap-clean FRC
- if [ -x ./config.status ]; then \
- ./config.status; \
- else \
- ./configure $(CONFIGURE_FLAGS); \
- fi
+ cd $(srcdir) && { ./autogen.sh || test $$? -eq 101; }
+ $(MAKE_CONFIG_STATUS)
$(MAKE) $(MFLAGS) info all
.PHONY: check-declare
diff --git a/README b/README
index a11935ee3e..2c50c5bbb9 100644
--- a/README
+++ b/README
@@ -41,9 +41,14 @@ The file `configure.ac' is the input used by the autoconf program to
construct the `configure' script. Since Emacs has some configuration
requirements that autoconf can't meet directly, and for historical
reasons, `configure.ac' uses an unholy marriage of custom-baked
-configuration code and autoconf macros. If you want to rebuild
-`configure' from `configure.ac', you will need to install a recent
-version of autoconf and GNU m4.
+configuration code and autoconf macros.
+
+The shell script `autogen.sh' generates 'configure' and other files by
+running the GNU build tools autoconf and automake, which in turn use
+GNU m4 and Perl. If you want to use it, you will need to install
+recent versions of these build tools. This should be needed only if
+you edit files like `configure.ac' that specify Emacs's autobuild
+procedure.
The file `Makefile.in' is a template used by `configure' to create
`Makefile'.
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index be73d1a9bf..661cde9c43 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -90,11 +90,6 @@ BROKEN_GETWD
BROKEN_GET_CURRENT_DIR_NAME
BROKEN_NON_BLOCKING_CONNECT
BROKEN_PTY_READ_AFTER_EAGAIN
-BROKEN_SA_RESTART
-BROKEN_SIGAIO
-BROKEN_SIGIO
-BROKEN_SIGPOLL
-BROKEN_SIGPTY
CLASH_DETECTION
DATA_SEG_BITS
DATA_START
@@ -107,7 +102,6 @@ EMACS_CONFIGURATION
EMACS_CONFIG_OPTIONS
EMACS_INT
EMACS_UINT
-FLOAT_CHECK_DOMAIN
GC_MARK_SECONDARY_STACK
GC_MARK_STACK
GC_SETJMP_WORKS
@@ -121,7 +115,6 @@ HAVE_ATTRIBUTE_ALIGNED
HAVE_BDFFONT
HAVE_BOXES
HAVE_C99_STRTOLD
-HAVE_CBRT
HAVE_CFMAKERAW
HAVE_CFSETSPEED
HAVE_CLOCK_GETTIME
@@ -158,12 +151,10 @@ HAVE_ENDPWENT
HAVE_ENVIRON_DECL
HAVE_EUIDACCESS
HAVE_FCNTL_H
-HAVE_FMOD
HAVE_FORK
HAVE_FPATHCONF
HAVE_FREEIFADDRS
HAVE_FREETYPE
-HAVE_FREXP
HAVE_FSEEKO
HAVE_FSYNC
HAVE_FUTIMENS
@@ -217,7 +208,6 @@ HAVE_IFADDRS_H
HAVE_IMAGEMAGICK
HAVE_INET_SOCKETS
HAVE_INTTYPES_H
-HAVE_INVERSE_HYPERBOLIC
HAVE_JPEG
HAVE_KERBEROSIV_DES_H
HAVE_KERBEROSIV_KRB_H
@@ -255,7 +245,6 @@ HAVE_LIBXMU
HAVE_LINUX_VERSION_H
HAVE_LOCALTIME_R
HAVE_LOCAL_SOCKETS
-HAVE_LOGB
HAVE_LONG_FILE_NAMES
HAVE_LONG_LONG_INT
HAVE_LRAND48
@@ -428,10 +417,7 @@ MAIL_USE_POP
MAIL_USE_SYSTEM_LOCK
MAXPATHLEN
NLIST_STRUCT
-NO_ABORT
NO_EDITRES
-NO_MATHERR
-NO_TERMIO
NSIG
NSIG_MINIMUM
NULL_DEVICE
@@ -447,7 +433,6 @@ PTY_OPEN
PTY_TTY_NAME_SPRINTF
PURESIZE
RUN_TIME_REMAP
-SA_RESTART
SETPGRP_RELEASES_CTTY
SETUP_SLAVE_PTY
SIGALRM
@@ -580,7 +565,6 @@ getpid
isatty
kill
link
-logb
lseek
mkdir
mktemp
@@ -622,7 +606,6 @@ fopen
getpid
index
isatty
-logb
lseek
mkdir
mktemp
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 145028ec81..7f30fe8fc0 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,49 @@
+2012-09-17 Glenn Morris <[email protected]>
+
+ * admin.el (add-log-time-format): Declare.
+
+ * admin.el (cusver-scan, cusver-check): Bind local variables.
+
+ * admin.el (set-version): Set major version in
+ etc/refcards/ru-refcard.tex and etc/refcards/emacsver.tex.
+ (set-copyright): In etc/refcards, only change ru-refcard.tex
+ and emacsver.tex.
+
+ * admin.el (set-copyright): No more need to set copyrights for
+ nextstep, or .c files. Add configure.ac and config.nt.
+
+2012-09-16 Paul Eggert <[email protected]>
+
+ Remove configure's --without-sync-input option (Bug#12450).
+ * CPP-DEFINES (BROKEN_SA_RESTART, SA_RESTART): Remove.
+
+2012-09-16 Glenn Morris <[email protected]>
+
+ * admin.el (set-version): No more need to set nextstep versions.
+ (set-copyright): Update for moved nextstep files.
+
+2012-09-13 Paul Eggert <[email protected]>
+
+ Simplify SIGIO usage (Bug#12408).
+ * CPP_DEFINES (BROKEN_SIGAIO, BROKEN_SIGIO, BROKEN_SIGPOLL)
+ (BROKEN_SIGPTY, NO_TERMIO): Remove.
+
+2012-09-11 Paul Eggert <[email protected]>
+
+ Simplify, document, and port floating-point (Bug#12381).
+ * CPP-DEFINES (HAVE_CBRT, HAVE_LOGB, logb): Remove.
+
+2012-09-09 Paul Eggert <[email protected]>
+
+ Assume C89 or later for math functions (Bug#12381).
+ * CPP-DEFINES (HAVE_FMOD, HAVE_FREXP, FLOAT_CHECK_DOMAIN)
+ (HAVE_INVERSE_HYPERBOLIC, NO_MATHERR): Remove.
+
+2012-09-04 Paul Eggert <[email protected]>
+
+ Simplify redefinition of 'abort' (Bug#12316).
+ * CPP-DEFINES (NO_ABORT): Remove.
+
2012-08-28 Glenn Morris <[email protected]>
* bzrmerge.el (bzrmerge-merges): Allow unversioned files in the tree.
diff --git a/admin/admin.el b/admin/admin.el
index 6d729214bd..862e5aed6c 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -26,6 +26,8 @@
;;; Code:
+(defvar add-log-time-format) ; in add-log
+
(defun add-release-logs (root version)
"Add \"Version VERSION released.\" change log entries in ROOT.
Root must be the root of an Emacs source tree."
@@ -126,39 +128,16 @@ Root must be the root of an Emacs source tree."
(set-version-in-file root "nt/emacsclient.rc" comma-space-version
(rx (and "\"ProductVersion\"" (0+ space) ?,
(0+ space) ?\" (submatch (1+ (in "0-9, ")))
- "\\0\""))))
- ;; nextstep.
- (set-version-in-file
- root "nextstep/Cocoa/Emacs.base/Contents/Info.plist"
- version (rx (and "CFBundleGetInfoString" (1+ anything) "Emacs" (1+ space)
- (submatch (1+ (in "0-9."))))))
- (set-version-in-file
- root "nextstep/Cocoa/Emacs.base/Contents/Info.plist"
- version (rx (and "CFBundleShortVersionString" (1+ not-newline) ?\n
- (0+ not-newline) "<string>" (0+ space)
- (submatch (1+ (in "0-9."))))))
- (set-version-in-file
- root "nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings"
- version (rx (and "CFBundleShortVersionString" (0+ space) ?= (0+ space)
- ?\" (0+ space) "Version" (1+ space)
- (submatch (1+ (in "0-9."))))))
- (set-version-in-file
- root "nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings"
- version (rx (and "CFBundleGetInfoString" (0+ space) ?= (0+ space)
- ?\" (0+ space) "Emacs version" (1+ space)
- (submatch (1+ (in "0-9."))))))
- (set-version-in-file
- root "nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist"
- version (rx (and "ApplicationRelease" (0+ space) ?= (0+ space)
- ?\" (0+ space) (submatch (1+ (in "0-9."))))))
- (set-version-in-file
- root "nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist"
- version (rx (and "FullVersionID" (0+ space) ?= (0+ space)
- ?\" (0+ space) "Emacs" (1+ space)
- (submatch (1+ (in "0-9."))))))
- (set-version-in-file
- root "nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop"
- version (rx (and "Version=" (submatch (1+ (in "0-9.")))))))
+ "\\0\"")))
+ (when (string-match "\\([0-9]\\{2,\\}\\)" version)
+ (setq version (match-string 1 version))
+ (set-version-in-file root "etc/refcards/ru-refcard.tex" version
+ "\\\\newcommand{\\\\versionemacs}\\[0\\]\
+{\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs")
+ (set-version-in-file root "etc/refcards/emacsver.tex" version
+ "\\\\def\\\\versionemacs\
+{\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs"))))
+
;; Note this makes some assumptions about form of short copyright.
(defun set-copyright (root copyright)
@@ -172,45 +151,24 @@ 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 "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 ?\")))
- ?\" (submatch (1+ (not (in ?\")))) ?\")))
- (set-version-in-file root "lib-src/etags.c" copyright
- (rx (and "emacs_copyright" (0+ (not (in ?\")))
+ (set-version-in-file root "configure.ac" copyright
+ (rx (and bol "copyright" (0+ (not (in ?\")))
?\" (submatch (1+ (not (in ?\")))) ?\")))
+ (set-version-in-file root "nt/config.nt" copyright
+ (rx (and bol "#" (0+ blank) "define" (1+ blank)
+ "COPYRIGHT" (1+ blank)
+ ?\" (submatch (1+ (not (in ?\")))) ?\")))
(set-version-in-file root "lib-src/rcs2log" copyright
(rx (and "Copyright" (0+ space) ?= (0+ space)
?\' (submatch (1+ nonl)))))
- ;; This one is a nuisance, as it needs to be split over two lines.
- (string-match "\\(.*[0-9]\\{4\\} *\\)\\(.*\\)" copyright)
- ;; nextstep.
- (set-version-in-file
- root "nextstep/Cocoa/Emacs.base/Contents/Info.plist"
- copyright (rx (and "CFBundleGetInfoString" (1+ anything) "Emacs" (1+ space)
- (1+ (in "0-9.")) (1+ space)
- (submatch (1+ (not (in ?\<)))))))
- (set-version-in-file
- root "nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings"
- copyright (rx (and "NSHumanReadableCopyright" (0+ space) ?\= (0+ space)
- ?\" (submatch (1+ (not (in ?\")))))))
- (set-version-in-file
- root "nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist"
- copyright (rx (and "Copyright" (0+ space) ?\= (0+ space)
- ?\" (submatch (1+ (not (in ?\")))))))
(when (string-match "\\([0-9]\\{4\\}\\)" copyright)
(setq copyright (match-string 1 copyright))
- (dolist (file (directory-files (expand-file-name "etc/refcards" root)
- t "\\.tex\\'"))
- (unless (string-match "gnus-refcard\\.tex" file)
- (set-version-in-file
- root file copyright
- (concat (if (string-match "ru-refcard\\.tex" file)
- "\\\\newcommand{\\\\cyear}\\[0\\]{"
- "\\\\def\\\\year{")
- "\\([0-9]\\{4\\}\\)}.+%.+copyright year"))))))
+ (set-version-in-file root "etc/refcards/ru-refcard.tex" copyright
+ "\\\\newcommand{\\\\cyear}\\[0\\]\
+{\\([0-9]\\{4\\}\\)}.+%.+copyright year")
+ (set-version-in-file root "etc/refcards/emacsver.tex" copyright
+ "\\\\def\\\\year\
+{\\([0-9]\\{4\\}\\)}.+%.+copyright year")))
;;; Various bits of magic for generating the web manuals
@@ -459,7 +417,7 @@ Also generate PostScript output in PS-DEST."
(setq done t))
(t
(if (eobp)
- (error "Parse error in %s" f))
+ (error "Parse error in %s" f)) ; f is bound in manual-html-node
(unless open-td
(setq done t))))
(forward-line 1))))
@@ -491,7 +449,7 @@ If optional argument OLD is non-nil, also scan for defvars."
(let ((m (format "Scanning %s..." file))
(re (format "^[ \t]*\\((def%s\\)[ \t\n]"
(if old "\\(?:custom\\|var\\)" "custom")))
- alist var ver)
+ alist var ver form)
(message "%s" m)
(with-temp-buffer
(insert-file-contents file)
@@ -550,7 +508,7 @@ changes (in a non-trivial way). This function does not check for that."
(mapcar
(lambda (file)
(cons file (cusver-scan file))) newfiles)))
- oldcus result thisfile)
+ oldcus result thisfile file)
(message "Reading old defcustoms...")
(dolist (file oldfiles)
(setq oldcus (append oldcus (cusver-scan file t))))
diff --git a/admin/notes/bugtracker b/admin/notes/bugtracker
index 7d5e85a3ae..eed67f10df 100644
--- a/admin/notes/bugtracker
+++ b/admin/notes/bugtracker
@@ -618,6 +618,16 @@ 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.
+If you don't have the actual mail, just the mailman moderation mail
+version of it, you need to extract the original mail, and add the
+following headers:
+
+1) The leading envelope From line.
+2) Message-ID (get it from /var/log/mailman/vette).
+3) X-Debbugs-Envelope-To: submit
+
+Then pipe it to receive as above.
+
** Administrivia
The debbugs-submit list should have the administrivia option off,
diff --git a/autogen.sh b/autogen.sh
index 9cfaa40eee..dc8d53eec9 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -201,7 +201,7 @@ This is not recommended - see the comments in \`copy_autogen'.
Please report any problems with this script to [email protected] .
EOF
- exit 1
+ exit 101 # Exit status 101 means tools were missing.
fi
echo "Your system has the required tools, running autoreconf..."
diff --git a/autogen/Makefile.in b/autogen/Makefile.in
index d52d1543c5..103a2e94ef 100644
--- a/autogen/Makefile.in
+++ b/autogen/Makefile.in
@@ -359,6 +359,8 @@ GNULIB_WRITE = @GNULIB_WRITE@
GNULIB__EXIT = @GNULIB__EXIT@
GNUSTEP_CFLAGS = @GNUSTEP_CFLAGS@
GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@
+GOBJECT_CFLAGS = @GOBJECT_CFLAGS@
+GOBJECT_LIBS = @GOBJECT_LIBS@
GREP = @GREP@
GSETTINGS_CFLAGS = @GSETTINGS_CFLAGS@
GSETTINGS_LIBS = @GSETTINGS_LIBS@
@@ -785,6 +787,7 @@ builddir = @builddir@
cache_file = @cache_file@
canonical = @canonical@
configuration = @configuration@
+copyright = @copyright@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
diff --git a/autogen/config.in b/autogen/config.in
index c39453938b..2f2555c75c 100644
--- a/autogen/config.in
+++ b/autogen/config.in
@@ -50,9 +50,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to the number of bits in type 'wint_t'. */
#undef BITSIZEOF_WINT_T
-/* Define if FIONREAD should not be used. */
-#undef BROKEN_FIONREAD
-
/* Define if getwd should not be used. */
#undef BROKEN_GETWD
@@ -62,21 +59,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define on FreeBSD to work around an issue when reading from a PTY. */
#undef BROKEN_PTY_READ_AFTER_EAGAIN
-/* Define if SA_RESTART should only be used in batch mode. */
-#undef BROKEN_SA_RESTART
-
-/* Define if SIGAIO should not be used. */
-#undef BROKEN_SIGAIO
-
-/* Define if SIGIO should not be used. */
-#undef BROKEN_SIGIO
-
-/* Define if SIGPOLL should not be used. */
-#undef BROKEN_SIGPOLL
-
-/* Define if SIGPTY should not be used. */
-#undef BROKEN_SIGPTY
-
/* Define if the system is compatible with BSD 4.2. */
#undef BSD4_2
@@ -97,6 +79,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
his/her Emacs. */
#undef CLASH_DETECTION
+/* Short copyright string for this version of Emacs. */
+#undef COPYRIGHT
+
/* 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.
*/
@@ -157,10 +142,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
*/
#undef FIRST_PTY_LETTER
-/* Define if the float library doesn't handle errors by either setting errno,
- or signaling SIGFPE/SIGILL. */
-#undef FLOAT_CHECK_DOMAIN
-
/* Enable compile-time and run-time bounds-checking, and some warnings,
without upsetting glibc 2.15+. */
#if defined __OPTIMIZE__ && __OPTIMIZE__
@@ -250,9 +231,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if strtold conforms to C99. */
#undef HAVE_C99_STRTOLD
-/* Define to 1 if you have the `cbrt' function. */
-#undef HAVE_CBRT
-
/* Define to 1 if you have the `cfmakeraw' function. */
#undef HAVE_CFMAKERAW
@@ -371,9 +349,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
-/* Define to 1 if you have the `fmod' function. */
-#undef HAVE_FMOD
-
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
@@ -386,9 +361,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if using the freetype and fontconfig libraries. */
#undef HAVE_FREETYPE
-/* Define to 1 if you have the `frexp' function. */
-#undef HAVE_FREXP
-
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
@@ -540,9 +512,6 @@ 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 if you have the functions acosh, asinh, and atanh. */
-#undef HAVE_INVERSE_HYPERBOLIC
-
/* Define to 1 if you have the jpeg library (-ljpeg). */
#undef HAVE_JPEG
@@ -651,9 +620,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
-/* Define to 1 if you have the `logb' function. */
-#undef HAVE_LOGB
-
/* Define to 1 if you support file names longer than 14 characters. */
#undef HAVE_LONG_FILE_NAMES
@@ -825,6 +791,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if 'wint_t' is a signed integer type. */
#undef HAVE_SIGNED_WINT_T
+/* Define to 1 if sigsetjmp and siglongjmp work. The value of this symbol is
+ irrelevant if HAVE__SETJMP is defined. */
+#undef HAVE_SIGSETJMP
+
/* Define to 1 if the system has the type `sigset_t'. */
#undef HAVE_SIGSET_T
@@ -1108,6 +1078,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the `_ftime' function. */
#undef HAVE__FTIME
+/* Define to 1 if _setjmp and _longjmp work. */
+#undef HAVE__SETJMP
+
/* Define to 1 if you have the `__builtin_unwind_init' function. */
#undef HAVE___BUILTIN_UNWIND_INIT
@@ -1179,21 +1152,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
`NO'. */
#undef NARROWPROTO
-/* Do not define abort in emacs.c. */
-#undef NO_ABORT
-
/* Define if XEditRes should not be used. */
#undef NO_EDITRES
-/* Define to 1 if you don't have struct exception in math.h. */
-#undef NO_MATHERR
-
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
-/* Define if termio.h should not be included. */
-#undef NO_TERMIO
-
/* Minimum value of NSIG. */
#undef NSIG_MINIMUM
@@ -1303,9 +1267,6 @@ 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. */
#undef SIGNALS_VIA_CHARACTERS
-/* Define if AH_BOTTOM should include signal.h. */
-#undef SIGNAL_H_AHB
-
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
'sig_atomic_t'. */
#undef SIG_ATOMIC_T_SUFFIX
@@ -1334,9 +1295,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 on System V Release 4. */
#undef SVR4
-/* Process async input synchronously. */
-#undef SYNC_INPUT
-
/* Define to use system malloc. */
#undef SYSTEM_MALLOC
@@ -1381,6 +1339,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define if the system has Unix98 PTYs. */
#undef UNIX98_PTYS
+/* Define to 1 if FIONREAD is usable. */
+#undef USABLE_FIONREAD
+
+/* Define to 1 if SIGIO is usable. */
+#undef USABLE_SIGIO
+
/* How to get a user's full name. */
#undef USER_FULL_NAME
@@ -1542,12 +1506,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
declarations. Define as empty for no equivalent. */
#undef __restrict_arr
-/* Some platforms redefine this. */
-#undef _longjmp
-
-/* Some platforms redefine this. */
-#undef _setjmp
-
/* Some platforms that do not use configure define this to include extra
configuration information. */
#undef config_opsysfile
diff --git a/autogen/configure b/autogen/configure
index 11bca94ea0..4c6fa8b5cf 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -1143,6 +1143,7 @@ srcdir
canonical
configuration
version
+copyright
KRB4LIB
DESLIB
KRB5LIB
@@ -1181,6 +1182,8 @@ LIBGNUTLS_CFLAGS
LIBSELINUX_LIBS
SETTINGS_LIBS
SETTINGS_CFLAGS
+GOBJECT_LIBS
+GOBJECT_CFLAGS
GCONF_LIBS
GCONF_CFLAGS
GSETTINGS_LIBS
@@ -1328,8 +1331,7 @@ PACKAGE_NAME
PATH_SEPARATOR
SHELL'
ac_subst_files='deps_frag
-lisp_frag
-ns_frag'
+lisp_frag'
ac_user_opts='
enable_option_checking
with_all
@@ -1341,7 +1343,6 @@ with_mmdf
with_mail_unlink
with_mailhost
with_sound
-with_sync_input
with_x_toolkit
with_wide_int
with_xpm
@@ -2059,9 +2060,8 @@ Optional Packages:
--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 or gtk, gtk3,
- lucid or athena, motif, no)
+ --with-x-toolkit=KIT use an X toolkit (KIT one of: yes or gtk, gtk2,
+ gtk3, lucid or athena, motif, no)
--with-wide-int prefer wide Emacs integers (typically 62-bit)
--without-xpm don't compile with XPM image support
--without-jpeg don't compile with JPEG image support
@@ -3931,20 +3931,6 @@ fi
-# Check whether --with-sync-input was given.
-if test "${with_sync_input+set}" = set; then :
- withval=$with_sync_input;
-else
- with_sync_input=$with_features
-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
@@ -3954,11 +3940,13 @@ if test "${with_x_toolkit+set}" = set; then :
a | at | ath | athe | athen | athena ) val=athena ;;
m | mo | mot | moti | motif ) val=motif ;;
g | gt | gtk ) val=gtk ;;
+ gtk2 ) val=gtk2 ;;
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
+this option's value should be \`yes', \`no', \`lucid', \`athena', \`motif', \`gtk',
+\`gtk2' or \`gtk3'. \`yes' and \`gtk' are synonyms.
+\`athena' and \`lucid' are synonyms." "$LINENO" 5
;;
esac
with_x_toolkit=$val
@@ -7216,6 +7204,7 @@ fi
nw="$nw -Wswitch-default" # Too many warnings for now
nw="$nw -Wfloat-equal" # warns about high-quality code
nw="$nw -Winline" # OK to ignore 'inline'
+ nw="$nw -Wjump-misses-init" # We sometimes safely jump over init.
nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning
nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
@@ -7305,95 +7294,118 @@ $as_echo "$gl_cv_cc_nomfi_needed" >&6; }
gl_manywarn_set=
for gl_manywarn_item in \
- -Wall \
-W \
- -Wformat-y2k \
- -Wformat-nonliteral \
- -Wformat-security \
- -Winit-self \
- -Wmissing-include-dirs \
- -Wswitch-default \
- -Wswitch-enum \
- -Wunused \
- -Wunknown-pragmas \
- -Wstrict-aliasing \
- -Wstrict-overflow \
- -Wsystem-headers \
- -Wfloat-equal \
- -Wtraditional \
- -Wtraditional-conversion \
- -Wdeclaration-after-statement \
- -Wundef \
- -Wshadow \
- -Wunsafe-loop-optimizations \
- -Wpointer-arith \
+ -Wabi \
+ -Waddress \
+ -Wall \
+ -Warray-bounds \
+ -Wattributes \
-Wbad-function-cast \
- -Wc++-compat \
- -Wcast-qual \
- -Wcast-align \
- -Wwrite-strings \
- -Wconversion \
- -Wsign-conversion \
- -Wlogical-op \
- -Waggregate-return \
- -Wstrict-prototypes \
- -Wold-style-definition \
- -Wmissing-prototypes \
- -Wmissing-declarations \
- -Wmissing-noreturn \
- -Wmissing-format-attribute \
- -Wpacked \
- -Wpadded \
- -Wredundant-decls \
- -Wnested-externs \
- -Wunreachable-code \
- -Winline \
- -Winvalid-pch \
- -Wlong-long \
- -Wvla \
- -Wvolatile-register-var \
- -Wdisabled-optimization \
- -Wstack-protector \
- -Woverlength-strings \
-Wbuiltin-macro-redefined \
- -Wmudflap \
- -Wpacked-bitfield-compat \
- -Wsync-nand \
- ; do
- gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
- done
- # The following are not documented in the manual but are included in
- # output from gcc --help=warnings.
- for gl_manywarn_item in \
- -Wattributes \
+ -Wcast-align \
+ -Wchar-subscripts \
+ -Wclobbered \
+ -Wcomment \
+ -Wcomments \
-Wcoverage-mismatch \
- -Wunused-macros \
- ; do
- gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
- done
- # More warnings from gcc 4.6.2 --help=warnings.
- for gl_manywarn_item in \
- -Wabi \
-Wcpp \
-Wdeprecated \
-Wdeprecated-declarations \
+ -Wdisabled-optimization \
-Wdiv-by-zero \
-Wdouble-promotion \
+ -Wempty-body \
-Wendif-labels \
+ -Wenum-compare \
-Wextra \
-Wformat-contains-nul \
-Wformat-extra-args \
+ -Wformat-nonliteral \
+ -Wformat-security \
+ -Wformat-y2k \
-Wformat-zero-length \
-Wformat=2 \
+ -Wfree-nonheap-object \
+ -Wignored-qualifiers \
+ -Wimplicit \
+ -Wimplicit-function-declaration \
+ -Wimplicit-int \
+ -Winit-self \
+ -Winline \
+ -Wint-to-pointer-cast \
+ -Winvalid-memory-model \
+ -Winvalid-pch \
+ -Wjump-misses-init \
+ -Wlogical-op \
+ -Wmain \
+ -Wmaybe-uninitialized \
+ -Wmissing-braces \
+ -Wmissing-declarations \
+ -Wmissing-field-initializers \
+ -Wmissing-format-attribute \
+ -Wmissing-include-dirs \
+ -Wmissing-noreturn \
+ -Wmissing-parameter-type \
+ -Wmissing-prototypes \
+ -Wmudflap \
-Wmultichar \
+ -Wnarrowing \
+ -Wnested-externs \
+ -Wnonnull \
-Wnormalized=nfc \
+ -Wold-style-declaration \
+ -Wold-style-definition \
-Woverflow \
+ -Woverlength-strings \
+ -Woverride-init \
+ -Wpacked \
+ -Wpacked-bitfield-compat \
+ -Wparentheses \
+ -Wpointer-arith \
+ -Wpointer-sign \
-Wpointer-to-int-cast \
-Wpragmas \
+ -Wreturn-type \
+ -Wsequence-point \
+ -Wshadow \
+ -Wsizeof-pointer-memaccess \
+ -Wstack-protector \
+ -Wstrict-aliasing \
+ -Wstrict-overflow \
+ -Wstrict-prototypes \
-Wsuggest-attribute=const \
+ -Wsuggest-attribute=format \
-Wsuggest-attribute=noreturn \
-Wsuggest-attribute=pure \
+ -Wswitch \
+ -Wswitch-default \
+ -Wsync-nand \
+ -Wsystem-headers \
-Wtrampolines \
+ -Wtrigraphs \
+ -Wtype-limits \
+ -Wuninitialized \
+ -Wunknown-pragmas \
+ -Wunreachable-code \
+ -Wunsafe-loop-optimizations \
+ -Wunused \
+ -Wunused-but-set-parameter \
+ -Wunused-but-set-variable \
+ -Wunused-function \
+ -Wunused-label \
+ -Wunused-local-typedefs \
+ -Wunused-macros \
+ -Wunused-parameter \
+ -Wunused-result \
+ -Wunused-value \
+ -Wunused-variable \
+ -Wvarargs \
+ -Wvariadic-macros \
+ -Wvector-operation-performance \
+ -Wvla \
+ -Wvolatile-register-var \
+ -Wwrite-strings \
+ \
; do
gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
done
@@ -8550,8 +8562,9 @@ $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"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ ALSA_PKG_ERRORS=`($PKG_CONFIG --print-errors "$ALSA_MODULES") 2>&1`
fi
@@ -8861,38 +8874,6 @@ $as_echo "#define HAVE_SPEED_T 1" >>confdefs.h
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct exception" >&5
-$as_echo_n "checking for struct exception... " >&6; }
-if test "${emacs_cv_struct_exception+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* 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
-if ac_fn_c_try_compile "$LINENO"; then :
- emacs_cv_struct_exception=yes
-else
- emacs_cv_struct_exception=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_exception" >&5
-$as_echo "$emacs_cv_struct_exception" >&6; }
-HAVE_EXCEPTION=$emacs_cv_struct_exception
-if test $emacs_cv_struct_exception != yes || test $opsys = darwin; then
-
-$as_echo "#define NO_MATHERR 1" >>confdefs.h
-
-fi
-
@@ -9417,13 +9398,13 @@ if test "${with_ns}" != no; then
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
+ ns_appsrc=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
+ ns_appsrc=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)"
@@ -9513,7 +9494,6 @@ fi
INSTALL_ARCH_INDEP_EXTRA=install-etc
ns_self_contained=no
-ns_frag=/dev/null
NS_OBJ=
NS_OBJC_OBJ=
if test "${HAVE_NS}" = yes; then
@@ -9537,7 +9517,6 @@ if test "${HAVE_NS}" = yes; then
leimdir="\${ns_appresdir}/leim"
INSTALL_ARCH_INDEP_EXTRA=
fi
- ns_frag=$srcdir/src/ns.mk
NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o"
fi
CFLAGS="$tmp_CFLAGS"
@@ -9548,7 +9527,6 @@ CPPFLAGS="$tmp_CPPFLAGS"
-
## $window_system is now set to the window system we will
## ultimately use.
@@ -9568,6 +9546,9 @@ case "${window_system}" in
gtk ) with_gtk=yes
term_header=gtkutil.h
USE_X_TOOLKIT=none ;;
+ gtk2 ) with_gtk2=yes
+ term_header=gtkutil.h
+ USE_X_TOOLKIT=none ;;
gtk3 ) with_gtk3=yes
term_header=gtkutil.h
USE_X_TOOLKIT=none ;;
@@ -10399,8 +10380,9 @@ $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"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ RSVG_PKG_ERRORS=`($PKG_CONFIG --print-errors "$RSVG_MODULE") 2>&1`
fi
@@ -10469,8 +10451,9 @@ $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"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ IMAGEMAGICK_PKG_ERRORS=`($PKG_CONFIG --print-errors "$IMAGEMAGICK_MODULE") 2>&1`
fi
@@ -10517,7 +10500,9 @@ fi
HAVE_GTK=no
GTK_OBJ=
-if test "${with_gtk3}" = "yes"; then
+check_gtk2=no
+gtk3_pkg_errors=
+if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
GLIB_REQUIRED=2.28
GTK_REQUIRED=3.0
GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
@@ -10553,8 +10538,9 @@ $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"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ GTK_PKG_ERRORS=`($PKG_CONFIG --print-errors "$GTK_MODULES") 2>&1`
fi
@@ -10572,19 +10558,22 @@ $as_echo "no" >&6; }
pkg_check_gtk=no
fi
- if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
+ if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then
as_fn_error "$GTK_PKG_ERRORS" "$LINENO" 5
fi
+ if test "$pkg_check_gtk" = "yes"; then
$as_echo "#define HAVE_GTK3 1" >>confdefs.h
- GTK_OBJ=emacsgtkfixed.o
- term_header=gtkutil.h
+ GTK_OBJ=emacsgtkfixed.o
+ term_header=gtkutil.h
+ else
+ check_gtk2=yes
+ gtk3_pkg_errors="$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
+if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
GLIB_REQUIRED=2.10
GTK_REQUIRED=2.10
GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
@@ -10620,8 +10609,9 @@ $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"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ GTK_PKG_ERRORS=`($PKG_CONFIG --print-errors "$GTK_MODULES") 2>&1`
fi
@@ -10639,11 +10629,12 @@ $as_echo "no" >&6; }
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
+ if test "$pkg_check_gtk" = "no" &&
+ { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; }
+ then
+ as_fn_error "$gtk3_pkg_errors$GTK_PKG_ERRORS" "$LINENO" 5
fi
fi
-fi
if test x"$pkg_check_gtk" = xyes; then
@@ -10780,8 +10771,9 @@ $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"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ DBUS_PKG_ERRORS=`($PKG_CONFIG --print-errors "dbus-1 >= 1.0") 2>&1`
fi
@@ -10860,8 +10852,9 @@ $as_echo "no" >&6; }
GSETTINGS_CFLAGS=""
GSETTINGS_LIBS=""
## If we have a custom action on failure, don't print errors, but
- ## do set a variable so people can do so.
- GSETTINGS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gio-2.0 >= 2.26"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ GSETTINGS_PKG_ERRORS=`($PKG_CONFIG --print-errors "gio-2.0 >= 2.26") 2>&1`
fi
@@ -10921,8 +10914,9 @@ $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"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ GCONF_PKG_ERRORS=`($PKG_CONFIG --print-errors "gconf-2.0 >= 2.13") 2>&1`
fi
@@ -10950,6 +10944,61 @@ $as_echo "#define HAVE_GCONF 1" >>confdefs.h
fi
if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then
+
+ succeeded=no
+
+ if test "$PKG_CONFIG" = "no" ; then
+ HAVE_GOBJECT=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 gobject-2.0 >= 2.0" >&5
+$as_echo_n "checking for gobject-2.0 >= 2.0... " >&6; }
+
+ if $PKG_CONFIG --exists "gobject-2.0 >= 2.0" 2>&5 &&
+ GOBJECT_CFLAGS=`$PKG_CONFIG --cflags "gobject-2.0 >= 2.0" 2>&5` &&
+ GOBJECT_LIBS=`$PKG_CONFIG --libs "gobject-2.0 >= 2.0" 2>&5`; then
+ edit_cflags="
+ s,///*,/,g
+ s/^/ /
+ s/ -I/ $isystem/g
+ s/^ //
+ "
+ GOBJECT_CFLAGS=`$as_echo "$GOBJECT_CFLAGS" | sed -e "$edit_cflags"`
+ GOBJECT_LIBS=`$as_echo "$GOBJECT_LIBS" | sed -e 's,///*,/,g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$GOBJECT_CFLAGS' LIBS='$GOBJECT_LIBS'" >&5
+$as_echo "yes CFLAGS='$GOBJECT_CFLAGS' LIBS='$GOBJECT_LIBS'" >&6; }
+ succeeded=yes
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ GOBJECT_CFLAGS=""
+ GOBJECT_LIBS=""
+ ## If we have a custom action on failure, don't print errors, but
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ GOBJECT_PKG_ERRORS=`($PKG_CONFIG --print-errors "gobject-2.0 >= 2.0") 2>&1`
+
+ 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_GOBJECT=yes
+ else
+ HAVE_GOBJECT=no
+ fi
+
+ if test "$HAVE_GOBJECT" = "yes"; then
+ SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS"
+ SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS"
+ fi
SAVE_CFLAGS="$CFLAGS"
SAVE_LIBS="$LIBS"
CFLAGS="$SETTINGS_CFLAGS $CFLAGS"
@@ -11060,8 +11109,9 @@ $as_echo "no" >&6; }
LIBGNUTLS_CFLAGS=""
LIBGNUTLS_LIBS=""
## If we have a custom action on failure, don't print errors, but
- ## do set a variable so people can do so.
- LIBGNUTLS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gnutls >= 2.6.6"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ LIBGNUTLS_PKG_ERRORS=`($PKG_CONFIG --print-errors "gnutls >= 2.6.6") 2>&1`
fi
@@ -11113,8 +11163,6 @@ 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
else
@@ -11185,6 +11233,8 @@ fi
emacs_cv_xaw3d=no
fi
if test $emacs_cv_xaw3d = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xaw3d" >&5
+$as_echo_n "checking for xaw3d... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes; using Lucid toolkit" >&5
$as_echo "yes; using Lucid toolkit" >&6; }
USE_X_TOOLKIT=LUCID
@@ -11194,6 +11244,8 @@ $as_echo "yes; using Lucid toolkit" >&6; }
$as_echo "#define HAVE_XAW3D 1" >>confdefs.h
else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xaw3d" >&5
+$as_echo_n "checking for xaw3d... " >&6; }
{ $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
@@ -11687,8 +11739,9 @@ $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"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ FONTCONFIG_PKG_ERRORS=`($PKG_CONFIG --print-errors "fontconfig >= 2.2.0") 2>&1`
fi
@@ -11745,8 +11798,9 @@ $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"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ XFT_PKG_ERRORS=`($PKG_CONFIG --print-errors "xft >= 0.13.0") 2>&1`
fi
@@ -11912,8 +11966,9 @@ $as_echo "no" >&6; }
FREETYPE_CFLAGS=""
FREETYPE_LIBS=""
## If we have a custom action on failure, don't print errors, but
- ## do set a variable so people can do so.
- FREETYPE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "freetype2"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ FREETYPE_PKG_ERRORS=`($PKG_CONFIG --print-errors "freetype2") 2>&1`
fi
@@ -11972,8 +12027,9 @@ $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"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ LIBOTF_PKG_ERRORS=`($PKG_CONFIG --print-errors "libotf") 2>&1`
fi
@@ -12080,8 +12136,9 @@ $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"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ M17N_FLT_PKG_ERRORS=`($PKG_CONFIG --print-errors "m17n-flt") 2>&1`
fi
@@ -12769,8 +12826,9 @@ $as_echo "no" >&6; }
LIBXML2_CFLAGS=""
LIBXML2_LIBS=""
## If we have a custom action on failure, don't print errors, but
- ## do set a variable so people can do so.
- LIBXML2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libxml-2.0 > 2.6.17"`
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ LIBXML2_PKG_ERRORS=`($PKG_CONFIG --print-errors "libxml-2.0 > 2.6.17") 2>&1`
fi
@@ -12878,8 +12936,8 @@ $as_echo "#define HAVE_H_ERRNO 1" >>confdefs.h
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.
+# sqrt and other floating-point functions such as fmod and frexp
+# are found in -lm on most systems.
{ $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 :
@@ -13129,7 +13187,7 @@ esac
for ac_func in gethostname \
closedir getrusage get_current_dir_name \
-lrand48 logb frexp fmod cbrt setsid \
+lrand48 setsid \
fpathconf select euidaccess getpagesize setlocale \
utimes getrlimit setrlimit setpgid getcwd shutdown getaddrinfo \
__fpending strsignal setitimer \
@@ -14431,6 +14489,11 @@ else
$as_echo "no" >&6; }
fi
+case $canonical in
+ *-solaris2.4 | *-solaris2.4.*)
+ : ${ac_cv_func_vfork_works=no};;
+esac
+
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 :
@@ -14778,10 +14841,6 @@ $as_echo "#define AMPERSAND_FULL_NAME 1" >>confdefs.h
$as_echo "#define CLASH_DETECTION 1" >>confdefs.h
-
-
-
-
## Note: PTYs are broken on darwin <6. Use at your own risk.
$as_echo "#define HAVE_PTYS 1" >>confdefs.h
@@ -14847,12 +14906,6 @@ esac
case $opsys in
- darwin | gnu | hpux* | *bsd )
-
-$as_echo "#define NO_TERMIO 1" >>confdefs.h
-
- ;;
-
irix6-5 | sol2* | unixware )
$as_echo "#define NSIG_MINIMUM 32" >>confdefs.h
@@ -14860,29 +14913,15 @@ $as_echo "#define NSIG_MINIMUM 32" >>confdefs.h
;;
esac
+emacs_broken_SIGIO=no
case $opsys in
hpux* | irix6-5 | openbsd | sol2* | unixware )
-
-$as_echo "#define BROKEN_SIGIO 1" >>confdefs.h
-
+ emacs_broken_SIGIO=yes
;;
aix4-2)
-$as_echo "#define BROKEN_FIONREAD 1" >>confdefs.h
-
-
-$as_echo "#define BROKEN_SIGAIO 1" >>confdefs.h
-
-
-$as_echo "#define BROKEN_SIGPOLL 1" >>confdefs.h
-
-
-$as_echo "#define BROKEN_SIGPTY 1" >>confdefs.h
-
-
-
$as_echo "#define BROKEN_GET_CURRENT_DIR_NAME 1" >>confdefs.h
;;
@@ -14892,12 +14931,6 @@ $as_echo "#define BROKEN_GET_CURRENT_DIR_NAME 1" >>confdefs.h
$as_echo "#define BROKEN_PTY_READ_AFTER_EAGAIN 1" >>confdefs.h
;;
-
- darwin)
-
-$as_echo "#define NO_ABORT 1" >>confdefs.h
-
- ;;
esac
case $opsys in
@@ -14965,7 +14998,7 @@ case $opsys in
cygwin )
$as_echo "#define PTY_ITERATION int i; for (i = 0; i < 1; i++)" >>confdefs.h
- $as_echo "#define PTY_OPEN do { int dummy; SIGMASKTYPE mask; mask = sigblock (sigmask (SIGCHLD)); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; sigsetmask (mask); if (fd >= 0) emacs_close (dummy); } while (0)" >>confdefs.h
+ $as_echo "#define PTY_OPEN do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (0)" >>confdefs.h
$as_echo "#define PTY_NAME_SPRINTF /**/" >>confdefs.h
@@ -14998,7 +15031,7 @@ $as_echo "#define UNIX98_PTYS 1" >>confdefs.h
$as_echo "#define PTY_ITERATION int i; for (i = 0; i < 1; i++)" >>confdefs.h
- $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptyname; sigblock (sigmask (SIGCHLD)); if (grantpt (fd) == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname(fd))) { sigunblock (sigmask (SIGCHLD)); close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); sigunblock (sigmask (SIGCHLD)); }" >>confdefs.h
+ $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h
if test "x$ac_cv_func_posix_openpt" = xyes; then
$as_echo "#define PTY_OPEN fd = posix_openpt (O_RDWR | O_NOCTTY)" >>confdefs.h
@@ -15043,12 +15076,12 @@ $as_echo "#define UNIX98_PTYS 1" >>confdefs.h
;;
sol2* )
- $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; sigblock (sigmask (SIGCLD)); if (grantpt (fd) == -1) { emacs_close (fd); return -1; } sigunblock (sigmask (SIGCLD)); if (unlockpt (fd) == -1) { emacs_close (fd); return -1; } if (!(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h
+ $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h
;;
unixware )
- $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; sigblock(sigmask(SIGCLD)); if (grantpt(fd) == -1) fatal(\"could not grant slave pty\"); sigunblock(sigmask(SIGCLD)); if (unlockpt(fd) == -1) fatal(\"could not unlock slave pty\"); if (!(ptyname = ptsname(fd))) fatal (\"could not enable slave pty\"); snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h
+ $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal(\"could not grant slave pty\"); if (unlockpt(fd) == -1) fatal(\"could not unlock slave pty\"); if (!(ptyname = ptsname(fd))) fatal (\"could not enable slave pty\"); snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h
;;
esac
@@ -15401,15 +15434,78 @@ else
;;
esac
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _setjmp" >&5
+$as_echo_n "checking for _setjmp... " >&6; }
+if test "${emacs_cv_func__setjmp+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <setjmp.h>
+
+int
+main ()
+{
+jmp_buf j;
+ if (! _setjmp (j))
+ _longjmp (j, 1);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ emacs_cv_func__setjmp=yes
+else
+ emacs_cv_func__setjmp=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_func__setjmp" >&5
+$as_echo "$emacs_cv_func__setjmp" >&6; }
+if test $emacs_cv_func__setjmp = yes; then
-case $opsys in
- sol2* | unixware )
+$as_echo "#define HAVE__SETJMP 1" >>confdefs.h
-$as_echo "#define _setjmp setjmp" >>confdefs.h
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigsetjmp" >&5
+$as_echo_n "checking for sigsetjmp... " >&6; }
+if test "${emacs_cv_func_sigsetjmp+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <setjmp.h>
+
+int
+main ()
+{
+sigjmp_buf j;
+ if (! sigsetjmp (j, 1))
+ siglongjmp (j, 1);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ emacs_cv_func_sigsetjmp=yes
+else
+ emacs_cv_func_sigsetjmp=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_func_sigsetjmp" >&5
+$as_echo "$emacs_cv_func_sigsetjmp" >&6; }
+ if test $emacs_cv_func_sigsetjmp = yes; then
+$as_echo "#define HAVE_SIGSETJMP 1" >>confdefs.h
-$as_echo "#define _longjmp longjmp" >>confdefs.h
+ fi
+fi
+case $opsys in
+ sol2* | unixware )
$as_echo "#define TIOCSIGSEND TIOCSIGNAL" >>confdefs.h
@@ -15423,12 +15519,6 @@ case $opsys in
$as_echo "#define XOS_NEEDS_TIME_H 1" >>confdefs.h
;;
-
- netbsd | openbsd )
-
-$as_echo "#define SIGNAL_H_AHB 1" >>confdefs.h
-
- ;;
esac
@@ -15574,6 +15664,85 @@ $as_echo "#define SOLARIS2 /**/" >>confdefs.h
;;
esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable FIONREAD" >&5
+$as_echo_n "checking for usable FIONREAD... " >&6; }
+if test "${emacs_cv_usable_FIONREAD+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $opsys in
+ aix4-2)
+ emacs_cv_usable_FIONREAD=no
+ ;;
+
+ *)
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/ioctl.h>
+ #ifdef USG5_4
+ # include <sys/filio.h>
+ #endif
+
+int
+main ()
+{
+int foo = ioctl (0, FIONREAD, &foo);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ emacs_cv_usable_FIONREAD=yes
+else
+ emacs_cv_usable_FIONREAD=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ;;
+ esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_usable_FIONREAD" >&5
+$as_echo "$emacs_cv_usable_FIONREAD" >&6; }
+if test $emacs_cv_usable_FIONREAD = yes; then
+
+$as_echo "#define USABLE_FIONREAD 1" >>confdefs.h
+
+
+ if test $emacs_broken_SIGIO = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable SIGIO" >&5
+$as_echo_n "checking for usable SIGIO... " >&6; }
+if test "${emacs_cv_usable_SIGIO+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <fcntl.h>
+ #include <signal.h>
+
+int
+main ()
+{
+int foo = SIGIO | F_SETFL | FASYNC;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ emacs_cv_usable_SIGIO=yes
+else
+ emacs_cv_usable_SIGIO=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_usable_SIGIO" >&5
+$as_echo "$emacs_cv_usable_SIGIO" >&6; }
+ if test $emacs_cv_usable_SIGIO = yes; then
+
+$as_echo "#define USABLE_SIGIO 1" >>confdefs.h
+
+ fi
+ fi
+fi
+
case $opsys in
cygwin)
@@ -15584,9 +15753,6 @@ $as_echo "#define G_SLICE_ALWAYS_MALLOC 1" >>confdefs.h
hpux11)
-$as_echo "#define BROKEN_SA_RESTART 1" >>confdefs.h
-
-
$as_echo "#define USG_SUBTTY_WORKS 1" >>confdefs.h
;;
@@ -15621,6 +15787,14 @@ fi
version=$PACKAGE_VERSION
+copyright="Copyright (C) 2012 Free Software Foundation, Inc."
+
+cat >>confdefs.h <<_ACEOF
+#define COPYRIGHT "$copyright"
+_ACEOF
+
+
+
### Specify what sort of things we'll be editing into Makefile and config.h.
### Use configuration here uncanonicalized to avoid exceeding size limits.
@@ -24119,11 +24293,7 @@ fi
#### It makes printing result more understandable as using GTK sets
#### toolkit_scroll_bars to yes by default.
if test "${HAVE_GTK}" = "yes"; then
- if test "${with_gtk3}" = "yes"; then
- USE_X_TOOLKIT=GTK3
- else
- USE_X_TOOLKIT=GTK
- fi
+ USE_X_TOOLKIT=GTK
fi
echo "
@@ -24212,9 +24382,19 @@ test "${prefix}" != NONE &&
test "${exec_prefix}" != NONE &&
exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`
-SUBDIR_MAKEFILES="lib/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"
+if test "$HAVE_NS" = "yes"; then
+ if test "$NS_IMPL_GNUSTEP" = yes; then
+ ac_config_files="$ac_config_files nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in"
+
+ else
+ ac_config_files="$ac_config_files nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in"
+
+ fi
+fi
+
+SUBDIR_MAKEFILES="lib/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 nextstep/Makefile"
-ac_config_files="$ac_config_files Makefile lib/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_files="$ac_config_files Makefile lib/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 nextstep/Makefile"
opt_makefile=test/automated/Makefile
@@ -25054,6 +25234,10 @@ do
case $ac_config_target in
"src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h:src/config.in" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist") CONFIG_FILES="$CONFIG_FILES nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in" ;;
+ "nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop") CONFIG_FILES="$CONFIG_FILES nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in" ;;
+ "nextstep/Cocoa/Emacs.base/Contents/Info.plist") CONFIG_FILES="$CONFIG_FILES nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in" ;;
+ "nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings") CONFIG_FILES="$CONFIG_FILES nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
"lib-src/Makefile") CONFIG_FILES="$CONFIG_FILES lib-src/Makefile" ;;
@@ -25066,6 +25250,7 @@ do
"lwlib/Makefile") CONFIG_FILES="$CONFIG_FILES lwlib/Makefile" ;;
"lisp/Makefile") CONFIG_FILES="$CONFIG_FILES lisp/Makefile" ;;
"leim/Makefile") CONFIG_FILES="$CONFIG_FILES leim/Makefile" ;;
+ "nextstep/Makefile") CONFIG_FILES="$CONFIG_FILES nextstep/Makefile" ;;
"test/automated/Makefile") CONFIG_FILES="$CONFIG_FILES test/automated/Makefile" ;;
"admin/unidata/Makefile") CONFIG_FILES="$CONFIG_FILES admin/unidata/Makefile" ;;
"mkdirs") CONFIG_COMMANDS="$CONFIG_COMMANDS mkdirs" ;;
diff --git a/configure.ac b/configure.ac
index 7b1ea53312..8f300206df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -128,17 +128,12 @@ AC_ARG_WITH([mailhost],[AS_HELP_STRING([--with-mailhost=HOSTNAME],
OPTION_DEFAULT_ON([sound],[don't compile with sound support])
-OPTION_DEFAULT_ON([sync-input],[process async input synchronously])
-if test "$with_sync_input" = yes; then
- AC_DEFINE(SYNC_INPUT, 1, [Process async input synchronously.])
-fi
-
dnl FIXME currently it is not the last.
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 or gtk, gtk3, lucid or athena, motif, no)])],
+ [use an X toolkit (KIT one of: yes or gtk, gtk2, gtk3, lucid or athena, motif, no)])],
[ case "${withval}" in
y | ye | yes ) val=gtk ;;
n | no ) val=no ;;
@@ -146,11 +141,13 @@ 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 ;;
+ gtk2 ) val=gtk2 ;;
gtk3 ) val=gtk3 ;;
* )
AC_MSG_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.])
+this option's value should be `yes', `no', `lucid', `athena', `motif', `gtk',
+`gtk2' or `gtk3'. `yes' and `gtk' are synonyms.
+`athena' and `lucid' are synonyms.])
;;
esac
with_x_toolkit=$val
@@ -706,6 +703,7 @@ else
nw="$nw -Wswitch-default" # Too many warnings for now
nw="$nw -Wfloat-equal" # warns about high-quality code
nw="$nw -Winline" # OK to ignore 'inline'
+ nw="$nw -Wjump-misses-init" # We sometimes safely jump over init.
nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning
nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
@@ -1187,9 +1185,10 @@ AC_DEFUN([PKG_CHECK_MODULES], [
$1_CFLAGS=""
$1_LIBS=""
## If we have a custom action on failure, don't print errors, but
- ## do set a variable so people can do so.
- $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
- ifelse([$4], ,echo $$1_PKG_ERRORS,)
+ ## do set a variable so people can do so. Do it in a subshell
+ ## to capture any diagnostics in invoking pkg-config.
+ $1_PKG_ERRORS=`($PKG_CONFIG --print-errors "$2") 2>&1`
+ ifelse([$4], ,echo "$$1_PKG_ERRORS",)
fi
AC_SUBST($1_CFLAGS)
@@ -1302,17 +1301,6 @@ if test $emacs_cv_speed_t = yes; then
[Define to 1 if `speed_t' is declared by <termios.h>.])
fi
-AC_CACHE_CHECK(for struct exception, emacs_cv_struct_exception,
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
-[[static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;]])],
- emacs_cv_struct_exception=yes, emacs_cv_struct_exception=no))
-HAVE_EXCEPTION=$emacs_cv_struct_exception
-dnl Define on Darwin so emacs symbols will not conflict with those
-dnl in the System framework. Otherwise -prebind will not work.
-if test $emacs_cv_struct_exception != yes || test $opsys = darwin; then
- AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.])
-fi
-
AC_CHECK_HEADERS_ONCE(sys/socket.h)
AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
#if HAVE_SYS_SOCKET_H
@@ -1469,13 +1457,13 @@ if test "${with_ns}" != no; then
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
+ ns_appsrc=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
+ ns_appsrc=GNUstep/Emacs.base
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)"
@@ -1530,7 +1518,6 @@ AC_SUBST(TEMACS_LDFLAGS2)
INSTALL_ARCH_INDEP_EXTRA=install-etc
ns_self_contained=no
-ns_frag=/dev/null
NS_OBJ=
NS_OBJC_OBJ=
if test "${HAVE_NS}" = yes; then
@@ -1557,7 +1544,6 @@ if test "${HAVE_NS}" = yes; then
leimdir="\${ns_appresdir}/leim"
INSTALL_ARCH_INDEP_EXTRA=
fi
- ns_frag=$srcdir/src/ns.mk
NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o"
fi
CFLAGS="$tmp_CFLAGS"
@@ -1567,7 +1553,6 @@ AC_SUBST(ns_self_contained)
AC_SUBST(NS_OBJ)
AC_SUBST(NS_OBJC_OBJ)
AC_SUBST(LIB_STANDARD)
-AC_SUBST_FILE(ns_frag)
HAVE_W32=no
W32_OBJ=
@@ -1614,6 +1599,9 @@ case "${window_system}" in
dnl Don't set this for GTK. A lot of tests below assumes Xt when
dnl USE_X_TOOLKIT is set.
USE_X_TOOLKIT=none ;;
+ gtk2 ) with_gtk2=yes
+ term_header=gtkutil.h
+ USE_X_TOOLKIT=none ;;
gtk3 ) with_gtk3=yes
term_header=gtkutil.h
USE_X_TOOLKIT=none ;;
@@ -1939,35 +1927,41 @@ fi
HAVE_GTK=no
GTK_OBJ=
-if test "${with_gtk3}" = "yes"; then
+check_gtk2=no
+gtk3_pkg_errors=
+if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
GLIB_REQUIRED=2.28
GTK_REQUIRED=3.0
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
+ if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then
AC_MSG_ERROR($GTK_PKG_ERRORS)
fi
- AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.])
- GTK_OBJ=emacsgtkfixed.o
- term_header=gtkutil.h
+ if test "$pkg_check_gtk" = "yes"; then
+ AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.])
+ GTK_OBJ=emacsgtkfixed.o
+ term_header=gtkutil.h
+ else
+ check_gtk2=yes
+ gtk3_pkg_errors="$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
+if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
GLIB_REQUIRED=2.10
GTK_REQUIRED=2.10
GTK_MODULES="gtk+-2.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)
+ if test "$pkg_check_gtk" = "no" &&
+ { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; }
+ then
+ AC_MSG_ERROR($gtk3_pkg_errors$GTK_PKG_ERRORS)
fi
fi
-fi
if test x"$pkg_check_gtk" = xyes; then
@@ -2082,6 +2076,11 @@ if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then
fi
if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then
+ PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= 2.0, HAVE_GOBJECT=yes, HAVE_GOBJECT=no)
+ if test "$HAVE_GOBJECT" = "yes"; then
+ SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS"
+ SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS"
+ fi
SAVE_CFLAGS="$CFLAGS"
SAVE_LIBS="$LIBS"
CFLAGS="$SETTINGS_CFLAGS $CFLAGS"
@@ -2132,7 +2131,6 @@ 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)
AC_CACHE_VAL(emacs_cv_xaw3d,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <X11/Intrinsic.h>
@@ -2145,6 +2143,7 @@ if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
emacs_cv_xaw3d=no
fi
if test $emacs_cv_xaw3d = yes; then
+ AC_MSG_CHECKING(for xaw3d)
AC_MSG_RESULT([yes; using Lucid toolkit])
USE_X_TOOLKIT=LUCID
HAVE_XAW3D=yes
@@ -2152,6 +2151,7 @@ if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
AC_DEFINE(HAVE_XAW3D, 1,
[Define to 1 if you have the Xaw3d library (-lXaw3d).])
else
+ AC_MSG_CHECKING(for xaw3d)
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for libXaw)
AC_CACHE_VAL(emacs_cv_xaw,
@@ -2766,8 +2766,8 @@ if test $emacs_cv_netdb_declares_h_errno = yes; then
AC_DEFINE(HAVE_H_ERRNO, 1, [Define to 1 if netdb.h declares h_errno.])
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.
+# sqrt and other floating-point functions such as fmod and frexp
+# are found in -lm on most systems.
AC_CHECK_LIB(m, sqrt)
# Check for mail-locking functions in a "mail" library. Probably this should
@@ -2847,7 +2847,7 @@ AC_SUBST(BLESSMAIL_TARGET)
AC_CHECK_FUNCS(gethostname \
closedir getrusage get_current_dir_name \
-lrand48 logb frexp fmod cbrt setsid \
+lrand48 setsid \
fpathconf select euidaccess getpagesize setlocale \
utimes getrlimit setrlimit setpgid getcwd shutdown getaddrinfo \
__fpending strsignal setitimer \
@@ -3227,6 +3227,14 @@ else
AC_MSG_RESULT(no)
fi
+dnl Check for a Solaris 2.4 vfork bug that Autoconf misses (through 2.69).
+dnl This can be removed once we assume Autoconf 2.70.
+case $canonical in
+ *-solaris2.4 | *-solaris2.4.*)
+ dnl Disable the Autoconf-generated vfork test.
+ : ${ac_cv_func_vfork_works=no};;
+esac
+
AC_FUNC_FORK
AC_CHECK_FUNCS(snprintf)
@@ -3277,12 +3285,6 @@ AC_DEFINE(CLASH_DETECTION, 1, [Define if you want lock files to be written,
so that Emacs can tell instantly when you try to modify a file that
someone else has modified in his/her Emacs.])
-AH_TEMPLATE(FLOAT_CHECK_DOMAIN, [Define if the float library doesn't
- handle errors by either setting errno, or signaling SIGFPE/SIGILL.])
-
-AH_TEMPLATE(HAVE_INVERSE_HYPERBOLIC, [Define if you have the functions
- acosh, asinh, and atanh.])
-
dnl Everybody supports this, except MS.
dnl Seems like the kind of thing we should be testing for, though.
## Note: PTYs are broken on darwin <6. Use at your own risk.
@@ -3343,10 +3345,6 @@ esac
case $opsys in
- darwin | gnu | hpux* | *bsd )
- AC_DEFINE(NO_TERMIO, 1, [Define if termio.h should not be included.])
- ;;
-
irix6-5 | sol2* | unixware )
dnl Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
dnl instead, there's a system variable _sys_nsig. Unfortunately, we
@@ -3356,26 +3354,16 @@ case $opsys in
;;
esac
+emacs_broken_SIGIO=no
case $opsys in
dnl SIGIO exists, but the feature doesn't work in the way Emacs needs.
dnl See eg <http://article.gmane.org/gmane.os.openbsd.ports/46831>.
hpux* | irix6-5 | openbsd | sol2* | unixware )
- AC_DEFINE(BROKEN_SIGIO, 1, [Define if SIGIO should not be used.])
+ emacs_broken_SIGIO=yes
;;
aix4-2)
- dnl BUILD 9008 - FIONREAD problem still exists in X-Windows.
- AC_DEFINE(BROKEN_FIONREAD, 1, [Define if FIONREAD should not be used.])
- dnl As we define BROKEN_FIONREAD, SIGIO will be undefined in systty.h.
- dnl But, on AIX, SIGAIO, SIGPTY, and SIGPOLL are defined as SIGIO,
- dnl which causes compilation error at init_signals in sysdep.c.
- dnl So, we define these macros so that syssignal.h detects them
- dnl and undefine SIGAIO, SIGPTY and SIGPOLL.
- AC_DEFINE(BROKEN_SIGAIO, 1, [Define if SIGAIO should not be used.])
- AC_DEFINE(BROKEN_SIGPOLL,1, [Define if SIGPOLL should not be used.])
- AC_DEFINE(BROKEN_SIGPTY, 1, [Define if SIGPTY should not be used.])
-
dnl On AIX Emacs uses the gmalloc.c malloc implementation. But given
dnl the way this system works, libc functions that return malloced
dnl memory use the libc malloc implementation. Calling xfree or
@@ -3417,12 +3405,6 @@ case $opsys in
AC_DEFINE(BROKEN_PTY_READ_AFTER_EAGAIN, 1, [Define on FreeBSD to
work around an issue when reading from a PTY.])
;;
-
- dnl Define the following so emacs symbols will not conflict with those
- dnl in the System framework. Otherwise -prebind will not work.
- darwin)
- AC_DEFINE(NO_ABORT, 1, [Do not define abort in emacs.c.])
- ;;
esac
case $opsys in
@@ -3457,7 +3439,7 @@ dnl The choice is controlled by the variable interrupt_input.
dnl
dnl Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
dnl
-dnl Emacs uses the presence or absence of the SIGIO and BROKEN_SIGIO macros
+dnl Emacs uses the presence of the USABLE_SIGIO macro
dnl to indicate whether or not signal-driven I/O is possible. It uses
dnl INTERRUPT_INPUT to decide whether to use it by default.
dnl
@@ -3517,7 +3499,7 @@ case $opsys in
cygwin )
AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
dnl multi-line AC_DEFINEs are hard. :(
- AC_DEFINE(PTY_OPEN, [ do { int dummy; SIGMASKTYPE mask; mask = sigblock (sigmask (SIGCHLD)); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; sigsetmask (mask); if (fd >= 0) emacs_close (dummy); } while (0)])
+ AC_DEFINE(PTY_OPEN, [ do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (0)])
AC_DEFINE(PTY_NAME_SPRINTF, [])
AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
;;
@@ -3546,7 +3528,7 @@ case $opsys in
AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
dnl Note that grantpt and unlockpt may fork. We must block SIGCHLD
dnl to prevent sigchld_handler from intercepting the child's death.
- AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname; sigblock (sigmask (SIGCHLD)); if (grantpt (fd) == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname(fd))) { sigunblock (sigmask (SIGCHLD)); close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); sigunblock (sigmask (SIGCHLD)); }])
+ AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }])
dnl if HAVE_POSIX_OPENPT
if test "x$ac_cv_func_posix_openpt" = xyes; then
AC_DEFINE(PTY_OPEN, [fd = posix_openpt (O_RDWR | O_NOCTTY)])
@@ -3591,18 +3573,15 @@ case $opsys in
;;
sol2* )
- dnl Uses sigblock/sigunblock rather than sighold/sigrelse,
- dnl which appear to be BSD4.1 specific. It may also be appropriate
- dnl for SVR4.x (x<2) but I'm not sure. [email protected]
dnl On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler()
dnl from intercepting that death. If any child but grantpt's should die
dnl within, it should be caught after sigrelse(2).
- AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock (sigmask (SIGCLD)); if (grantpt (fd) == -1) { emacs_close (fd); return -1; } sigunblock (sigmask (SIGCLD)); if (unlockpt (fd) == -1) { emacs_close (fd); return -1; } if (!(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }])
+ AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }])
;;
unixware )
dnl Comments are as per sol2*.
- AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock(sigmask(SIGCLD)); if (grantpt(fd) == -1) fatal("could not grant slave pty"); sigunblock(sigmask(SIGCLD)); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }])
+ AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal("could not grant slave pty"); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }])
;;
esac
@@ -3857,13 +3836,38 @@ else
esac
fi dnl GCC?
+AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <setjmp.h>
+ ]],
+ [[jmp_buf j;
+ if (! _setjmp (j))
+ _longjmp (j, 1);]])],
+ [emacs_cv_func__setjmp=yes],
+ [emacs_cv_func__setjmp=no])])
+if test $emacs_cv_func__setjmp = yes; then
+ AC_DEFINE([HAVE__SETJMP], 1, [Define to 1 if _setjmp and _longjmp work.])
+else
+ AC_CACHE_CHECK([for sigsetjmp], [emacs_cv_func_sigsetjmp],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <setjmp.h>
+ ]],
+ [[sigjmp_buf j;
+ if (! sigsetjmp (j, 1))
+ siglongjmp (j, 1);]])],
+ [emacs_cv_func_sigsetjmp=yes],
+ [emacs_cv_func_sigsetjmp=no])])
+ if test $emacs_cv_func_sigsetjmp = yes; then
+ AC_DEFINE([HAVE_SIGSETJMP], 1,
+ [Define to 1 if sigsetjmp and siglongjmp work.
+ The value of this symbol is irrelevant if HAVE__SETJMP is defined.])
+ fi
+fi
case $opsys in
sol2* | unixware )
- dnl setjmp and longjmp can safely replace _setjmp and _longjmp,
- dnl but they will run more slowly.
- AC_DEFINE(_setjmp, setjmp, [Some platforms redefine this.])
- AC_DEFINE(_longjmp, longjmp, [Some platforms redefine this.])
dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs,
dnl and this is all we need.
@@ -3878,13 +3882,6 @@ case $opsys in
AC_DEFINE(XOS_NEEDS_TIME_H, 1, [Compensate for a bug in Xos.h on
some systems, where it requires time.h.])
;;
-
- netbsd | openbsd )
- dnl Greg A. Woods <[email protected]> says we must include signal.h
- dnl before syssignal.h is included, to work around interface conflicts
- dnl that are handled with CPP __RENAME() macro in signal.h.
- AC_DEFINE(SIGNAL_H_AHB, 1, [Define if AH_BOTTOM should include signal.h.])
- ;;
esac
@@ -3974,6 +3971,46 @@ case $opsys in
;;
esac
+AC_CACHE_CHECK([for usable FIONREAD], [emacs_cv_usable_FIONREAD],
+ [case $opsys in
+ aix4-2)
+ dnl BUILD 9008 - FIONREAD problem still exists in X-Windows.
+ emacs_cv_usable_FIONREAD=no
+ ;;
+
+ *)
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <sys/types.h>
+ #include <sys/ioctl.h>
+ #ifdef USG5_4
+ # include <sys/filio.h>
+ #endif
+ ]],
+ [[int foo = ioctl (0, FIONREAD, &foo);]])],
+ [emacs_cv_usable_FIONREAD=yes],
+ [emacs_cv_usable_FIONREAD=no])
+ ;;
+ esac])
+if test $emacs_cv_usable_FIONREAD = yes; then
+ AC_DEFINE([USABLE_FIONREAD], [1], [Define to 1 if FIONREAD is usable.])
+
+ if test $emacs_broken_SIGIO = no; then
+ AC_CACHE_CHECK([for usable SIGIO], [emacs_cv_usable_SIGIO],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <fcntl.h>
+ #include <signal.h>
+ ]],
+ [[int foo = SIGIO | F_SETFL | FASYNC;]])],
+ [emacs_cv_usable_SIGIO=yes],
+ [emacs_cv_usable_SIGIO=no])],
+ [emacs_cv_usable_SIGIO=yes],
+ [emacs_cv_usable_SIGIO=no])
+ if test $emacs_cv_usable_SIGIO = yes; then
+ AC_DEFINE([USABLE_SIGIO], [1], [Define to 1 if SIGIO is usable.])
+ fi
+ fi
+fi
+
case $opsys in
dnl Emacs supplies its own malloc, but glib (part of Gtk+) calls
@@ -3987,11 +4024,6 @@ case $opsys in
;;
hpux11)
- dnl See comments in sysdep.c:sys_signal.
- dnl SA_RESTART resets the timeout of `select' on hpux11.
- dnl Defining BROKEN_SA_RESTART is not the same as undef'ing SA_RESTART.
- AC_DEFINE(BROKEN_SA_RESTART, 1, [Define if SA_RESTART should only
- be used in batch mode.])
dnl It works to open the pty's tty in the parent (Emacs), then
dnl close and reopen it in the child.
AC_DEFINE(USG_SUBTTY_WORKS, 1, [Define for USG systems where it
@@ -4026,6 +4058,11 @@ fi
version=$PACKAGE_VERSION
+copyright="Copyright (C) 2012 Free Software Foundation, Inc."
+AC_DEFINE_UNQUOTED(COPYRIGHT, ["$copyright"],
+ [Short copyright string for this version of Emacs.])
+AC_SUBST(copyright)
+
### 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)
@@ -4431,11 +4468,7 @@ End:
#### It makes printing result more understandable as using GTK sets
#### toolkit_scroll_bars to yes by default.
if test "${HAVE_GTK}" = "yes"; then
- if test "${with_gtk3}" = "yes"; then
- USE_X_TOOLKIT=GTK3
- else
- USE_X_TOOLKIT=GTK
- fi
+ USE_X_TOOLKIT=GTK
fi
echo "
@@ -4523,6 +4556,16 @@ fi
test "${exec_prefix}" != NONE &&
exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`]
+if test "$HAVE_NS" = "yes"; then
+ if test "$NS_IMPL_GNUSTEP" = yes; then
+ AC_CONFIG_FILES([nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in \
+ nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in])
+ else
+ AC_CONFIG_FILES([nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in \
+ nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in])
+ fi
+fi
+
dnl Obviously there is duplication here wrt $SUBDIR_MAKEFILES.
dnl You _can_ use that variable in AC_CONFIG_FILES, so long as any directory
dnl using automake (ie lib/) is explicitly listed and not "hidden" in a variable
@@ -4531,12 +4574,12 @@ dnl This will work, but you get a config.status that is not quite right
dnl (see http://lists.gnu.org/archive/html/bug-autoconf/2008-08/msg00028.html).
dnl That doesn't have any obvious consequences for Emacs, but on the whole
dnl it seems better to just live with the duplication.
-SUBDIR_MAKEFILES="lib/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"
+SUBDIR_MAKEFILES="lib/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 nextstep/Makefile"
AC_CONFIG_FILES([Makefile lib/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])
+ leim/Makefile nextstep/Makefile])
dnl test/ is not present in release tarfiles.
opt_makefile=test/automated/Makefile
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index a4f9985ad8..35e635eec2 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,8 +1,29 @@
+2012-09-17 Chong Yidong <[email protected]>
+
+ * building.texi (GDB User Interface Layout): Remove reference to
+ removed variable gdb-use-separate-io-buffer (Bug#12454).
+
+2012-09-08 Jambunathan K <[email protected]>
+
+ * regs.texi (Text Registers): `C-x r +' can now be used instead of
+ M-x append-to-register. New option `register-separator'.
+ (Number Registers): Mention that `C-x r +' is polymorphic.
+
+2012-09-07 Chong Yidong <[email protected]>
+
+ * windows.texi (Window Choice): Don't mention obsolete
+ display-buffer-reuse-frames.
+
+2012-09-04 Paul Eggert <[email protected]>
+
+ Give more-useful info on a fatal error (Bug#12328).
+ * trouble.texi (Crashing): New section, documenting this.
+
2012-08-24 Michael Albinus <[email protected]>
- * cmdargs.texi (General Variables): Setting
- $DBUS_SESSION_BUS_ADDRESS to a dummy value suppresses connections
- to the D-Bus session bus. (Bug#12112)
+ * cmdargs.texi (General Variables):
+ Setting $DBUS_SESSION_BUS_ADDRESS to a dummy value suppresses
+ connections to the D-Bus session bus. (Bug#12112)
2012-08-14 Eli Zaretskii <[email protected]>
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 05ea667e5f..21948f181f 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -888,10 +888,6 @@ displays the following frame layout:
@end group
@end smallexample
- However, if @code{gdb-use-separate-io-buffer} is @code{nil}, the I/O
-buffer does not appear and the primary source buffer occupies the full
-width of the frame.
-
@findex gdb-restore-windows
@findex gdb-many-windows
If you ever change the window layout, you can restore the ``many
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 6357aebc6f..192a9a2bb2 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -1136,6 +1136,7 @@ Dealing with Emacs Trouble
* Screen Garbled:: Garbage on the screen.
* Text Garbled:: Garbage in the text.
* Memory Full:: How to cope when you run out of memory.
+* Crashing:: What Emacs does when it crashes.
* After a Crash:: Recovering editing in an Emacs session that crashed.
* Emergency Escape:: What to do if Emacs stops responding.
@@ -1320,7 +1321,7 @@ when you get it, not just free for the manufacturer.
If you find GNU Emacs useful, please @strong{send a donation} to the
Free Software Foundation to support our work. Donations to the Free
Software Foundation are tax deductible in the US. If you use GNU Emacs
-at your workplace, please suggest that the company make a donation.
+at your workplace, please suggest that the company make a donation.
For more information on how you can help, see
@url{http://www.gnu.org/help/help.html}.
diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi
index 72fd6458dd..0a83c0bddd 100644
--- a/doc/emacs/regs.texi
+++ b/doc/emacs/regs.texi
@@ -92,6 +92,13 @@ Copy region into register @var{r} (@code{copy-to-register}).
Insert text from register @var{r} (@code{insert-register}).
@item M-x append-to-register @key{RET} @var{r}
Append region to text in register @var{r}.
+
+@kindex C-x r +
+When register @var{r} contains text, you can use @kbd{C-x r +}
+(@code{increment-register}) to append to that register. Note that
+command @kbd{C-x r +} behaves differently if @var{r} contains a
+number. @xref{Number Registers}.
+
@item M-x prepend-to-register @key{RET} @var{r}
Prepend region to text in register @var{r}.
@end table
@@ -116,6 +123,19 @@ region after appending it to the register. The command
the region text to the text in the register instead of
@emph{appending} it.
+@vindex register-separator
+ When you are collecting text using @code{append-to-register} and
+@code{prepend-to-register}, you may want to separate individual
+collected pieces using a separator. In that case, configure a
+@code{register-separator} and store the separator text in to that
+register. For example, to get double newlines as text separator
+during the collection process, you can use the following setting.
+
+@example
+(setq register-separator ?+)
+(set-register register-separator "\n\n")
+@end example
+
@kindex C-x r i
@findex insert-register
@kbd{C-x r i @var{r}} inserts in the buffer the text from register
@@ -191,8 +211,10 @@ Store @var{number} into register @var{r} (@code{number-to-register}).
@item C-u @var{number} C-x r + @var{r}
@kindex C-x r +
@findex increment-register
-Increment the number in register @var{r} by @var{number}
-(@code{increment-register}).
+If @var{r} contains a number, increment the number in that register by
+@var{number}. Note that command @kbd{C-x r +}
+(@code{increment-register}) behaves differently if @var{r} contains
+text. @xref{Text Registers}.
@item C-x r i @var{r}
Insert the number from register @var{r} into the buffer.
@end table
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index 025185c583..1806339e45 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -149,6 +149,7 @@ Emacs.
* Screen Garbled:: Garbage on the screen.
* Text Garbled:: Garbage in the text.
* Memory Full:: How to cope when you run out of memory.
+* Crashing:: What Emacs does when it crashes.
* After a Crash:: Recovering editing in an Emacs session that crashed.
* Emergency Escape:: What to do if Emacs stops responding.
@end menu
@@ -277,6 +278,44 @@ editing in the same Emacs session.
out of memory, because the buffer menu needs a fair amount of memory
itself, and the reserve supply may not be enough.
+@node Crashing
+@subsection When Emacs Crashes
+
+ Emacs is not supposed to crash, but if it does, before it exits it
+reports some information about the crash to the standard error stream
+@code{stderr}. This report may be useful to someone who later debugs
+the same version of Emacs on the same platform. The format of this
+report depends on the platform, and some platforms support backtraces.
+Here is an example, generated on x86-64 GNU/Linux with version 2.15 of
+the GNU C Library:
+
+@example
+Fatal error 11: Segmentation fault
+Backtrace:
+emacs[0x5094e4]
+emacs[0x4ed3e6]
+emacs[0x4ed504]
+/lib64/libpthread.so.0[0x375220efe0]
+/lib64/libpthread.so.0(read+0xe)[0x375220e08e]
+emacs[0x509af6]
+emacs[0x5acc26]
+emacs[0x5adbfb]
+emacs[0x56566b]
+emacs[0x59bac3]
+emacs[0x565151]
+...
+@end example
+
+@noindent
+The number @samp{11} is the system signal number that corresponds to
+the problem, a segmentation fault here. The hexadecimal program
+addresses can be useful in debugging sessions. For example, the GDB
+command @samp{list *0x509af6} prints the source-code lines
+corresponding to the @samp{emacs[0x509af6]} entry in the backtrace.
+
+The three dots at the end indicate that Emacs suppressed further
+backtrace entries, in the interest of brevity.
+
@node After a Crash
@subsection Recovery After a Crash
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi
index 2496a50506..04d1353006 100644
--- a/doc/emacs/windows.texi
+++ b/doc/emacs/windows.texi
@@ -378,12 +378,10 @@ adding the desired buffer's name to the list
expression to the list @code{same-window-regexps}. By default, these
variables are @code{nil}, so this step is skipped.
-@vindex display-buffer-reuse-frames
@item
Otherwise, if the buffer is already displayed in an existing window,
``reuse'' that window. Normally, only windows on the selected frame
are considered, but windows on other frames are also reusable if you
-change @code{display-buffer-reuse-frames} to @code{t}, or if you
change @code{pop-up-frames} (see below) to @code{t}.
@item
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index b0156e5ac7..ce99c81a91 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,56 @@
+2012-09-11 Paul Eggert <[email protected]>
+
+ Simplify, document, and port floating-point (Bug#12381).
+ * numbers.texi (Float Basics, Arithmetic Operations, Math Functions):
+ Document that / and mod (with floating point arguments), along
+ with asin, acos, log, log10, expt and sqrt, return special values
+ instead of signaling exceptions.
+ (Float Basics): Document that logb operates on the absolute value
+ of its argument.
+ (Math Functions): Document that (log ARG BASE) also returns NaN if
+ BASE is negative. Document that (expt X Y) returns NaN if X is a
+ finite negative number and Y a finite non-integer.
+
+2012-09-09 Chong Yidong <[email protected]>
+
+ * lists.texi (Sets And Lists): Explain that the return value for
+ delete should be used, like for delq.
+
+ * minibuf.texi (Yes-or-No Queries): Document recentering and
+ scrolling in y-or-n-p. Remove gratuitous example.
+
+ * searching.texi (Search and Replace): Document window scrolling
+ entries in query-replace-map.
+
+2012-09-08 Chong Yidong <[email protected]>
+
+ * syntax.texi (Syntax Table Internals): Define "raw syntax
+ descriptor" terminology (Bug#12383).
+ (Syntax Descriptors): Mention raw syntax descriptors.
+
+2012-09-07 Chong Yidong <[email protected]>
+
+ * variables.texi (Creating Buffer-Local): Fix description of
+ local-variable-if-set-p (Bug#10713).
+
+ * eval.texi (Intro Eval): Add index entry for sexp (Bug#12233).
+
+ * windows.texi (Display Action Functions)
+ (Choosing Window Options): Remove obsolete variable
+ display-buffer-reuse-frames.
+ (Switching Buffers): Minor doc tweak for switch-to-buffer.
+
+ * positions.texi (Narrowing): Document buffer-narrowed-p.
+
+ * markers.texi (Moving Markers): Add xref to Point (Bug#7151).
+
+ * syntax.texi (Low-Level Parsing): Add xref to Parser State
+ (Bug#12269).
+
+2012-09-04 Lars Ingebrigtsen <[email protected]>
+
+ * debugging.texi (Explicit Debug): Document `debug-on-message'.
+
2012-09-02 Chong Yidong <[email protected]>
* windows.texi (Window Configurations): Recommend against using
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 7e24de94fb..dc0fa4c639 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -2738,17 +2738,6 @@ This function converts the string or vector @var{key} to a list of
individual events, which you can put in @code{unread-command-events}.
@end defun
-@ignore
-@defvar unread-command-char
-This variable holds a character to be read as command input.
-A value of -1 means ``empty''.
-
-This variable is mostly obsolete now that you can use
-@code{unread-command-events} instead; it exists only to support programs
-written for Emacs versions 18 and earlier.
-@end defvar
-@end ignore
-
@defun input-pending-p
@cindex waiting for command key input
This function determines whether any command input is currently
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 00e8d84e9b..5aeff576d0 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -298,6 +298,11 @@ of @code{(debug)} isn't ignored, it will alter the execution of the
program!) The most common suitable places are inside a @code{progn} or
an implicit @code{progn} (@pxref{Sequencing}).
+ If you don't know exactly where in the source code you want to put
+the debug statement, but you want to display a backtrace when a
+certain message is displayed, you can set @code{debug-on-message} to a
+regular expression matching the desired message.
+
@node Using Debugger
@subsection Using the Debugger
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi
index 6dc6287b80..b373ecfbe6 100644
--- a/doc/lispref/eval.texi
+++ b/doc/lispref/eval.texi
@@ -40,6 +40,7 @@ interpreter.
@cindex form
@cindex expression
@cindex S-expression
+@cindex sexp
A Lisp object that is intended for evaluation is called a @dfn{form}
or @dfn{expression}@footnote{It is sometimes also referred to as an
@dfn{S-expression} or @dfn{sexp}, but we generally do not use this
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 023f8ba18d..d685ce0aa7 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -1293,14 +1293,19 @@ compare @var{object} against the elements of the list. For example:
@defun delq object list
@cindex deleting list elements
This function destructively removes all elements @code{eq} to
-@var{object} from @var{list}. The letter @samp{q} in @code{delq} says
-that it uses @code{eq} to compare @var{object} against the elements of
-the list, like @code{memq} and @code{remq}.
+@var{object} from @var{list}, and returns the resulting list. The
+letter @samp{q} in @code{delq} says that it uses @code{eq} to compare
+@var{object} against the elements of the list, like @code{memq} and
+@code{remq}.
+
+Typically, when you invoke @code{delq}, you should use the return
+value by assigning it to the variable which held the original list.
+The reason for this is explained below.
@end defun
-When @code{delq} deletes elements from the front of the list, it does so
-simply by advancing down the list and returning a sublist that starts
-after those elements:
+The @code{delq} function deletes elements from the front of the list
+by simply advancing down the list, and returning a sublist that starts
+after those elements. For example:
@example
@group
@@ -1308,6 +1313,7 @@ after those elements:
@end group
@end example
+@noindent
When an element to be deleted appears in the middle of the list,
removing it involves changing the @sc{cdr}s (@pxref{Setcdr}).
@@ -1432,12 +1438,15 @@ Compare this with @code{memq}:
@end defun
@defun delete object sequence
-If @code{sequence} is a list, this function destructively removes all
-elements @code{equal} to @var{object} from @var{sequence}. For lists,
-@code{delete} is to @code{delq} as @code{member} is to @code{memq}: it
-uses @code{equal} to compare elements with @var{object}, like
-@code{member}; when it finds an element that matches, it cuts the
-element out just as @code{delq} would.
+This function removes all elements @code{equal} to @var{object} from
+@var{sequence}, and returns the resulting sequence.
+
+If @var{sequence} is a list, @code{delete} is to @code{delq} as
+@code{member} is to @code{memq}: it uses @code{equal} to compare
+elements with @var{object}, like @code{member}; when it finds an
+element that matches, it cuts the element out just as @code{delq}
+would. As with @code{delq}, you should typically use the return value
+by assigning it to the variable which held the original list.
If @code{sequence} is a vector or string, @code{delete} returns a copy
of @code{sequence} with all elements @code{equal} to @code{object}
diff --git a/doc/lispref/markers.texi b/doc/lispref/markers.texi
index 22e806defe..80136f2e6f 100644
--- a/doc/lispref/markers.texi
+++ b/doc/lispref/markers.texi
@@ -355,9 +355,9 @@ the current buffer.
If @var{position} is less than 1, @code{set-marker} moves @var{marker}
to the beginning of the buffer. If @var{position} is greater than the
-size of the buffer, @code{set-marker} moves marker to the end of the
-buffer. If @var{position} is @code{nil} or a marker that points
-nowhere, then @var{marker} is set to point nowhere.
+size of the buffer (@pxref{Point}), @code{set-marker} moves marker to
+the end of the buffer. If @var{position} is @code{nil} or a marker
+that points nowhere, then @var{marker} is set to point nowhere.
The value returned is @var{marker}.
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 4cf096b866..3d6e80bf3f 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1888,47 +1888,14 @@ Echo Area}), which uses the same screen space as the minibuffer. The
cursor moves to the echo area while the question is being asked.
The answers and their meanings, even @samp{y} and @samp{n}, are not
-hardwired. The keymap @code{query-replace-map} specifies them.
-@xref{Search and Replace}.
-
-In the following example, the user first types @kbd{q}, which is
-invalid. At the next prompt the user types @kbd{y}.
-
-@c Need an interactive example, because otherwise the return value
-@c obscures the display of the valid answer.
-@smallexample
-@group
-(defun ask ()
- (interactive)
- (y-or-n-p "Do you need a lift? "))
-
-;; @r{After evaluation of the preceding definition, @kbd{M-x ask}}
-;; @r{causes the following prompt to appear in the echo area:}
-@end group
-
-@group
----------- Echo area ----------
-Do you need a lift? (y or n)
----------- Echo area ----------
-@end group
-
-;; @r{If the user then types @kbd{q}, the following appears:}
-
-@group
----------- Echo area ----------
-Please answer y or n. Do you need a lift? (y or n)
----------- Echo area ----------
-@end group
-
-;; @r{When the user types a valid answer,}
-;; @r{it is displayed after the question:}
-
-@group
----------- Echo area ----------
-Do you need a lift? (y or n) y
----------- Echo area ----------
-@end group
-@end smallexample
+hardwired, and are specified by the keymap @code{query-replace-map}
+(@pxref{Search and Replace}). In particular, if the user enters the
+special responses @code{recenter}, @code{scroll-up},
+@code{scroll-down}, @code{scroll-other-window}, or
+@code{scroll-other-window-down} (respectively bound to @kbd{C-l},
+@kbd{C-v}, @kbd{M-v}, @kbd{C-M-v} and @kbd{C-M-S-v} in
+@code{query-replace-map}), this function performs the specified window
+recentering or scrolling operation, and poses the question again.
@noindent
We show successive lines of echo area messages, but only one actually
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index 17f3ee099b..7c9672a38c 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -196,6 +196,14 @@ numerical functions return such values in cases where there is no
correct answer. For example, @code{(/ 0.0 0.0)} returns a NaN. (NaN
values can also carry a sign, but for practical purposes there's no
significant difference between different NaN values in Emacs Lisp.)
+
+When a function is documented to return a NaN, it returns an
+implementation-defined value when Emacs is running on one of the
+now-rare platforms that do not use @acronym{IEEE} floating point. For
+example, @code{(log -1.0)} typically returns a NaN, but on
+non-@acronym{IEEE} platforms it returns an implementation-defined
+value.
+
Here are the read syntaxes for these special floating point values:
@table @asis
@@ -241,7 +249,7 @@ numbers.
@defun logb number
This function returns the binary exponent of @var{number}. More
-precisely, the value is the logarithm of @var{number} base 2, rounded
+precisely, the value is the logarithm of |@var{number}| base 2, rounded
down to an integer.
@example
@@ -694,7 +702,8 @@ arguments. It also permits floating point arguments; it rounds the
quotient downward (towards minus infinity) to an integer, and uses that
quotient to compute the remainder.
-An @code{arith-error} results if @var{divisor} is 0.
+If @var{divisor} is zero, @code{mod} signals an @code{arith-error}
+error if both arguments are integers, and returns a NaN otherwise.
@example
@group
@@ -1096,8 +1105,8 @@ pi/2
@tex
@math{\pi/2}
@end tex
-(inclusive) whose sine is @var{arg}; if, however, @var{arg} is out of
-range (outside [@minus{}1, 1]), it signals a @code{domain-error} error.
+(inclusive) whose sine is @var{arg}. If @var{arg} is out of range
+(outside [@minus{}1, 1]), @code{asin} returns a NaN.
@end defun
@defun acos arg
@@ -1108,8 +1117,8 @@ pi
@tex
@math{\pi}
@end tex
-(inclusive) whose cosine is @var{arg}; if, however, @var{arg} is out
-of range (outside [@minus{}1, 1]), it signals a @code{domain-error} error.
+(inclusive) whose cosine is @var{arg}. If @var{arg} is out of range
+(outside [@minus{}1, 1]), @code{acos} returns a NaN.
@end defun
@defun atan y &optional x
@@ -1141,8 +1150,8 @@ This is the exponential function; it returns @math{e} to the power
@defun log arg &optional base
This function returns the logarithm of @var{arg}, with base
@var{base}. If you don't specify @var{base}, the natural base
-@math{e} is used. If @var{arg} is negative, it signals a
-@code{domain-error} error.
+@math{e} is used. If @var{arg} or @var{base} is negative, @code{log}
+returns a NaN.
@end defun
@ignore
@@ -1160,21 +1169,21 @@ lose accuracy.
@end ignore
@defun log10 arg
-This function returns the logarithm of @var{arg}, with base 10. If
-@var{arg} is negative, it signals a @code{domain-error} error.
-@code{(log10 @var{x})} @equiv{} @code{(log @var{x} 10)}, at least
-approximately.
+This function returns the logarithm of @var{arg}, with base 10:
+@code{(log10 @var{x})} @equiv{} @code{(log @var{x} 10)}.
@end defun
@defun expt x y
This function returns @var{x} raised to power @var{y}. If both
arguments are integers and @var{y} is positive, the result is an
integer; in this case, overflow causes truncation, so watch out.
+If @var{x} is a finite negative number and @var{y} is a finite
+non-integer, @code{expt} returns a NaN.
@end defun
@defun sqrt arg
This returns the square root of @var{arg}. If @var{arg} is negative,
-it signals a @code{domain-error} error.
+@code{sqrt} returns a NaN.
@end defun
In addition, Emacs defines the following common mathematical
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index a0c6531985..c4576e6456 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -874,18 +874,18 @@ commands to a limited range of characters in a buffer. The text that
remains addressable is called the @dfn{accessible portion} of the
buffer.
- Narrowing is specified with two buffer positions which become the
-beginning and end of the accessible portion. For most editing commands
-and most Emacs primitives, these positions replace the values of the
-beginning and end of the buffer. While narrowing is in effect, no text
-outside the accessible portion is displayed, and point cannot move
-outside the accessible portion.
-
- Values such as positions or line numbers, which usually count from the
-beginning of the buffer, do so despite narrowing, but the functions
-which use them refuse to operate on text that is inaccessible.
-
- The commands for saving buffers are unaffected by narrowing; they save
+ Narrowing is specified with two buffer positions, which become the
+beginning and end of the accessible portion. For most editing
+commands and primitives, these positions replace the values of the
+beginning and end of the buffer. While narrowing is in effect, no
+text outside the accessible portion is displayed, and point cannot
+move outside the accessible portion. Note that narrowing does not
+alter actual buffer positions (@pxref{Point}); it only determines
+which positions are considered the accessible portion of the buffer.
+Most functions refuse to operate on text that is outside the
+accessible portion.
+
+ Commands for saving buffers are unaffected by narrowing; they save
the entire buffer regardless of any narrowing.
If you need to display in a single buffer several very different
@@ -924,6 +924,11 @@ It is equivalent to the following expression:
@end example
@end deffn
+@defun buffer-narrowed-p
+This function returns non-@code{nil} if the buffer is narrowed, and
+@code{nil} otherwise.
+@end defun
+
@defspec save-restriction body@dots{}
This special form saves the current bounds of the accessible portion,
evaluates the @var{body} forms, and finally restores the saved bounds,
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 0fa681ecb5..edd1d30e28 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1796,7 +1796,13 @@ Delete the text being considered, then enter a recursive edit to replace
it.
@item recenter
-Redisplay and center the window, then ask the same question again.
+@itemx scroll-up
+@itemx scroll-down
+@itemx scroll-other-window
+@itemx scroll-other-window-down
+Perform the specified window scroll operation, then ask the same
+question again. Only @code{y-or-n-p} and related functions use this
+answer.
@item quit
Perform a quit right away. Only @code{y-or-n-p} and related functions
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi
index ab68529090..624b5a92d6 100644
--- a/doc/lispref/syntax.texi
+++ b/doc/lispref/syntax.texi
@@ -130,6 +130,10 @@ comment-ender), and the entry for @samp{/} is @samp{@w{. 14}} (i.e.,
punctuation, matching character slot unused, first character of a
comment-starter, second character of a comment-ender).
+ Emacs also defines @dfn{raw syntax descriptors}, which are used to
+describe syntax classes at a lower level. @xref{Syntax Table
+Internals}.
+
@menu
* Syntax Class Table:: Table of syntax classes.
* Syntax Flags:: Additional flags each character can have.
@@ -531,8 +535,9 @@ the current buffer's syntax table to determine the syntax for the
underlying text character.
@item @code{(@var{syntax-code} . @var{matching-char})}
-A cons cell of this format specifies the syntax for the underlying
-text character. (@pxref{Syntax Table Internals})
+A cons cell of this format is a raw syntax descriptor (@pxref{Syntax
+Table Internals}), which directly specifies a syntax class for the
+underlying text character.
@item @code{nil}
If the property is @code{nil}, the character's syntax is determined from
@@ -878,6 +883,9 @@ This function parses a sexp in the current buffer starting at
@var{start}, not scanning past @var{limit}. It stops at position
@var{limit} or when certain criteria described below are met, and sets
point to the location where parsing stops. It returns a parser state
+@ifinfo
+(@pxref{Parser State})
+@end ifinfo
describing the status of the parse at the point where it stops.
@cindex parenthesis depth
@@ -937,16 +945,20 @@ documented in this section. This internal format can also be assigned
as syntax properties (@pxref{Syntax Properties}).
@cindex syntax code
- Each entry in a syntax table is a cons cell of the form
-@code{(@var{syntax-code} . @var{matching-char})}. @var{syntax-code}
-is an integer that encodes the syntax class and syntax flags,
-according to the table below. @var{matching-char}, if non-@code{nil},
-specifies a matching character (similar to the second character in a
-syntax descriptor).
+@cindex raw syntax descriptor
+ Each entry in a syntax table is a @dfn{raw syntax descriptor}: a
+cons cell of the form @code{(@var{syntax-code}
+. @var{matching-char})}. @var{syntax-code} is an integer which
+encodes the syntax class and syntax flags, according to the table
+below. @var{matching-char}, if non-@code{nil}, specifies a matching
+character (similar to the second character in a syntax descriptor).
+
+ Here are the syntax codes corresponding to the various syntax
+classes:
@multitable @columnfractions .2 .3 .2 .3
@item
-@i{Syntax code} @tab @i{Class} @tab @i{Syntax code} @tab @i{Class}
+@i{Code} @tab @i{Class} @tab @i{Code} @tab @i{Class}
@item
0 @tab whitespace @tab 8 @tab paired delimiter
@item
@@ -967,7 +979,7 @@ syntax descriptor).
@noindent
For example, in the standard syntax table, the entry for @samp{(} is
-@code{(4 . 41)}. (41 is the character code for @samp{)}.)
+@code{(4 . 41)}. 41 is the character code for @samp{)}.
Syntax flags are encoded in higher order bits, starting 16 bits from
the least significant bit. This table gives the power of two which
@@ -987,33 +999,35 @@ corresponds to each syntax flag.
@end multitable
@defun string-to-syntax @var{desc}
-Given a syntax descriptor @var{desc}, this function returns the
-corresponding internal form, a cons cell @code{(@var{syntax-code}
-. @var{matching-char})}.
+Given a syntax descriptor @var{desc} (a string), this function returns
+the corresponding raw syntax descriptor.
@end defun
@defun syntax-after pos
-This function returns the syntax code of the character in the buffer
-after position @var{pos}, taking account of syntax properties as well
-as the syntax table. If @var{pos} is outside the buffer's accessible
-portion (@pxref{Narrowing, accessible portion}), this function returns
-@code{nil}.
+This function returns the raw syntax descriptor for the character in
+the buffer after position @var{pos}, taking account of syntax
+properties as well as the syntax table. If @var{pos} is outside the
+buffer's accessible portion (@pxref{Narrowing, accessible portion}),
+the return value is @code{nil}.
@end defun
@defun syntax-class syntax
-This function returns the syntax class of the syntax code
-@var{syntax}. (It masks off the high 16 bits that hold the flags
-encoded in the syntax descriptor.) If @var{syntax} is @code{nil}, it
-returns @code{nil}; this is so evaluating the expression
+This function returns the syntax code for the raw syntax descriptor
+@var{syntax}. More precisely, it takes the raw syntax descriptor's
+@var{syntax-code} component, masks off the high 16 bits which record
+the syntax flags, and returns the resulting integer.
+
+If @var{syntax} is @code{nil}, the return value is returns @code{nil}.
+This is so that the expression
@example
(syntax-class (syntax-after pos))
@end example
@noindent
-where @code{pos} is outside the buffer's accessible portion, will
-yield @code{nil} without throwing errors or producing wrong syntax
-class codes.
+evaluates to @code{nil} if @code{pos} is outside the buffer's
+accessible portion, without throwing errors or returning an incorrect
+code.
@end defun
@node Categories
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index 3b078e7e19..c5b66757ac 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -1302,9 +1302,10 @@ This returns @code{t} if @var{variable} is buffer-local in buffer
@end defun
@defun local-variable-if-set-p variable &optional buffer
-This returns @code{t} if @var{variable} will become buffer-local in
-buffer @var{buffer} (which defaults to the current buffer) if it is
-set there.
+This returns @code{t} if @var{variable} either has a buffer-local
+value in buffer @var{buffer}, or is automatically buffer-local.
+Otherwise, it returns @code{nil}. If omitted or @code{nil},
+@var{buffer} defaults to the current buffer.
@end defun
@defun buffer-local-value variable buffer
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 5fe007ba02..ea48a46359 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -1492,12 +1492,10 @@ to make a buffer current to modify it in Lisp, use
@code{set-buffer}. @xref{Current Buffer}.
@deffn Command switch-to-buffer buffer-or-name &optional norecord force-same-window
-This function displays @var{buffer-or-name} in the selected window,
-and makes it the current buffer. (In contrast, @code{set-buffer}
-makes the buffer current but does not display it; @pxref{Current
-Buffer}). It is often used interactively (as the binding of @kbd{C-x
-b}), as well as in Lisp programs. The return value is the buffer
-switched to.
+This command attempts to display @var{buffer-or-name} in the selected
+window, and makes it the current buffer. It is often used
+interactively (as the binding of @kbd{C-x b}), as well as in Lisp
+programs. The return value is the buffer switched to.
If @var{buffer-or-name} is @code{nil}, it defaults to the buffer
returned by @code{other-buffer} (@pxref{The Buffer List}). If
@@ -1506,17 +1504,18 @@ buffer, this function creates a new buffer with that name; the new
buffer's major mode is determined by the variable @code{major-mode}
(@pxref{Major Modes}).
-Normally the specified buffer is put at the front of the buffer
+Normally, the specified buffer is put at the front of the buffer
list---both the global buffer list and the selected frame's buffer
list (@pxref{The Buffer List}). However, this is not done if the
optional argument @var{norecord} is non-@code{nil}.
-If this function is unable to display the buffer in the selected
-window---usually because the selected window is a minibuffer window or
-is strongly dedicated to its buffer (@pxref{Dedicated Windows})---then
-it normally tries to display the buffer in some other window, in the
-manner of @code{pop-to-buffer} (see below). However, if the optional
-argument @var{force-same-window} is non-@code{nil}, it signals an error
+Sometimes, @code{switch-to-buffer} may be unable to display the buffer
+in the selected window. This happens if the selected window is a
+minibuffer window, or if the selected window is strongly dedicated to
+its buffer (@pxref{Dedicated Windows}). In that case, the command
+normally tries to display the buffer in some other window, by invoking
+@code{pop-to-buffer} (see below). However, if the optional argument
+@var{force-same-window} is non-@code{nil}, it signals an error
instead.
@end deffn
@@ -1728,8 +1727,7 @@ A frame means consider windows on that frame only.
@end itemize
If @var{alist} contains no @code{reusable-frames} entry, this function
-normally searches just the selected frame; however, if either the
-variable @code{display-buffer-reuse-frames} or the variable
+normally searches just the selected frame; however, if the variable
@code{pop-up-frames} is non-@code{nil}, it searches all frames on the
current terminal. @xref{Choosing Window Options}.
@@ -1769,14 +1767,6 @@ The behavior of the standard display actions of @code{display-buffer}
(@pxref{Choosing Window}) can be modified by a variety of user
options.
-@defopt display-buffer-reuse-frames
-If the value of this variable is non-@code{nil}, @code{display-buffer}
-may search all frames on the current terminal when looking for a
-window already displaying the specified buffer. The default is
-@code{nil}. This variable is consulted by the action function
-@code{display-buffer-reuse-window} (@pxref{Display Action Functions}).
-@end defopt
-
@defopt pop-up-windows
If the value of this variable is non-@code{nil}, @code{display-buffer}
is allowed to split an existing window to make a new window for
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 20c74cf70b..8ecaf97a84 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,19 @@
+2012-09-13 Paul Eggert <[email protected]>
+
+ * texinfo.tex: Merge from gnulib.
+
+2012-09-12 Michael Albinus <[email protected]>
+
+ Sync with Tramp 2.2.6.
+
+ * tramp.texi (Bug Reports): Cleanup caches before a test run.
+
+ * trampver.texi: Update release number.
+
+2012-09-12 Paul Eggert <[email protected]>
+
+ * texinfo.tex: Merge from gnulib.
+
2012-08-06 AurĂ©lien Aptel <[email protected]>
* url.texi (Parsed URLs): Adjust to the code's use of defstruct
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index dc4bf6400c..f3093d0853 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2012-07-29.17}
+\def\texinfoversion{2012-09-12.16}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -594,7 +594,7 @@
\def\:{\spacefactor=1000 }
% @* forces a line break.
-\def\*{\hfil\break\hbox{}\ignorespaces}
+\def\*{\unskip\hfil\break\hbox{}\ignorespaces}
% @/ allows a line break.
\let\/=\allowbreak
@@ -2272,8 +2272,6 @@ end
\gdef\markupsetcodequoteleft{\let`\codequoteleft}
\gdef\markupsetcodequoteright{\let'\codequoteright}
-
-\gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft}
}
\let\markupsetuplqcode \markupsetcodequoteleft
@@ -2282,6 +2280,9 @@ end
\let\markupsetuplqexample \markupsetcodequoteleft
\let\markupsetuprqexample \markupsetcodequoteright
%
+\let\markupsetuplqkbd \markupsetcodequoteleft
+\let\markupsetuprqkbd \markupsetcodequoteright
+%
\let\markupsetuplqsamp \markupsetcodequoteleft
\let\markupsetuprqsamp \markupsetcodequoteright
%
@@ -2291,8 +2292,6 @@ end
\let\markupsetuplqverbatim \markupsetcodequoteleft
\let\markupsetuprqverbatim \markupsetcodequoteright
-\let\markupsetuplqkbd \markupsetnoligaturesquoteleft
-
% Allow an option to not use regular directed right quote/apostrophe
% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
% The undirected quote is ugly, so don't make it the default, but it
@@ -2382,8 +2381,7 @@ end
\aftersmartic
}
-% like \smartslanted except unconditionally uses \ttsl, and no ic.
-% @var is set to this for defun arguments.
+% Unconditional use \ttsl, and no ic. @var is set to this for defuns.
\def\ttslanted#1{{\ttsl #1}}
% @cite is like \smartslanted except unconditionally use \sl. We never want
@@ -2695,10 +2693,6 @@ end
\let\email=\uref
\fi
-% @kbd is like @code, except that if the argument is just one @key command,
-% then @kbd has no effect.
-\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
-
% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
% `example' (@kbd uses ttsl only inside of @example and friends),
% or `code' (@kbd uses normal tty font always).
@@ -2722,11 +2716,17 @@ end
% Default is `distinct'.
\kbdinputstyle distinct
+% @kbd is like @code, except that if the argument is just one @key command,
+% then @kbd has no effect.
+\def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
+
\def\xkey{\key}
-\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
-\ifx\one\xkey\ifx\threex\three \key{#2}%
-\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
-\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
+\def\kbdsub#1#2#3\par{%
+ \def\one{#1}\def\three{#3}\def\threex{??}%
+ \ifx\one\xkey\ifx\threex\three \key{#2}%
+ \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
+ \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
+}
% definition of @key that produces a lozenge. Doesn't adjust to text size.
%\setfont\keyrm\rmshape{8}{1000}{OT1}
@@ -3269,6 +3269,20 @@ end
\finishedtitlepagetrue
}
+% Settings used for typesetting titles: no hyphenation, no indentation,
+% don't worry much about spacing, ragged right. This should be used
+% inside a \vbox, and fonts need to be set appropriately first. Because
+% it is always used for titles, nothing else, we call \rmisbold. \par
+% should be specified before the end of the \vbox, since a vbox is a group.
+%
+\def\raggedtitlesettings{%
+ \rmisbold
+ \hyphenpenalty=10000
+ \parindent=0pt
+ \tolerance=5000
+ \ptexraggedright
+}
+
% Macros to be used within @titlepage:
\let\subtitlerm=\tenrm
@@ -3276,7 +3290,7 @@ end
\parseargdef\title{%
\checkenv\titlepage
- \leftline{\titlefonts\rmisbold #1}
+ \vbox{\titlefonts \raggedtitlesettings #1\par}%
% print a rule at the page bottom also.
\finishedtitlepagefalse
\vskip4pt \hrule height 4pt width \hsize \vskip4pt
@@ -4243,7 +4257,7 @@ end
}
\def\ifcmddefinedfail{\doignore{ifcommanddefined}}
-% @ifcommandnotdefined CMD ... handlded similar to @ifclear above.
+% @ifcommandnotdefined CMD ... handled similar to @ifclear above.
\makecond{ifcommandnotdefined}
\def\ifcommandnotdefined{%
\parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
@@ -5579,14 +5593,6 @@ end
% Define @majorheading, @heading and @subheading
-% NOTE on use of \vbox for chapter headings, section headings, and such:
-% 1) We use \vbox rather than the earlier \line to permit
-% overlong headings to fold.
-% 2) \hyphenpenalty is set to 10000 because hyphenation in a
-% heading is obnoxious; this forbids it.
-% 3) Likewise, headings look best if no \parindent is used, and
-% if justification is not attempted. Hence \raggedright.
-
\def\majorheading{%
{\advance\chapheadingskip by 10pt \chapbreak }%
\parsearg\chapheadingzzz
@@ -5594,10 +5600,8 @@ end
\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
\def\chapheadingzzz#1{%
- {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt\ptexraggedright
- \rmisbold #1\hfill}}%
- \bigskip \par\penalty 200\relax
+ \vbox{\chapfonts \raggedtitlesettings #1\par}%
+ \nobreak\bigskip \nobreak
\suppressfirstparagraphindent
}
@@ -5756,8 +5760,7 @@ end
%
% Typeset the actual heading.
\nobreak % Avoid page breaks at the interline glue.
- \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
- \hangindent=\wd0 \centerparametersmaybe
+ \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
\unhbox0 #1\par}%
}%
\nobreak\bigskip % no page break after a chapter title
@@ -5779,18 +5782,18 @@ end
\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
%
\def\unnchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt\ptexraggedright
- \rmisbold #1\hfill}}\bigskip \par\nobreak
+ \chapoddpage
+ \vbox{\chapfonts \raggedtitlesettings #1\par}%
+ \nobreak\bigskip\nobreak
}
\def\chfopen #1#2{\chapoddpage {\chapfonts
\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
\par\penalty 5000 %
}
\def\centerchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt
- \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak
+ \chapoddpage
+ \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}%
+ \nobreak\bigskip \nobreak
}
\def\CHAPFopen{%
\global\let\chapmacro=\chfopen
@@ -7069,7 +7072,10 @@ end
\df \sl \hyphenchar\font=0
%
% On the other hand, if an argument has two dashes (for instance), we
- % want a way to get ttsl. Let's try @var for that.
+ % want a way to get ttsl. We used to recommend @var for that, so
+ % leave the code in, but it's strange for @var to lead to typewriter.
+ % Nowadays we recommend @code, since the difference between a ttsl hyphen
+ % and a tt hyphen is pretty tiny. @code also disables ?` !`.
\def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
#1%
\sl\hyphenchar\font=45
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 87ad2bc500..530b8fdd6c 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -2853,6 +2853,9 @@ If you can identify a minimal test case that reproduces the problem,
include that with your bug report. This will make it much easier for
the development team to analyze and correct the problem.
+Sometimes, there might be also problems due to Tramp caches. Flush
+all caches before running the test, @ref{Cleanup remote connections}.
+
Before reporting the bug, you should set the verbosity level to 6
(@pxref{Traces and Profiles, Traces}) in the @file{~/.emacs} file and
repeat the bug. Then, include the contents of the @file{*tramp/foo*}
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi
index 78bd9d0965..d902ac0fb9 100644
--- a/doc/misc/trampver.texi
+++ b/doc/misc/trampver.texi
@@ -8,7 +8,7 @@
@c In the Tramp CVS, the version number is auto-frobbed from
@c configure.ac, so you should edit that file and run
@c "autoconf && ./configure" to change the version number.
-@set trampver 2.2.6-pre
+@set trampver 2.2.6
@c Other flags from configuration
@set instprefix /usr/local
diff --git a/etc/ChangeLog b/etc/ChangeLog
index f3f244c7e3..6f2b178fcd 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,52 @@
+2012-09-17 Glenn Morris <[email protected]>
+
+ * refcards/emacsver.tex: New file.
+ * refcards/calccard.tex, refcards/cs-dired-ref.tex:
+ * refcards/cs-refcard.tex, refcards/cs-survival.tex:
+ * refcards/de-refcard.tex, refcards/dired-ref.tex:
+ * refcards/emacsver.tex, refcards/fr-dired-ref.tex:
+ * refcards/fr-refcard.tex, refcards/fr-survival.tex:
+ * refcards/orgcard.tex, refcards/pl-refcard.tex:
+ * refcards/pt-br-refcard.tex, refcards/refcard.tex:
+ * refcards/sk-dired-ref.tex, refcards/sk-refcard.tex:
+ * refcards/sk-survival.tex, refcards/survival.tex:
+ * refcards/vipcard.tex, refcards/viperCard.tex: Include emacsver.tex.
+ * refcards/calccard.tex (\emacsversionnumber):
+ Rename to \versionemacs, same as all the other refcards.
+ * refcards/Makefile (ENVADD): New variable.
+ (sk-dired-ref.pdf, sk-survival.pdf, pl-refcard.pdf)
+ (%.pdf, %,dvi, sk-dired-ref.dvi, sk-survival.dvi, pl-refcard.dvi):
+ Depend on emacsver.tex. Add "." to TEXINPUTS for TeX commands.
+
+2012-09-16 Paul Eggert <[email protected]>
+
+ Remove configure's --without-sync-input option (Bug#12450).
+ * TODO (Make SYNC_INPUT the default): Remove, as the code now
+ behaves as if SYNC_INPUT is always true.
+
+2012-09-13 Paul Eggert <[email protected]>
+
+ Use a more backwards-compatible timer format (Bug#12430).
+ * NEWS: Document it, plus fix a typo.
+
+2012-09-13 Jan Djärv <[email protected]>
+
+ * NEWS (--with-x-toolkit): Mention that Gtk+ 3 is now default.
+
+2012-09-13 Paul Eggert <[email protected]>
+
+ * NEWS: Document timer format change (Bug#12430).
+
+2012-09-11 Paul Eggert <[email protected]>
+
+ Simplify, document, and port floating-point (Bug#12381).
+ * NEWS: Document NaNs versus signaling-error change.
+
+2012-09-04 Paul Eggert <[email protected]>
+
+ Give more-useful info on a fatal error (Bug#12328).
+ * NEWS: Document the change.
+
2012-09-01 Paul Eggert <[email protected]>
Better seeds for (random).
diff --git a/etc/NEWS b/etc/NEWS
index 45966e5388..3344158b73 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -65,6 +65,14 @@ renamed to '--enable-check-lisp-object-type', as the resulting
Lisp_Object type no longer uses a union to implement the compile time
check that this option enables.
+---
+** The default toolkit has been changed to Gtk+ version 3.
+If you don't pass --with-x-toolkit to configure or if you pass
+--with-x-toolkit=gtk or --with-x-toolkit=yes, configure will try to build
+with Gtk+ version 3, and if that fails, try Gtk+ version 2.
+You can explicitly require a specific version by passing
+--with-x-toolkit=gtk2 or --with-x-toolkit=gtk3 to configure.
+
* Startup Changes in Emacs 24.3
@@ -78,6 +86,10 @@ been adding them there, put them somewhere else, eg site-lisp.
* Changes in Emacs 24.3
+** You can now scroll the selected window in most y-or-n prompts.
+Typing C-v or M-v at a prompt scrolls forward or backward
+respectively, without leaving the y-or-n prompt.
+
** Help changes
*** `C-h f' (describe-function) can now perform autoloading.
@@ -97,6 +109,16 @@ machines. Other functions that use this format, such as
file-attributes and format-time-string, have been changed accordingly.
Old-format time stamps are still accepted.
+** The format of timers in timer-list and timer-idle-list is now
+[TRIGGERED-P HI-SECS LO-SECS USECS REPEAT-DELAY FUNCTION ARGS IDLE-DELAY PSECS].
+The PSECS slot is new, and uses picosecond resolution. It can be
+accessed via the new timer--psecs accessor.
+
+** Emacs now generates backtraces on fatal errors.
+On encountering a fatal error, Emacs now outputs a textual description
+of the fatal signal, and a short backtrace on platforms like glibc
+that support backtraces.
+
** New functions `system-users', `system-groups' return lists of the user
name, group names known to the system (where possible).
@@ -177,6 +199,14 @@ just removing them, as done by `yank-excluded-properties'.
delete-trailing-whitespace command should delete trailing lines at the
end of the buffer. It defaults to t.
++++
+** `C-x r +' is now overloaded to invoke `append-to-register.
+
++++
+** New option `register-separator' specifies the register containing
+the text to put between collected texts for use with M-x
+append-to-register and M-x prepend-to-register.
+
** Search changes
*** Global `M-s _' starts a symbol (identifier) incremental search,
@@ -192,6 +222,13 @@ of one or more whitespace characters defined by the variable
`isearch-lax-whitespace'. In regexp incremental search, it toggles
the value of the variable `isearch-regexp-lax-whitespace'.
+** query-replace changes
+
+*** When new option `replace-lax-whitespace' is non-nil,
+and you enter a space or spaces in the strings or regexps
+to be replaced, `query-replace' will match any sequence matched
+by the regexp `search-whitespace-regexp'.
+
** M-x move-to-column, if called interactively with no prefix arg, now
prompts for a column number.
@@ -320,6 +357,14 @@ python-describe-symbol | python-eldoc-at-point
*** Accepts \r and \f as whitespace.
+** SQL Mode
+
+*** DB2 added `sql-db2-escape-newlines'
+
+If non-nil, newlines sent to the command interpreter will be escaped
+by a backslash. The default does not escape the newlines and assumes
+that the sql statement will be terminated by a semicolon.
+
** Diff mode
Faces for changes now use the same diff color scheme as in modern VCSes
@@ -331,6 +376,9 @@ The variable `diff-use-changed-face' defines whether to use
the face `diff-changed', or `diff-removed' and `diff-added'
to highlight changes in context diffs.
+*** The new command `diff-remove-trailing-whitespace' fixes trailing
+whitespace problems introduced by the diff.
+
** Ediff now uses the same color scheme as Diff mode
on high color displays.
@@ -411,6 +459,13 @@ channel keys found, if any.
if the command ends in `;' (when operating on multiple files).
Otherwise, it executes the command on each file in parallel.
+*** The minibuffer default for `=' (`dired-diff) has changed.
+It is now the backup file for the file at point, if one exists, rather
+than the file at the mark.
+
+*** `M-=' is no longer bound to `dired-backup-diff' in Dired buffers.
+The global binding for `M-=', `count-words-region' is in effect.
+
** Shell
*** New option `async-shell-command-buffer' specifies what buffer to use
@@ -596,11 +651,18 @@ are deprecated and will be removed eventually.
*** `facemenu-unlisted-faces'
*** `rmail-decode-mime-charset'
-*** `last-input-char' and `last-command-char'
+*** `last-input-char', `last-command-char', `unread-command-char'.
* Lisp changes in Emacs 24.3
+** Interpreted files get eagerly macro-expanded during load.
+This can significantly speed up execution of non-byte-compiled code, but can
+also bump into harmless and previously unnoticed cyclic dependencies.
+These should not be fatal: they will simply cause the macro-calls to be left
+for later expansion (as before), but will also result in a warning describing
+the cycle.
+
** New minor mode `read-only-mode' to replace toggle-read-only (now obsolete).
** New functions `autoloadp' and `autoload-do-load'.
@@ -626,26 +688,54 @@ The interpretation of the DECLS is determined by `defun-declarations-alist'.
** New error type and new function `user-error'. Doesn't trigger the debugger.
+** Debugger
+*** New option `debugger-bury-or-kill'.
+
+*** Set `debug-on-message' to enter the debugger when a certain
+message is displayed in the echo area. This can be useful when trying
+to work out which code is doing something.
+
+*** New var `inhibit-debugger', automatically set to prevent accidental
+recursive invocations.
+
++++
+** New utility function `buffer-narrowed-p'.
+
** Window changes
*** The functions get-lru-window, get-mru-window and get-largest-window
now accept a third argument to avoid choosing the selected window.
-*** New display action alist `inhibit-switch-frame', if non-nil, tells
-display action functions to avoid changing which frame is selected.
+*** New macro `with-temp-buffer-window'.
+
+*** New option `temp-buffer-resize-frames'.
+
+*** New function `fit-frame-to-buffer' and new option
+ `fit-frame-to-buffer-bottom-margin'.
-*** New display action alist `pop-up-frame-parameters', if non-nil,
-specifies frame parameters to give any newly-created frame.
+*** New display action functions `display-buffer-below-selected' and
+`display-buffer-in-previous-window'.
+
+*** New display action alist entry `inhibit-switch-frame', if non-nil,
+tells display action functions to avoid changing which frame is
+selected.
+
+*** New display action alist entry `pop-up-frame-parameters', if
+non-nil, specifies frame parameters to give any newly-created frame.
+
+*** New display action alist entry `previous-window', if non-nil,
+specifies window to reuse in `display-buffer-in-previous-window'.
*** The following variables are obsolete, as they can be replaced by
appropriate entries in the `display-buffer-alist' function introduced
in Emacs 24.1:
-
++++
**** `display-buffer-reuse-frames'
**** `special-display-regexps'
**** `special-display-frame-alist'
**** `special-display-buffer-names'
**** `special-display-function'
+**** `display-buffer-function'
** Completion
@@ -661,12 +751,21 @@ table, but with a different prefix.
must be in the range 1000..9999. It now works with any year supported
by the underlying C implementation.
+** Floating point
+
+*** When floating point functions such as `log' are given invalid
+arguments, e.g., (log -1.0), they now uniformly return special values
+such as NaNs instead of signaling errors. Previously, these functions
+returned NaNs on some platforms but signaled errors on others. The affected
+functions are acos, asin, tan, exp, expt, log, log10, sqrt, and mod.
+
** New function file-name-base.
** New function `tty-top-frame' returns the topmost frame of a text terminal.
** `automount-dir-prefix' is obsolete.
** `buffer-has-markers-at' is obsolete.
+** `window-system-version' is obsolete.
* Changes in Emacs 24.3 on non-free operating systems
@@ -1399,6 +1498,10 @@ If you had that set, you need to put
in your ~/.authinfo file instead.
+*** SMTPmail defaults to using the address in the From: header as the
+SMTP MAIL FROM envelope. To override this, set `mail-envelope-from'
+to the address you wish to use instead.
+
** SQL mode
*** New options `sql-port', `sql-connection-alist', `sql-send-terminator',
diff --git a/etc/TODO b/etc/TODO
index 50e3bd64b9..be0ef95aed 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -1229,13 +1229,6 @@ systems for HTML/XML files automatically."
For use by sml-mode, python-mode, tex-mode, scheme-mode, lisp-mode,
haskell-mode, tuareg-mode, ...
-** Make SYNC_INPUT the default. [true since 2008-03-11]
- All loops using immediate_quit need to be checked to ensure that
- C-g can interrupt them, in case of an infinite loop. Once we
- switch to using SYNC_INPUT, we can remove the BLOCK_INPUTs in the
- allocation functions (allocate_string etc.) without worrying about
- data munging.
-
** Add "link" button class
Add a standard button-class named "link", and make all other link-like
button classes inherit from it. Set the default face of the "link" button
diff --git a/etc/refcards/Makefile b/etc/refcards/Makefile
index 64e2d8638f..ef810da602 100644
--- a/etc/refcards/Makefile
+++ b/etc/refcards/Makefile
@@ -47,26 +47,27 @@ VIPER_CARDS_PDF = vipcard.pdf viperCard.pdf
viper-cards_pdf: ${VIPER_CARDS_PDF}
viper-cards_ps: ${VIPER_CARDS_PDF:.pdf=.ps}
+ENVADD = TEXINPUTS=".:"
## PDF files.
## The page layouts (a4/letter) are written directly in the .tex files.
cs-refcard.pdf cs-dired-ref.pdf cs-survival.pdf sk-refcard.pdf \
-sk-dired-ref.pdf sk-survival.pdf: %.pdf: %.tex
+sk-dired-ref.pdf sk-survival.pdf: %.pdf: %.tex emacsver.tex
if pdfcsplain --version > /dev/null 2> /dev/null; then \
- pdfcsplain $<; \
+ ${ENVADD} pdfcsplain $<; \
else \
- csplain "\pdfoutput=1\input $<"; \
+ ${ENVADD} csplain "\pdfoutput=1\input $<"; \
fi
## Some versions of pdfmex seem to create dvi by default, hence output-format.
-pl-refcard.pdf: %.pdf: %.tex
+pl-refcard.pdf: %.pdf: %.tex emacsver.tex
if ! kpsewhich -format=fmt mex > /dev/null && \
! pdfmex --version > /dev/null 2> /dev/null; then \
echo "No mex format found."; false; \
fi
- pdftex -output-format=pdf $<
+ ${ENVADD} pdftex -output-format=pdf $<
ru-refcard.pdf: %.pdf: %.tex
pdflatex $<
@@ -81,21 +82,21 @@ gnus-booklet.pdf: gnus-refcard.tex gnus-logo.pdf
pdflatex -jobname=gnus-booklet '\def\booklettrue{}\def\letterpapertrue{}\input{gnus-refcard}'
## Everything not explicitly listed above.
-%.pdf: %.tex
- pdftex $<
+%.pdf: %.tex emacsver.tex
+ ${ENVADD} pdftex $<
## dvi files.
cs-refcard.dvi cs-dired-ref.dvi cs-survival.dvi sk-refcard.dvi \
-sk-dired-ref.dvi sk-survival.dvi: %.dvi: %.tex
- csplain $<
+sk-dired-ref.dvi sk-survival.dvi: %.dvi: %.tex emacsver.tex
+ ${ENVADD} csplain $<
-pl-refcard.dvi: %.dvi: %.tex
+pl-refcard.dvi: %.dvi: %.tex emacsver.tex
if ! kpsewhich -format=fmt mex > /dev/null; then \
echo "No mex format found."; false; \
fi
- tex $<
+ ${ENVADD} tex $<
ru-refcard.dvi gnus-refcard.dvi: %.dvi: %.tex
latex $<
@@ -105,8 +106,8 @@ gnus-booklet.dvi: gnus-refcard.tex
mv gnus-refcard.dvi $@
## Everything not explicitly listed above.
-%.dvi: %.tex
- tex $<
+%.dvi: %.tex emacsver.tex
+ ${ENVADD} tex $<
## PostScript files.
diff --git a/etc/refcards/calccard.tex b/etc/refcards/calccard.tex
index fd3d45b8da..04c88befee 100644
--- a/etc/refcards/calccard.tex
+++ b/etc/refcards/calccard.tex
@@ -63,8 +63,7 @@
% UUCP: mit-erl!gildea
% Internet: [email protected]
-\def\emacsversionnumber{24}
-\def\year{2012} % latest copyright year
+\input emacsver.tex
\def\shortcopyrightnotice{\vskip 1ex plus 2 fill
\centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
@@ -276,7 +275,7 @@ are preserved on all copies.
\title{GNU Calc Reference Card}
-\centerline{(for GNU Emacs version \emacsversionnumber)}
+\centerline{(for GNU Emacs version \versionemacs)}
\section{Starting and Stopping}
diff --git a/etc/refcards/cs-dired-ref.tex b/etc/refcards/cs-dired-ref.tex
index ee7acaf416..45867e11d4 100644
--- a/etc/refcards/cs-dired-ref.tex
+++ b/etc/refcards/cs-dired-ref.tex
@@ -41,8 +41,7 @@
\input pdflayout.sty
\pdflayout=(0)
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
% Nothing else needs to be changed.
diff --git a/etc/refcards/cs-refcard.tex b/etc/refcards/cs-refcard.tex
index d17e5c6dde..98842dd08e 100644
--- a/etc/refcards/cs-refcard.tex
+++ b/etc/refcards/cs-refcard.tex
@@ -59,8 +59,7 @@
\input pdflayout.sty
\pdflayout=(0)
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
% Nothing else needs to be changed.
diff --git a/etc/refcards/cs-survival.tex b/etc/refcards/cs-survival.tex
index 5aa111c029..4050cf0a1a 100644
--- a/etc/refcards/cs-survival.tex
+++ b/etc/refcards/cs-survival.tex
@@ -54,8 +54,7 @@
% Czech hyphenation rules applied
\chyph
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
\def\copyrightnotice{\penalty-1\vfill
\vbox{\smallfont\baselineskip=0.8\baselineskip\raggedcenter
diff --git a/etc/refcards/de-refcard.tex b/etc/refcards/de-refcard.tex
index ca3141b839..906895b358 100644
--- a/etc/refcards/de-refcard.tex
+++ b/etc/refcards/de-refcard.tex
@@ -60,8 +60,7 @@
\input german.sty
\mdqoff % deactivates the "-char
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
% Nothing else needs to be changed below this line.
diff --git a/etc/refcards/dired-ref.tex b/etc/refcards/dired-ref.tex
index 9ccf57682f..b85bef1ce0 100644
--- a/etc/refcards/dired-ref.tex
+++ b/etc/refcards/dired-ref.tex
@@ -43,8 +43,7 @@
\input pdflayout.sty
\pdflayout=(1)
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
% Nothing else needs to be changed.
diff --git a/etc/refcards/emacsver.tex b/etc/refcards/emacsver.tex
new file mode 100644
index 0000000000..620ee8ef9e
--- /dev/null
+++ b/etc/refcards/emacsver.tex
@@ -0,0 +1,4 @@
+%% This file is not generated by configure, because then the provided
+%% pdf files would always appear out-of-date.
+\def\versionemacs{24} % major version of emacs
+\def\year{2012} % latest copyright year
diff --git a/etc/refcards/fr-dired-ref.tex b/etc/refcards/fr-dired-ref.tex
index 2819bbaa25..457ee2db47 100644
--- a/etc/refcards/fr-dired-ref.tex
+++ b/etc/refcards/fr-dired-ref.tex
@@ -35,8 +35,7 @@
\input pdflayout.sty
\pdflayout=(0)
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
% Nothing else needs to be changed.
diff --git a/etc/refcards/fr-refcard.tex b/etc/refcards/fr-refcard.tex
index ed82f00a85..4fe94d7907 100644
--- a/etc/refcards/fr-refcard.tex
+++ b/etc/refcards/fr-refcard.tex
@@ -56,8 +56,7 @@
\input pdflayout.sty
\pdflayout=(0l)
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
% Nothing else needs to be changed below this line.
diff --git a/etc/refcards/fr-survival.tex b/etc/refcards/fr-survival.tex
index 1cd9cc4cf0..16d67f6b1c 100644
--- a/etc/refcards/fr-survival.tex
+++ b/etc/refcards/fr-survival.tex
@@ -49,8 +49,7 @@
\input pdflayout.sty
\pdflayout=(0)
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
\def\copyrightnotice{\penalty-1\vfill
\vbox{\smallfont\baselineskip=0.8\baselineskip\raggedcenter
diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex
index 3c0584d6db..60e81f36d3 100644
--- a/etc/refcards/orgcard.tex
+++ b/etc/refcards/orgcard.tex
@@ -1,7 +1,7 @@
% Reference Card for Org Mode
\def\orgversionnumber{7.8.11}
\def\versionyear{2012} % latest update
-\def\year{2012} % latest copyright year
+\input emacsver.tex
%**start of header
\newcount\columnsperpage
diff --git a/etc/refcards/pl-refcard.tex b/etc/refcards/pl-refcard.tex
index 9cc6fc6a6c..db814cfa8c 100644
--- a/etc/refcards/pl-refcard.tex
+++ b/etc/refcards/pl-refcard.tex
@@ -69,8 +69,7 @@
\input pdflayout.sty
\pdflayout=(0)
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
% Nothing else needs to be changed.
diff --git a/etc/refcards/pt-br-refcard.tex b/etc/refcards/pt-br-refcard.tex
index c16d5096f3..d3fbe54ce8 100644
--- a/etc/refcards/pt-br-refcard.tex
+++ b/etc/refcards/pt-br-refcard.tex
@@ -62,8 +62,7 @@
\input pdflayout.sty
\pdflayout=(0l)
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
% Nothing else needs to be changed below this line.
diff --git a/etc/refcards/refcard.tex b/etc/refcards/refcard.tex
index 70788e8c67..6ca9856085 100644
--- a/etc/refcards/refcard.tex
+++ b/etc/refcards/refcard.tex
@@ -63,8 +63,7 @@
% Nothing else needs to be changed below this line.
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % copyright year
+\input emacsver.tex
\def\shortcopyrightnotice{\vskip 1ex plus 2 fill
\centerline{\small \copyright\ \year\ Free Software Foundation, Inc.
diff --git a/etc/refcards/sk-dired-ref.tex b/etc/refcards/sk-dired-ref.tex
index 4b12b0b42e..50d1740907 100644
--- a/etc/refcards/sk-dired-ref.tex
+++ b/etc/refcards/sk-dired-ref.tex
@@ -42,8 +42,7 @@
\input pdflayout.sty
\pdflayout=(0)
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
% Nothing else needs to be changed.
diff --git a/etc/refcards/sk-refcard.tex b/etc/refcards/sk-refcard.tex
index 5105e8ca98..e617387fad 100644
--- a/etc/refcards/sk-refcard.tex
+++ b/etc/refcards/sk-refcard.tex
@@ -60,8 +60,7 @@
\input pdflayout.sty
\pdflayout=(0)
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
% Nothing else needs to be changed.
diff --git a/etc/refcards/sk-survival.tex b/etc/refcards/sk-survival.tex
index 7597c63f5c..2e7ac9b929 100644
--- a/etc/refcards/sk-survival.tex
+++ b/etc/refcards/sk-survival.tex
@@ -55,8 +55,7 @@
% Slovak hyphenation rules applied
\shyph
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
\def\copyrightnotice{\penalty-1\vfill
\vbox{\smallfont\baselineskip=0.8\baselineskip\raggedcenter
diff --git a/etc/refcards/survival.tex b/etc/refcards/survival.tex
index 92d178a130..09151e9801 100644
--- a/etc/refcards/survival.tex
+++ b/etc/refcards/survival.tex
@@ -44,8 +44,7 @@
\input pdflayout.sty
\pdflayout=(1)
-\def\versionemacs{24} % version of Emacs this is for
-\def\year{2012} % latest copyright year
+\input emacsver.tex
\def\copyrightnotice{\penalty-1\vfill
\vbox{\smallfont\baselineskip=0.8\baselineskip\raggedcenter
diff --git a/etc/refcards/vipcard.tex b/etc/refcards/vipcard.tex
index 13b43dbab7..2a709dc79f 100644
--- a/etc/refcards/vipcard.tex
+++ b/etc/refcards/vipcard.tex
@@ -49,8 +49,8 @@
\input pdflayout.sty
\pdflayout=(1)
+\input emacsver.tex
\def\versionemacs{18} % version of Emacs this is for
-\def\year{2012} % latest copyright year
\def\versionvip{3.5}
% Nothing else needs to be changed.
diff --git a/etc/refcards/viperCard.tex b/etc/refcards/viperCard.tex
index a8694dd3be..c6ab31cdb8 100644
--- a/etc/refcards/viperCard.tex
+++ b/etc/refcards/viperCard.tex
@@ -52,8 +52,8 @@
\input pdflayout.sty
\pdflayout=(1)
+\input emacsver.tex
\def\versionemacs{21} % version of Emacs this is for
-\def\year{2012} % latest copyright year
\def\versionxemacs{20} % version of XEmacs this is for
\def\versionviper{3.0} % version of Viper this is for
diff --git a/leim/ChangeLog b/leim/ChangeLog
index 5c29052d98..6a67c99b5c 100644
--- a/leim/ChangeLog
+++ b/leim/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-05 Eli Zaretskii <[email protected]>
+
+ * quail/hebrew.el ("yiddish-royal"): Fix several bogus entries.
+
2012-08-17 Daniel Bergey <[email protected]> (tiny change)
* quail/indian.el (quail-define-inscript-package):
diff --git a/leim/quail/hebrew.el b/leim/quail/hebrew.el
index aed9910000..307f7fa0c2 100644
--- a/leim/quail/hebrew.el
+++ b/leim/quail/hebrew.el
@@ -773,9 +773,9 @@ Better for yiddish than Hebrew methods.
("@" ?,Y%(B) ; Double Low-9 Quotation Mark
("(" ?\)) ; mirroring
(")" ?\() ; mirroring
- ("Q" ?,A=(B) ; Right Double Quotation Mark
- ("W" ?,A<(B)
- ("E" ?,A>(B) ; Yiddish Double Yod (x2)
+ ("Q" ?,Y4(B) ; Left Double Quotation Mark
+ ("W" ?,Y!(B) ; Right Double Quotation Mark
+ ("E" ?$,1-2(B) ; Yiddish Double Yod (x2)
("R" [ ",H`$,1,W(B" ]) ; Patah Alef (Pasekh Alef)
; ("T" "")
("Y" ?$,1-1(B) ; Ligature Yiddish Vav Yod (vov yud)
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 35190fd2a8..3f1e287db3 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,13 @@
+2012-09-17 Glenn Morris <[email protected]>
+
+ * ebrowse.c (version):
+ * etags.c (print_version): Use COPYRIGHT.
+
+2012-09-11 Paul Eggert <[email protected]>
+
+ * pop.c (socket_connection) [HAVE_GETADDRINFO]:
+ Prefer assignment to memcpy when either will do.
+
2012-08-31 Andreas Schwab <[email protected]>
* etags.c (consider_token): Always zero-terminate token buffer.
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index f8569fe374..056ed471fd 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -3516,8 +3516,7 @@ usage (int error)
static _Noreturn void
version (void)
{
- /* Makes it easier to update automatically. */
- char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundation, Inc.";
+ char emacs_copyright[] = COPYRIGHT;
printf ("ebrowse %s\n", VERSION);
puts (emacs_copyright);
diff --git a/lib-src/etags.c b/lib-src/etags.c
index e65082de53..ec415e9905 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -836,8 +836,7 @@ etags --help --lang=ada.");
static void
print_version (void)
{
- /* Makes it easier to update automatically. */
- char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundation, Inc.";
+ char emacs_copyright[] = COPYRIGHT;
printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION);
puts (emacs_copyright);
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 74054e0e1b..bfbcb8c946 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -1083,7 +1083,7 @@ socket_connection (char *host, int flags)
if (it->ai_addrlen == sizeof (addr))
{
struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr;
- memcpy (&addr.sin_addr, &in_a->sin_addr, sizeof (addr.sin_addr));
+ addr.sin_addr = in_a->sin_addr;
if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
break;
}
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
index ed1f9aa488..1f8caee4f2 100644
--- a/lib/stdbool.in.h
+++ b/lib/stdbool.in.h
@@ -66,24 +66,19 @@
# undef true
#endif
-/* For the sake of symbolic names in gdb, we define true and false as
- enum constants, not only as macros.
- It is tempting to write
- typedef enum { false = 0, true = 1 } _Bool;
- so that gdb prints values of type 'bool' symbolically. But if we do
- this, values of type '_Bool' may promote to 'int' or 'unsigned int'
- (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
- (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
- enum; this ensures that '_Bool' promotes to 'int'. */
-#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__)
+#ifdef __cplusplus
+# define _Bool bool
+# define bool bool
+#else
+# if defined __BEOS__ && !defined __HAIKU__
/* A compiler known to have 'bool'. */
/* If the compiler already has both 'bool' and '_Bool', we can assume they
are the same types. */
-# if !@HAVE__BOOL@
+# if !@HAVE__BOOL@
typedef bool _Bool;
-# endif
-#else
-# if !defined __GNUC__
+# endif
+# else
+# if !defined __GNUC__
/* If @HAVE__BOOL@:
Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
the built-in _Bool type is used. See
@@ -103,19 +98,35 @@ typedef bool _Bool;
"Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
The only benefit of the enum, debuggability, is not important
with these compilers. So use 'signed char' and no enum. */
-# define _Bool signed char
-# else
+# define _Bool signed char
+# else
/* With this compiler, trust the _Bool type if the compiler has it. */
-# if !@HAVE__BOOL@
+# if !@HAVE__BOOL@
+ /* For the sake of symbolic names in gdb, define true and false as
+ enum constants, not only as macros.
+ It is tempting to write
+ typedef enum { false = 0, true = 1 } _Bool;
+ so that gdb prints values of type 'bool' symbolically. But then
+ values of type '_Bool' might promote to 'int' or 'unsigned int'
+ (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
+ (see ISO C 99 6.3.1.1.(2)). So add a negative value to the
+ enum; this ensures that '_Bool' promotes to 'int'. */
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
+# endif
# endif
# endif
+# define bool _Bool
#endif
-#define bool _Bool
/* The other macros must be usable in preprocessor directives. */
-#define false 0
-#define true 1
+#ifdef __cplusplus
+# define false false
+# define true true
+#else
+# define false 0
+# define true 1
+#endif
+
#define __bool_true_false_are_defined 1
#endif /* _GL_STDBOOL_H */
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 62d3097cca..d56e0e88f9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,599 @@
+2012-09-17 Richard Stallman <[email protected]>
+
+ * epa-mail.el (epa-mail-encrypt): Fix bug when a name has no key.
+
+2012-09-17 Chong Yidong <[email protected]>
+
+ * shell.el (shell-file-name-chars, shell-file-name-quote-list)
+ (shell-dynamic-complete-functions): Convert to defcustom.
+ (shell-prompt-pattern, shell-completion-fignore): Doc fix.
+
+ * bookmark.el (bookmark-bmenu-toggle-filenames): Doc fixes.
+ * comint.el (comint-prompt-read-only):
+ * custom.el (defcustom):
+ * hi-lock.el (hi-lock-mode):
+ * ibuffer.el (ibuffer-formats):
+ * ielm.el (ielm-prompt-read-only):
+ * novice.el (disable-command):
+ * saveplace.el (toggle-save-place):
+ * speedbar.el (speedbar-supported-extension-expressions):
+ * startup.el (auto-save-list-file-prefix, init-file-user)
+ (after-init-hook, inhibit-startup-echo-area-message):
+ * strokes.el (strokes-help):
+ * time-stamp.el (time-stamp):
+ * calendar/calendar.el (calendar, diary-file):
+ * calendar/diary-lib.el (diary-mail-entries, diary)
+ (diary-list-entries-hook):
+ * calendar/holidays.el (holidays, calendar-holidays):
+ * calendar/lunar.el (lunar-phases):
+ * calendar/solar.el (sunrise-sunset):
+ * emulation/edt.el (edt-load-keys):
+ * emulation/viper.el (viper-mode):
+ * eshell/em-alias.el (eshell-command-aliases-list):
+ * eshell/esh-util.el (eshell-convert-numeric-arguments):
+ * international/ogonek.el (ogonek-information):
+ * net/tramp-cmds.el (tramp-bug):
+ * net/quickurl.el (quickurl-reread-hook-postfix):
+ * play/decipher.el (decipher-font-lock-keywords):
+ * progmodes/cc-styles.el (c-set-style):
+ * progmodes/idlw-shell.el (idlwave-shell-prompt-pattern):
+ * progmodes/inf-lisp.el (inferior-lisp-prompt):
+ * progmodes/octave-mod.el (octave-mode):
+ * progmodes/sql.el (sql-mode, sql-interactive-mode, sql-password):
+ * progmodes/verilog-mode.el (verilog-read-defines):
+ * textmodes/two-column.el (2C-mode): Likewise.
+
+2012-09-16 Katsumi Yamaoka <[email protected]>
+
+ * mail/mailabbrev.el (mail-abbrev-expand-hook): Work for a mail aliasee
+ that holds many addresses.
+
+2012-09-16 Chong Yidong <[email protected]>
+
+ * align.el (align-areas): Call the indication function with
+ positions instead of markers for arguments (Bug#12343).
+
+ * files.el (parse-colon-path): Use split-string (Bug#12351).
+
+ * window.el (special-display-popup-frame): Doc fix (Bug#8853).
+ (display-buffer-function): Mark as obsolete.
+
+ * progmodes/compile.el (compilation-parse-errors): Accept list
+ values similar to font-lock-keywords (Bug#12136). Suggested by
+ Oleksandr Manzyuk.
+ (compilation-error-regexp-alist): Doc fix.
+
+2012-09-15 Glenn Morris <[email protected]>
+
+ * version.el (emacs-bzr-version-bzr): New function.
+ (emacs-bzr-get-version): Add optional EXTERNAL argument.
+
+ * vc/vc-bzr.el (vc-bzr-working-revision): For lightweight local
+ checkouts, check the parent dirstate matches the branch.
+ Add "--tree" to "bzr revno" arguments. Don't try to shorten the
+ empty string.
+
+ * version.el (emacs-bzr-version): Doc fix.
+ (emacs-bzr-version-dirstate): New function.
+ (emacs-bzr-get-version): For lightweight checkouts, if the parent
+ is local try and check that it matches the branch. If not, just
+ use dirstate information. (Bug#12441)
+
+2012-09-14 Juri Linkov <[email protected]>
+
+ * dired-aux.el (dired-do-chmod): Use `eq' to detect empty input.
+ (Bug#12399)
+
+2012-09-14 Stefan Monnier <[email protected]>
+
+ * emacs-lisp/advice.el (ad-prognify): Remove, use macroexp-progn.
+
+ * emacs-lisp/edebug.el: Miscellaneous cleanup.
+ Remove obsolete byte-compiler hack that tried to silence some warnings.
+ (edebug-submit-bug-report): Remove.
+ (edebug-get-buffer-window, edebug-sit-for, edebug-input-pending-p):
+ Remove aliases, use the un-prefixed name instead.
+ (edebug-pop-to-buffer): Consider other frames.
+ (edebug-original-read):: Make it more obvious that it's always defined.
+ (edebug--make-form-data-entry, edebug--form-data-name)
+ (edebug--form-data-begin, edebug--form-data-end): Rename from the
+ single-dashed name, and implement with cl-defstruct.
+ (edebug-set-form-data-entry): Use the standard accessors.
+ (edebug-make-top-form-data-entry): Use push.
+ (edebug-no-match): Drop useless `funcall'.
+ (mapcar, mapconcat, mapatoms, apply, funcall): Don't add debug specs
+ to functions.
+ (defsubst, dont-compile, eval-when-compile, eval-and-compile)
+ (delay-mode-hooks, with-temp-file, with-temp-message, ad-dolist)
+ (with-syntax-table, push, pop, 1value, noreturn, defadvice)
+ (easy-menu-define, with-custom-print): Remove redundant specs.
+ (edebug-outside-overriding-local-map)
+ (edebug-outside-overriding-terminal-local-map): Remove, unused.
+ (edebug--display): Bind unread-command-events directly to nil rather
+ than binding it to unread-command-events and later setting it to nil.
+ (edebug--display): Kill edebug-eval-buffer here...
+ (edebug--recursive-edit): ...rather than here.
+ Bind standard-output and standard-input.
+ (edebug-eval): Check cl-macroexpand-all is fboundp.
+ (edebug-temp-display-freq-count): Fix last change.
+
+ * emacs-lisp/easymenu.el (easy-menu-define): Add `debug' spec.
+ * subr.el (noreturn, 1value): Add `debug' spec.
+ * emacs-lisp/advice.el: Require cl-lib.
+ (ad-copy-tree): Remove, use copy-tree instead.
+ (ad-dolist): Remove use dolist or cl-dolist instead.
+ (ad-do-return): Remove, use cl-return instead.
+ (defadvice): Add `debug' spec.
+
+2012-09-13 Juri Linkov <[email protected]>
+
+ * dired-aux.el (dired-do-chxxx): Use `eq' to detect empty input.
+ (Bug#12399)
+
+2012-09-13 Glenn Morris <[email protected]>
+
+ * calc/calc.el (math-compose-expr):
+ * calc/calc-ext.el (math-compose-expr):
+ * progmodes/cc-defs.el (cl-macroexpand-all):
+ * progmodes/cc-langs.el (delete-duplicates, mapcan)
+ (cl-macroexpand-all): Update declarations.
+
+ * vc/vc.el: No need to require ediff.
+ (ediff-load-version-control): Declare.
+ (ediff-vc-internal): Fix declaration.
+ (vc-version-ediff): Require ediff.
+
+2012-09-13 Paul Eggert <[email protected]>
+
+ Use a more backwards-compatible timer format (Bug#12430).
+ * emacs-lisp/timer.el (timer): PSECS is now at the end, rather than
+ being right after USECS, as that better supports old code that
+ inadvisedly looked directly at the timer vector.
+
+2012-09-13 Kenichi Handa <[email protected]>
+
+ * language/chinese.el ("Chinese-GB", "Chinese-BIG5")
+ ("Chinese-CNS", "Chinese-EUC-TW"): Add chinese-gbk to
+ `coding-priority' property of these language environment.
+
+2012-09-13 Paul Eggert <[email protected]>
+
+ Fix glitches caused by addition of psec to timers (Bug#12430).
+ * image.el (image-animate-timer):
+ * time.el (display-time-world-timer):
+ Use timer--function and timer--args rather than raw access to
+ timer vector.
+
+2012-09-13 Glenn Morris <[email protected]>
+
+ * emacs-lisp/bytecomp.el (byte-compile-warning-prefix):
+ If not compiling a file, try using load-file-name.
+
+2012-09-13 Stefan Monnier <[email protected]>
+
+ * emacs-lisp/edebug.el (edebug-outside-unread-command-events):
+ Fix last change.
+ (edebug-update-eval-list): Use `push'.
+
+ * emacs-lisp/edebug.el: Use lexical-binding.
+ Remove the "edebug-" prefix from non-dynamically-scoped variables.
+ Mark unused args with underscore.
+ (edebug-save-restriction, edebug-outside-excursion): Use `declare'.
+ (edebug-form-data): Use defvar-local.
+ (edebug-make-before-and-after-form, edebug-make-after-form):
+ Use backquote.
+ (edebug-args, edebug-value, edebug-after-index, edebug-arg-mode):
+ Not dynamically scoped any more.
+ (edebug--enter-trace): Add arguments `function' and `args'.
+ Rename from edebug-enter-trace.
+ (edebug-enter): Call it accordingly. Bind edebug-function explicitly.
+ (edebug--update-coverage): Add `after-index' and `value' args.
+ Rename from edebug-update-coverage.
+ (edebug-slow-after): Call it accordingly.
+ (edebug--recursive-edit): Add arg `arg-mode'. Rename from
+ edebug-recursive-edit.
+ (edebug--display): Call it accordingly. Add args `value',
+ `offset-index', and `arg-mode'. Rename from edebug-display.
+ (edebug-debugger, edebug): Call it accordingly.
+ (edebug-eval-display-list): Use dolist.
+
+2012-09-12 Juri Linkov <[email protected]>
+
+ * info.el (Info-search): Don't check for isearch-mode and
+ isearch-regexp before let-binding search-spaces-regexp to
+ Info-search-whitespace-regexp.
+ (Info-isearch-search): Let-bind Info-search-whitespace-regexp to
+ search-whitespace-regexp if isearch-lax-whitespace or
+ isearch-regexp-lax-whitespace is non-nil.
+ (Info-mode): Don't set local variable search-whitespace-regexp.
+ http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00811.html
+
+2012-09-12 Stefan Monnier <[email protected]>
+
+ * emacs-lisp/debug.el (debugger-outer-unread-command-char, debug)
+ (debugger-env-macro): Remove support for unread-command-char.
+
+ * subr.el (set-temporary-overlay-map): Minimize slightly the impact of
+ the temporary map re-appearing on emulation-mode-map-alists.
+
+ * emacs-lisp/edebug.el (def-edebug-form-spec): Remove, it's been broken
+ since 22.1.
+
+ * ehelp.el (with-electric-help): Accept functions in
+ electric-help-form-to-execute.
+ (electric-help-execute-extended, electric-help-ctrl-x-prefix): Use it.
+ And replace unread-command-char -> unread-command-events.
+
+2012-09-12 Michael Albinus <[email protected]>
+
+ Sync with Tramp 2.2.6.
+
+ * net/tramp.el (tramp-accept-process-output): Don't use
+ JUST-THIS-ONE in the XEmacs case.
+
+ * net/trampver.el: Update release number.
+
+2012-09-12 Martin Rudalics <[email protected]>
+
+ * emacs-lisp/debug.el (debugger-previous-window-height):
+ New variable.
+ (debug): When debugger-jumping-flag is non-nil try to restore
+ height of debugger window. (Bug#8789)
+
+2012-09-12 Stefan Monnier <[email protected]>
+
+ * emacs-lisp/edebug.el (edebug-enter): Don't mess with
+ overriding-local-map and pre/post-command-hook here.
+ (edebug-recursive-edit): Do it here instead (bug#12345).
+ (edebug-outside-unread-command-char): Remove all uses of
+ unread-command-char.
+
+ * emacs-lisp/debug.el (debug): Don't bind debug-on-error since
+ inhibit-debugger is bound instead.
+
+2012-09-11 Bastien Guerry <[email protected]>
+
+ * subr.el (set-temporary-overlay-map): Add a docstring.
+ (Bug#12346)
+
+2012-09-11 Bastien Guerry <[email protected]>
+
+ * minibuffer.el (completion-table-subvert): Fix docstring.
+ (Bug#12347)
+
+2012-09-11 Bastien Guerry <[email protected]>
+
+ * help-fns.el (describe-variable): Fix typo. (Bug#12346)
+
+2012-09-10 Michael R. Mauger <[email protected]>
+
+ * progmodes/sql.el: Version 3.1
+ (sql-db2-escape-newlines): New variable.
+ (sql-escape-newlines-filter): Use it.
+
+2012-09-10 Juanma Barranquero <[email protected]>
+
+ * custom.el (custom-theme-load-confirm): Remove unneeded assignment.
+
+2012-09-10 Dan Nicolaescu <[email protected]>
+
+ * vc/diff-mode.el (diff-mode-menu):
+ Bind diff-remove-trailing-whitespace.
+
+2012-09-10 Stefan Monnier <[email protected]>
+
+ * emacs-lisp/lisp-mode.el (emacs-list-byte-code-comment-re): New var.
+ (emacs-lisp-byte-code-comment, emacs-lisp-byte-code-syntax-propertize)
+ (emacs-lisp-byte-code-mode): New functions.
+ (eval-sexp-add-defvars): Don't skip defvars in column >0.
+ (eval-defun-2): Remove bogus interactive spec.
+ (lisp-indent-line): Remove redundant whole-exp code, now done in
+ indent-according-to-mode.
+ (save-match-data): Remove redundant indent data.
+
+ * emacs-lisp/benchmark.el (benchmark-run, benchmark-run-compiled):
+ Use `declare'.
+
+2012-09-09 Juri Linkov <[email protected]>
+
+ * replace.el (replace-regexp-lax-whitespace): New defcustom.
+ (replace-lax-whitespace, query-replace-regexp)
+ (query-replace-regexp-eval, replace-regexp): Doc fix.
+ (perform-replace, replace-highlight): Let-bind
+ isearch-lax-whitespace to replace-lax-whitespace and
+ isearch-regexp-lax-whitespace to replace-regexp-lax-whitespace.
+
+ * isearch.el (isearch-query-replace): Let-bind
+ replace-lax-whitespace to isearch-lax-whitespace and
+ replace-regexp-lax-whitespace to
+ isearch-regexp-lax-whitespace. (Bug#10885)
+
+2012-09-09 Stefan Monnier <[email protected]>
+
+ * eshell/em-unix.el (eshell/sudo): Explicitly drop return value.
+
+2012-09-09 Alan Mackenzie <[email protected]>
+
+ * progmodes/cc-engine.el (c-state-cache-init):
+ Initialise c-state-semi-nonlit-pos-cache\(-limit\)? properly.
+ (c-record-parse-state-state):
+ Record c-state-semi-nonlit-pos-cache\(-limit\)?.
+
+2012-09-09 Andreas Schwab <[email protected]>
+
+ * register.el (register-separator): Rename from
+ separator-register. All uses changed. Doc fix.
+ (register): Fix version.
+
+2012-09-09 Chong Yidong <[email protected]>
+
+ * replace.el (query-replace-map): Bind four new symbols for
+ requesting window scrolling.
+
+ * subr.el (y-or-n-p): Handle the window-scrolling bindings in
+ query-replace-map (Bug#8948).
+
+ * custom.el (custom-theme-load-confirm): Use y-or-n-p.
+
+ * emacs-lisp/map-ynp.el (map-y-or-n-p): Don't bind scrolling keys
+ since they are now in query-replace-map.
+
+ * window.el (scroll-other-window-down): Make the arg optional.
+
+2012-09-09 Chong Yidong <[email protected]>
+
+ * files.el (hack-local-variables-confirm): Use quit-window to kill
+ the *Local Variables* buffer.
+
+2012-09-08 Dmitry Gutov <[email protected]>
+
+ * progmodes/ruby-mode.el (ruby-toggle-block): Guess the current block,
+ not just expect to be at its beginning. Adjust callees.
+ Succeed when do-end block has no space before the pipe character.
+ (ruby-brace-to-do-end): When the original block is one-liner,
+ convert to multiline. Reindent the result.
+
+2012-09-08 Jambunathan K <[email protected]>
+
+ * register.el (register): New group.
+ (register-separator): New user option.
+ (increment-register): Route it to `append-to-register', if
+ register contains text. Implication is that `C-x r +' can now be
+ used for appending to a text register (bug#12217).
+ (append-to-register, prepend-to-register): Add separator based on
+ `register-separator.
+
+2012-09-08 Alan Mackenzie <[email protected]>
+
+ AWK Mode: make auto-newline work when there's "==" in the pattern.
+ * progmodes/cc-cmds.el (c-point-syntax): Handle virtual semicolons
+ correctly.
+ * progmodes/cc-engine.el (c-guess-basic-syntax CASE 5A.3):
+ Test more rigorously for "=" token.
+
+2012-09-08 Dmitry Gutov <[email protected]>
+
+ * progmodes/ruby-mode.el (ruby-match-expression-expansion):
+ Only fail when reached LIMIT.
+
+2012-09-08 Chong Yidong <[email protected]>
+
+ * dired.el (dired-mode-map): Don't bind M-=.
+
+ * dired-aux.el (dired-diff): Use backup file as default.
+
+2012-09-08 Drew Adams <[email protected]>
+
+ * subr.el (add-to-history): Fix delete usage (Bug#12314).
+
+2012-09-08 Chong Yidong <[email protected]>
+
+ * subr.el (syntax-after, syntax-class): Doc fix.
+
+2012-09-08 Martin Rudalics <[email protected]>
+
+ * window.el (display-buffer-in-previous-window): New buffer
+ display action function.
+
+ * emacs-lisp/debug.el (debugger-bury-or-kill): New option.
+ (debugger-previous-window): New variable.
+ (debug): Rewrite using display-buffer-in-previous-window,
+ quit-restore-window and debugger-bury-or-kill. (Bug#8789)
+
+2012-09-07 Stefan Monnier <[email protected]>
+
+ * emacs-lisp/byte-run.el (defun): Tweak message. Simplify code.
+
+2012-09-07 Matt McClure <[email protected]> (tiny change)
+
+ * progmodes/python.el (python-shell-send-string):
+ When default-directory is remote, create temp file on remote
+ filesystem.
+ (python-shell-send-file): When file is remote, pass local view of
+ file paths to remote Python interpreter. (Bug#12340)
+
+2012-09-07 Chong Yidong <[email protected]>
+
+ * window.el (switch-to-buffer): Doc fix (Bug#12181).
+
+ * files.el (after-find-file): Don't fail on a read-only buffer if
+ require-final-newline is `visit' or `visit-save' (Bug#11156).
+
+ * subr.el (read-char-choice): Allow quitting via ESC ESC.
+
+ * userlock.el (ask-user-about-supersession-threat):
+ Use read-char-choice (Bug#12093).
+
+2012-09-07 Chong Yidong <[email protected]>
+
+ * subr.el (buffer-narrowed-p): New function.
+
+ * ses.el (ses-widen):
+ * simple.el (count-words--buffer-message):
+ * net/browse-url.el (browse-url-of-buffer): Use it
+
+ * simple.el (count-words-region): Don't signal an error if there
+ is a non-nil prefix arg and the mark is not set.
+
+ * help.el (describe-key-briefly): Allow the message to be seen
+ when invoked from the minibuffer (Bug#7014).
+
+2012-09-07 Dmitry Gutov <[email protected]>
+
+ * progmodes/ruby-mode.el (ruby-end-of-defun)
+ (ruby-beginning-of-defun): Simplify, allow indentation before
+ block beginning and end keywords.
+ (ruby-beginning-of-defun): Only consider 3 keywords defun beginners.
+ (ruby-end-of-defun): Expect that the point is at the beginning of
+ the defun.
+
+2012-09-06 Stefan Monnier <[email protected]>
+
+ * emacs-lisp/cl-macs.el (cl--do-arglist): Understand _ on &key args
+ (bug#12367).
+ (cl--make-usage-args): Strip _ from argument names.
+
+2012-09-06 RĂĽdiger Sonderfeld <[email protected]>
+
+ * progmodes/vhdl-mode.el (vhdl-speedbar-initialize): Don't use
+ obsolete alias speedbar-key-map.
+ (vhdl-doc-variable, vhdl-doc-mode): Use called-interactively-p.
+ (vhdl-index-menu-init): Don't use obsolete variable
+ font-lock-maximum-size.
+
+2012-09-06 Chong Yidong <[email protected]>
+
+ * frame.el (window-system-version): Mark as obsolete.
+
+ * speedbar.el (speedbar-update-flag, speedbar-mode): Remove uses
+ of obsolete variable speedbar-key-map.
+
+2012-09-06 Juri Linkov <[email protected]>
+
+ * replace.el (replace-lax-whitespace): New defcustom.
+ (query-replace, query-replace-regexp, query-replace-regexp-eval)
+ (replace-string, replace-regexp): Mention it in docstrings.
+ (perform-replace, replace-highlight): Let-bind
+ isearch-lax-whitespace and isearch-regexp-lax-whitespace according
+ to the values of replace-lax-whitespace and regexp-flag.
+ Don't let-bind search-whitespace-regexp. (Bug#10885)
+
+ * isearch.el (isearch-query-replace): Let-bind
+ replace-lax-whitespace instead of let-binding
+ replace-search-function and replace-re-search-function.
+ (isearch-lazy-highlight-search): Let-bind isearch-lax-whitespace
+ and isearch-regexp-lax-whitespace to lazy-highlight variables.
+ (isearch-toggle-symbol): Set isearch-regexp to nil
+ in isearch-word mode (like in isearch-toggle-word).
+
+2012-09-06 Juri Linkov <[email protected]>
+
+ * replace.el (replace-search-function)
+ (replace-re-search-function): Set default values to nil.
+ (perform-replace): Let-bind isearch-related variables based on
+ replace-related values, call `isearch-search-fun' and let-bind
+ the result to `search-function'. Remove code that sets
+ `search-function' and `search-string' separately for
+ `delimited-flag'.
+ (replace-highlight): Add new argument `delimited-flag' and
+ rename other arguments to the names used in `perform-replace'.
+ Let-bind `isearch-word' to the argument `delimited-flag'.
+ (Bug#10885, bug#10887)
+
+2012-09-07 Dmitry Gutov <[email protected]>
+
+ * progmodes/ruby-mode.el (ruby-indent-beg-re): Add pieces from
+ ruby-beginning-of-indent, simplify, allow all keywords to have
+ indentation before them.
+ (ruby-beginning-of-indent): Adjust for above. Search until the
+ found point is not inside a string or comment.
+ (ruby-font-lock-keywords): Allow symbols to start with "@"
+ character, give them higher priority than variables.
+ (ruby-syntax-propertize-function)
+ (ruby-font-lock-syntactic-keywords): Remove the "not comments"
+ matchers. Expression expansions are not comments when inside a
+ string, and there comment syntax status is irrelevant.
+ (ruby-match-expression-expansion): New function. Check that
+ expression expansion is inside a string, and it's not escaped.
+ (ruby-font-lock-keywords): Use it.
+
+2012-09-05 Martin Rudalics <[email protected]>
+
+ * help.el (temp-buffer-max-height): New default value.
+ (temp-buffer-resize-frames): New option.
+ (resize-temp-buffer-window): Optionally resize frame.
+
+ * window.el (fit-frame-to-buffer-bottom-margin): New option.
+ (fit-frame-to-buffer): New function.
+
+2012-09-05 Glenn Morris <[email protected]>
+
+ * emulation/cua-rect.el (cua--init-rectangles):
+ * textmodes/picture.el (picture-mode-map):
+ * play/blackbox.el (blackbox-mode-map): Remap right-char and left-char
+ like forward-char and backward-char. (Bug#12317)
+
+2012-09-05 Leo Liu <[email protected]>
+
+ * progmodes/flymake.el (flymake-warning-re): New variable.
+ (flymake-parse-line): Use it.
+
+2012-09-05 Glenn Morris <[email protected]>
+
+ * calendar/holidays.el (holiday-christian-holidays):
+ Rename an entry. (Bug#12289)
+
+2012-09-05 Stefan Monnier <[email protected]>
+
+ * progmodes/sh-script.el (sh-font-lock-paren): Don't burp at BOB
+ (bug#12222).
+
+2012-09-04 Stefan Monnier <[email protected]>
+
+ * loadup.el: Load macroexp. Remove hack.
+ * emacs-lisp/macroexp.el (macroexp--eval-if-compile): New function.
+ (macroexp--expand-all): Use it to get better warnings.
+ (macroexp--backtrace, macroexp--trim-backtrace-frame)
+ (internal-macroexpand-for-load): New functions.
+ (macroexp--pending-eager-loads): New var.
+ (emacs-startup-hook): New hack to replace one in loadup.el.
+ * emacs-lisp/cl-macs.el (cl--compiler-macro-list*)
+ (cl--compiler-macro-cXXr): Move to top, before they can be used.
+ (cl-psetf): Simplify.
+ (cl-defstruct): Add indent rule.
+
+2012-09-04 Lars Ingebrigtsen <[email protected]>
+
+ * mail/smtpmail.el (smtpmail-send-it): Prefer the From: header
+ over `user-mail-address' for the SMTP MAIL FROM envelope.
+ (smtpmail-via-smtp): Ditto.
+
+2012-09-04 Dmitry Gutov <[email protected]>
+
+ * progmodes/ruby-mode.el: Clean up keybindings.
+ (ruby-mode-map): Don't bind ruby-electric-brace,
+ ruby-beginning-of-defun, ruby-end-of-defun, ruby-mark-defun,
+ backward-kill-word, reindent-then-newline-and-indent.
+ (ruby-mark-defun): Remove.
+ (ruby-electric-brace): Remove. Obsoleted by electric-indent-chars.
+ (ruby-mode): Set local beginning-of-defun-function and
+ end-of-defun-function values.
+
+2012-09-03 Martin Rudalics <[email protected]>
+
+ * window.el (temp-buffer-window-setup-hook)
+ (temp-buffer-window-show-hook): New hooks.
+ (temp-buffer-window-setup, temp-buffer-window-show)
+ (with-temp-buffer-window): New functions.
+ (fit-window-to-buffer): Remove unused optional argument OVERRIDE.
+ (special-display-popup-frame): Make sure the window used shows BUFFER.
+
+ * help.el (temp-buffer-resize-mode): Fix doc-string.
+ (resize-temp-buffer-window): New optional argument WINDOW.
+
+ * files.el (recover-file, save-buffers-kill-emacs):
+ * dired.el (dired-mark-pop-up): Use with-temp-buffer-window.
+
2012-09-02 Michael Albinus <[email protected]>
* eshell/em-unix.el (eshell/sudo): When we have an ad-hoc
@@ -132,8 +728,8 @@
2012-08-29 Michael Albinus <[email protected]>
* eshell/esh-ext.el (eshell-external-command): Do not examine
- remote shell scripts. See
- <https://bugs.launchpad.net/ubuntu/+source/emacs23/+bug/1035790>.
+ remote shell scripts.
+ See <https://bugs.launchpad.net/ubuntu/+source/emacs23/+bug/1035790>.
* net/tramp-sh.el (tramp-remote-path): Add "/sbin" and
"/usr/local/sbin".
@@ -1175,7 +1771,7 @@
* calc-mode.el (calc-basic-simplification-mode): Rename from
`calc-limited-simplification-mode'.
(calc-alg-simplification-mode): New function.
- (calc-set-simplify-mode): Adjust message.
+ (calc-set-simplify-mode): Adjust message.
* calc.el (calc-set-mode-line): Adjust mode line display for
basic simplification mode.
@@ -1373,7 +1969,7 @@
* notifications.el (notifications-on-action-signal)
(notifications-on-closed-signal): Use also the bus address for the map.
(notifications-notify, notifications-close-notification)
- (notifications-get-capabilities): Add optional argument BUS.
+ (notifications-get-capabilities): Add optional argument BUS.
2012-07-27 Tassilo Horn <[email protected]>
@@ -1493,7 +2089,7 @@
ses-cell-set-formula or ses-set-cell to change the cell and handle
the undo at the same time, but rather use lower level new macros
`ses-cell-formula-aset' and `ses-cell-references-aset' and handle
- the undo directly. Refresh the mode line.
+ the undo directly. Refresh the mode line.
2012-07-21 Leo Liu <[email protected]>
@@ -4909,13 +5505,13 @@
* progmodes/verilog-mode.el (font-lock-keywords):
Fix mis-highligting auto. Reported by Craig Barner.
(verilog-auto, verilog-auto-undef): Add AUTOUNDEF to remove
- defines from global name space. Reported by Dan Dever.
+ defines from global name space. Reported by Dan Dever.
(verilog-auto-reset, verilog-auto-reset-widths)
(verilog-auto-tieoff): Support using unbased numbers for
AUTORESET and AUTOTIEOFF.
(verilog-submit-bug-report): Update variable list.
(verilog-read-auto-params): Fix AUTOINPUT regexps containing
- parenthesis from not matching. Reported by Michael Rytting.
+ parenthesis from not matching. Reported by Michael Rytting.
(verilog-auto-template-lint): Fix hash error when linting modules
with no used templates.
(verilog-warn, verilog-warn-error)
@@ -4925,12 +5521,12 @@
(verilog-read-auto-template): Add `verilog-auto-template-warn-unused'
to report unused template errors. Reported by Brad Dobbie.
(verilog-read-decls): Fix AUTOWIRE etc on supply0, supply1 type
- nets, bug438. Reported by Vns Blore.
+ nets, bug438. Reported by Vns Blore.
(verilog-auto-inout-module, verilog-auto-reg)
(verilog-read-decls, verilog-read-sub-decls-sig)
(verilog-signals-edit-wire-reg, verilog-signals-with):
Fix passing of Verilog data types in ANSI input/output ports
- such as "output logic" into the AUTOs. Special case "wire" and
+ such as "output logic" into the AUTOs. Special case "wire" and
"reg" for backwards compatibility presuming Verilog 2001.
(verilog-auto-ascii-enum): Add "auto enum" as alias.
(verilog-preprocess): Fix replication of preprocess output.
@@ -4951,7 +5547,7 @@
(verilog-read-decls): Fix 'parameter type' not appearing in
AUTOINSTPARAM, bug340. Reported by Jonathan Greenlaw.
(verilog-auto-logic): Fix when AUTOLOGIC present to properly do
- AUTOINPUTs, bug411. Reported by Jonathan Greenlaw.
+ AUTOINPUTs, bug411. Reported by Jonathan Greenlaw.
(verilog-read-auto-lisp): Avoid syntax-ppss warning on AUTOLISP.
Reported by David Kravitz.
diff --git a/lisp/align.el b/lisp/align.el
index 4c82d7bea8..0af5e56c66 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -74,7 +74,7 @@
;; align-?-modes variables (for example, `align-dq-string-modes'), use
;; `add-to-list', or some similar function which checks first to see
;; if the value is already there. Since the user may customize that
-;; mode list, and then write your mode name into their .emacs file,
+;; mode list, and then write your mode name into their init file,
;; causing the symbol already to be present the next time they load
;; your package.
@@ -1201,7 +1201,10 @@ have been aligned. No changes will be made to the buffer."
(gocol col) cur)
(when area
(if func
- (funcall func (car area) (cdr area) change)
+ (funcall func
+ (marker-position (car area))
+ (marker-position (cdr area))
+ change)
(if (not (and justify
(consp (cdr area))))
(goto-char (cdr area))
diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el
index fbf8c46658..21c35811ac 100644
--- a/lisp/autoinsert.el
+++ b/lisp/autoinsert.el
@@ -36,7 +36,7 @@
;; setq auto-insert-directory to an appropriate slash-terminated value
;;
;; You can also customize the variable `auto-insert-mode' to load the
-;; package. Alternatively, add the following to your .emacs file:
+;; package. Alternatively, add the following to your init file:
;; (auto-insert-mode 1)
;;
;; Author: Charlie Martin
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 75a8d9f59d..31bbc13acf 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -144,10 +144,7 @@ You can toggle whether files are shown with \\<bookmark-bmenu-mode-map>\\[bookma
(defcustom bookmark-bmenu-toggle-filenames t
"Non-nil means show filenames when listing bookmarks.
-This may result in truncated bookmark names. To disable this, put the
-following in your `.emacs' file:
-
-\(setq bookmark-bmenu-toggle-filenames nil)"
+A non-nil value may result in truncated bookmark names."
:type 'boolean
:group 'bookmark)
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 7089070df5..c7d93530fd 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -61,7 +61,7 @@
(declare-function math-vector-is-string "calccomp" (a))
(declare-function math-vector-to-string "calccomp" (a &optional quoted))
(declare-function math-format-radix-float "calc-bin" (a prec))
-(declare-function math-compose-expr "calccomp" (a prec))
+(declare-function math-compose-expr "calccomp" (a prec &optional div))
(declare-function math-abs "calc-arith" (a))
(declare-function math-format-bignum-binary "calc-bin" (a))
(declare-function math-format-bignum-octal "calc-bin" (a))
@@ -3483,7 +3483,7 @@ If X is not an error form, return 1."
(substring str i))))
str))
-;;; Users can redefine this in their .emacs files.
+;;; Users can redefine this in their init files.
(defvar calc-keypad-user-menu nil
"If non-nil, this describes an additional menu for calc-keypad.
It should contain a list of three rows.
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index dfc5dfc658..bd748158d6 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -494,7 +494,7 @@
(car res))))))))
-;;; It is safe to redefine these in your .emacs file to use a different
+;;; It is safe to redefine these in your init file to use a different
;;; language.
(defvar math-long-weekday-names '( "Sunday" "Monday" "Tuesday" "Wednesday"
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 3e6ae1c740..17f0998d30 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -199,7 +199,7 @@
(declare-function calc-div-fractions "calc-frac" (a b))
(declare-function math-div-objects-fancy "calc-arith" (a b))
(declare-function math-div-symb-fancy "calc-arith" (a b))
-(declare-function math-compose-expr "calccomp" (a prec))
+(declare-function math-compose-expr "calccomp" (a prec &optional div))
(declare-function math-comp-width "calccomp" (c))
(declare-function math-composition-to-string "calccomp" (c &optional width))
(declare-function math-stack-value-offset-fancy "calccomp" ())
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index d5514d14a3..cdbf8d7aa8 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -593,7 +593,7 @@ You can customize `diary-date-forms' to your preferred format.
Three default styles are provided: `diary-american-date-forms',
`diary-european-date-forms', and `diary-iso-date-forms'.
You can choose between these by setting `calendar-date-style' in your
-.emacs file, or by using `calendar-set-date-style' when in the calendar.
+init file, or by using `calendar-set-date-style' when in the calendar.
A diary entry can be preceded by the character `diary-nonmarking-symbol'
\(ordinarily `&') to make that entry nonmarking--that is, it will not be
@@ -1276,7 +1276,7 @@ Runs the following hooks:
generating a calendar, if today's date is visible or not, respectively
`calendar-initial-window-hook' - after first creating a calendar
-This function is suitable for execution in a .emacs file."
+This function is suitable for execution in an init file."
(interactive "P")
;; Avoid loading cal-x unless it will be used.
(if (and (memq calendar-setup '(one-frame two-frames calendar-only))
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 8fa5b0ddb0..4bce8ec092 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -200,19 +200,21 @@ holidays), or hard copy output."
'diary-list-entries-hook "23.1")
(defcustom diary-list-entries-hook nil
- "List of functions called after diary file is culled for relevant entries.
-You might wish to add `diary-include-other-diary-files', in which case
-you will probably also want to add `diary-mark-included-diary-files' to
-`diary-mark-entries-hook'. For example, you could use
+ "Hook run after diary file is culled for relevant entries.
+
+If you add `diary-include-other-diary-files' to this hook, you
+will probably also want to add `diary-mark-included-diary-files'
+to `diary-mark-entries-hook'. For example, to cause the fancy
+diary buffer to be displayed with diary entries from various
+included files, each day's entries sorted into lexicographic
+order, add the following to your init file:
(setq diary-display-function 'diary-fancy-display)
(add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
(add-hook 'diary-list-entries-hook 'diary-sort-entries t)
-in your `.emacs' file to cause the fancy diary buffer to be displayed with
-diary entries from various included files, each day's entries sorted into
-lexicographic order. Note how the sort function is placed last,
-so that it can sort the entries included from other files.
+Note how the sort function is placed last, so that it can sort
+the entries included from other files.
This hook runs after `diary-nongregorian-listing-hook'. These two hooks
differ only if you are using included diary files. In that case,
@@ -532,7 +534,7 @@ If so, return the expanded file name, otherwise signal an error."
"Generate the diary window for ARG days starting with the current date.
If no argument is provided, the number of days of diary entries is governed
by the variable `diary-number-of-entries'. A value of ARG less than 1
-does nothing. This function is suitable for execution in a `.emacs' file."
+does nothing. This function is suitable for execution in an init file."
(interactive "P")
(diary-check-diary-file)
(diary-list-entries (calendar-current-date)
@@ -1230,8 +1232,8 @@ Mail is sent to the address specified by `diary-mail-addr'.
Here is an example of a script to call `diary-mail-entries',
suitable for regular scheduling using cron (or at). Note that
-since `emacs -script' does not load your `.emacs' file, you
-should ensure that all relevant variables are set.
+since `emacs -script' does not load your init file, you should
+ensure that all relevant variables are set.
#!/usr/bin/emacs -script
;; diary-rem.el - run the Emacs diary-reminder
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index 043d402f61..b94815f98e 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -250,7 +250,7 @@ See the documentation for `calendar-holidays' for details."
(if calendar-christian-all-holidays-flag
(append
(holiday-fixed 1 6 "Epiphany")
- (holiday-julian 12 25 "Eastern Orthodox Christmas")
+ (holiday-julian 12 25 "Christmas (Julian calendar)")
(holiday-greek-orthodox-easter)
(holiday-fixed 8 15 "Assumption")
(holiday-advent 0 "Advent")))))
@@ -343,12 +343,12 @@ See the documentation for `calendar-holidays' for details."
"List of notable days for the command \\[holidays].
Additional holidays are easy to add to the list, just put them in the
-list `holiday-other-holidays' in your .emacs file. Similarly, by setting
+list `holiday-other-holidays' in your init file. Similarly, by setting
any of `holiday-general-holidays', `holiday-local-holidays',
`holiday-christian-holidays', `holiday-hebrew-holidays',
`holiday-islamic-holidays', `holiday-bahai-holidays',
`holiday-oriental-holidays', or `holiday-solar-holidays' to nil in your
-.emacs file, you can eliminate unwanted categories of holidays.
+init file, you can eliminate unwanted categories of holidays.
The aforementioned variables control the holiday choices offered
by the function `holiday-list' when it is called interactively.
@@ -523,7 +523,7 @@ use instead of point."
(defun holidays (&optional arg)
"Display the holidays for last month, this month, and next month.
If called with an optional prefix argument ARG, prompts for month and year.
-This function is suitable for execution in a .emacs file."
+This function is suitable for execution in a init file."
(interactive "P")
(save-excursion
(let* ((completion-ignore-case t)
diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el
index 8f09d20f50..2761df0bdb 100644
--- a/lisp/calendar/lunar.el
+++ b/lisp/calendar/lunar.el
@@ -236,7 +236,7 @@ use instead of point."
(defun lunar-phases (&optional arg)
"Display the quarters of the moon for last month, this month, and next month.
If called with an optional prefix argument ARG, prompts for month and year.
-This function is suitable for execution in a .emacs file."
+This function is suitable for execution in an init file."
(interactive "P")
(save-excursion
(let* ((date (if arg (calendar-read-date t)
diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el
index a8d7d44af3..3ccdf135fb 100644
--- a/lisp/calendar/solar.el
+++ b/lisp/calendar/solar.el
@@ -797,7 +797,7 @@ If called with an optional prefix argument ARG, prompt for date.
If called with an optional double prefix argument, prompt for
longitude, latitude, time zone, and date, and always use standard time.
-This function is suitable for execution in a .emacs file."
+This function is suitable for execution in an init file."
(interactive "p")
(or arg (setq arg 1))
(if (and (< arg 16)
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el
index 2ebb8c7c3a..3151ce145d 100644
--- a/lisp/calendar/timeclock.el
+++ b/lisp/calendar/timeclock.el
@@ -49,7 +49,7 @@
;; If you want Emacs to display the amount of time "left" to your
;; workday in the mode-line, you can either set the value of
;; `timeclock-mode-line-display' to t using M-x customize, or you can
-;; add this code to your .emacs file:
+;; add this code to your init file:
;;
;; (require 'timeclock)
;; (timeclock-mode-line-display)
@@ -60,7 +60,7 @@
;; You may also want Emacs to ask you before exiting, if you are
;; currently working on a project. This can be done either by setting
;; `timeclock-ask-before-exiting' to t using M-x customize (this is
-;; the default), or by adding the following to your .emacs file:
+;; the default), or by adding the following to your init file:
;;
;; (add-hook 'kill-emacs-query-functions 'timeclock-query-out)
diff --git a/lisp/comint.el b/lisp/comint.el
index 5b0eb3027e..638ef73d53 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -181,7 +181,7 @@ override the read-only-ness of comint prompts is to call
`comint-kill-whole-line' or `comint-kill-region' with no
narrowing in effect. This way you will be certain that none of
the remaining prompts will be accidentally messed up. You may
-wish to put something like the following in your `.emacs' file:
+wish to put something like the following in your init file:
\(add-hook 'comint-mode-hook
(lambda ()
diff --git a/lisp/custom.el b/lisp/custom.el
index fb166dd35f..01b0e6d165 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -237,7 +237,7 @@ The following keywords are meaningful:
is `default-value'.
:require
VALUE should be a feature symbol. If you save a value
- for this option, then when your `.emacs' file loads the value,
+ for this option, then when your init file loads the value,
it does (require VALUE) first.
:set-after VARIABLES
Specifies that SYMBOL should be set after the list of variables
@@ -1223,38 +1223,19 @@ Return t if THEME was successfully loaded, nil otherwise."
"Query the user about loading a Custom theme that may not be safe.
The theme should be in the current buffer. If the user agrees,
query also about adding HASH to `custom-safe-themes'."
- (if noninteractive
- nil
- (let ((exit-chars '(?y ?n ?\s))
- window prompt char)
- (save-window-excursion
- (rename-buffer "*Custom Theme*" t)
- (emacs-lisp-mode)
- (setq window (display-buffer (current-buffer)))
- (setq prompt
- (format "Loading a theme can run Lisp code. Really load?%s"
- (if (and window
- (< (line-number-at-pos (point-max))
- (window-body-height)))
- " (y or n) "
- (push ?\C-v exit-chars)
- "\nType y or n, or C-v to scroll: ")))
- (goto-char (point-min))
- (while (null char)
- (setq char (read-char-choice prompt exit-chars))
- (when (eq char ?\C-v)
- (if window
- (with-selected-window window
- (condition-case nil
- (scroll-up)
- (error (goto-char (point-min))))))
- (setq char nil)))
- (when (memq char '(?\s ?y))
- ;; Offer to save to `custom-safe-themes'.
- (and (or custom-file user-init-file)
- (y-or-n-p "Treat this theme as safe in future sessions? ")
- (customize-push-and-save 'custom-safe-themes (list hash)))
- t)))))
+ (unless noninteractive
+ (save-window-excursion
+ (rename-buffer "*Custom Theme*" t)
+ (emacs-lisp-mode)
+ (pop-to-buffer (current-buffer))
+ (goto-char (point-min))
+ (prog1 (when (y-or-n-p "Loading a theme can run Lisp code. Really load? ")
+ ;; Offer to save to `custom-safe-themes'.
+ (and (or custom-file user-init-file)
+ (y-or-n-p "Treat this theme as safe in future sessions? ")
+ (customize-push-and-save 'custom-safe-themes (list hash)))
+ t)
+ (quit-window)))))
(defun custom-theme-name-valid-p (name)
"Return t if NAME is a valid name for a Custom theme, nil otherwise.
diff --git a/lisp/desktop.el b/lisp/desktop.el
index a873a6b63b..75deb58b4d 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -34,7 +34,7 @@
;; - some local variables
;; To use this, use customize to turn on desktop-save-mode or add the
-;; following line somewhere in your .emacs file:
+;; following line somewhere in your init file:
;;
;; (desktop-save-mode 1)
;;
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 6186f762e0..e5ca463e8d 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -54,43 +54,30 @@ into this list; they also should call `dired-log' to log the errors.")
;;;###autoload
(defun dired-diff (file &optional switches)
"Compare file at point with file FILE using `diff'.
-FILE defaults to the file at the mark. (That's the mark set by
-\\[set-mark-command], not by Dired's \\[dired-mark] command.)
-The prompted-for FILE is the first file given to `diff'.
+If called interactively, prompt for FILE; if the file at point
+has a backup file, use that as the default.
+
+FILE is the first file given to `diff'.
With prefix arg, prompt for second argument SWITCHES,
which is the string of command switches for `diff'."
(interactive
(let* ((current (dired-get-filename t))
- ;; Get the file at the mark.
- (file-at-mark (if (mark t)
- (save-excursion (goto-char (mark t))
- (dired-get-filename t t))))
- ;; Use it as default if it's not the same as the current file,
- ;; and the target dir is the current dir or the mark is active.
- (default (if (and (not (equal file-at-mark current))
- (or (equal (dired-dwim-target-directory)
- (dired-current-directory))
- mark-active))
- file-at-mark))
- (target-dir (if default
- (dired-current-directory)
- (dired-dwim-target-directory)))
- (defaults (dired-dwim-target-defaults (list current) target-dir)))
- (require 'diff)
- (list
- (minibuffer-with-setup-hook
- (lambda ()
- (set (make-local-variable 'minibuffer-default-add-function) nil)
- (setq minibuffer-default defaults))
- (read-file-name
- (format "Diff %s with%s: " current
- (if default (format " (default %s)" default) ""))
- target-dir default t))
- (if current-prefix-arg
- (read-string "Options for diff: "
- (if (stringp diff-switches)
- diff-switches
- (mapconcat 'identity diff-switches " ")))))))
+ (oldf (file-newest-backup current))
+ (dir (if oldf (file-name-directory oldf))))
+ (list (read-file-name
+ (format "Diff %s with%s: "
+ (file-name-nondirectory current)
+ (if oldf
+ (concat " (default "
+ (file-name-nondirectory oldf)
+ ")")
+ ""))
+ dir oldf t)
+ (if current-prefix-arg
+ (read-string "Options for diff: "
+ (if (stringp diff-switches)
+ diff-switches
+ (mapconcat 'identity diff-switches " ")))))))
(let ((current (dired-get-filename t)))
(when (or (equal (expand-file-name file)
(expand-file-name current))
@@ -257,7 +244,10 @@ List has a form of (file-name full-file-name (attribute-list))."
(function dired-check-process)
(append
(list operation program)
- (unless (string-equal new-attribute "")
+ (unless (or (string-equal new-attribute "")
+ ;; Use `eq' instead of `equal'
+ ;; to detect empty input (bug#12399).
+ (eq new-attribute default))
(if (eq op-symbol 'touch)
(list "-t" new-attribute)
(list new-attribute)))
@@ -291,7 +281,10 @@ Symbolic modes like `g+w' are allowed."
"Change mode of %s to: "
nil 'chmod arg files default))
num-modes)
- (cond ((equal modes "")
+ (cond ((or (equal modes "")
+ ;; Use `eq' instead of `equal'
+ ;; to detect empty input (bug#12399).
+ (eq modes default))
;; We used to treat empty input as DEFAULT, but that is not
;; such a good idea (Bug#9361).
(error "No file mode specified"))
diff --git a/lisp/dired.el b/lisp/dired.el
index 5ae0e02617..54921a4ea6 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1410,7 +1410,6 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(define-key map "&" 'dired-do-async-shell-command)
;; Comparison commands
(define-key map "=" 'dired-diff)
- (define-key map "\M-=" 'dired-backup-diff)
;; Tree Dired commands
(define-key map "\M-\C-?" 'dired-unmark-all-files)
(define-key map "\M-\C-d" 'dired-tree-down)
@@ -2973,36 +2972,43 @@ If t, confirmation is never needed."
(const shell) (const symlink) (const touch)
(const uncompress))))
-(defun dired-mark-pop-up (bufname op-symbol files function &rest args)
+(defun dired-mark-pop-up (buffer-or-name op-symbol files function &rest args)
"Return FUNCTION's result on ARGS after showing which files are marked.
-Displays the file names in a buffer named BUFNAME;
- nil gives \" *Marked Files*\".
-This uses function `dired-pop-to-buffer' to do that.
-
-FUNCTION should not manipulate files, just read input
- (an argument or confirmation).
-The window is not shown if there is just one file or
- OP-SYMBOL is a member of the list in `dired-no-confirm'.
+Displays the file names in a window showing a buffer named
+BUFFER-OR-NAME; the default name being \" *Marked Files*\". The
+window is not shown if there is just one file, `dired-no-confirm'
+is t, or OP-SYMBOL is a member of the list in `dired-no-confirm'.
+
FILES is the list of marked files. It can also be (t FILENAME)
in the case of one marked file, to distinguish that from using
-just the current file."
- (or bufname (setq bufname " *Marked Files*"))
+just the current file.
+
+FUNCTION should not manipulate files, just read input \(an
+argument or confirmation)."
(if (or (eq dired-no-confirm t)
(memq op-symbol dired-no-confirm)
;; If FILES defaulted to the current line's file.
(= (length files) 1))
(apply function args)
- (with-current-buffer (get-buffer-create bufname)
- (erase-buffer)
- ;; Handle (t FILE) just like (FILE), here.
- ;; That value is used (only in some cases), to mean
- ;; just one file that was marked, rather than the current line file.
- (dired-format-columns-of-files (if (eq (car files) t) (cdr files) files))
- (remove-text-properties (point-min) (point-max)
- '(mouse-face nil help-echo nil)))
- (save-window-excursion
- (dired-pop-to-buffer bufname)
- (apply function args))))
+ (let ((buffer (get-buffer-create (or buffer-or-name " *Marked Files*"))))
+ (with-current-buffer buffer
+ (let ((split-height-threshold 0))
+ (with-temp-buffer-window
+ buffer
+ (cons 'display-buffer-below-selected nil)
+ #'(lambda (window _value)
+ (with-selected-window window
+ (unwind-protect
+ (apply function args)
+ (when (window-live-p window)
+ (quit-restore-window window 'kill)))))
+ ;; Handle (t FILE) just like (FILE), here. That value is
+ ;; used (only in some cases), to mean just one file that was
+ ;; marked, rather than the current line file.
+ (dired-format-columns-of-files
+ (if (eq (car files) t) (cdr files) files))
+ (remove-text-properties (point-min) (point-max)
+ '(mouse-face nil help-echo nil))))))))
(defun dired-format-columns-of-files (files)
(let ((beg (point)))
@@ -3738,14 +3744,15 @@ 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" "9499f79f5853da0aa93d26465c7bf3a1")
+;;;;;; dired-diff) "dired-aux" "dired-aux.el" "3c768e470d5d053d0049e0286ce38da7")
;;; Generated autoloads from dired-aux.el
(autoload 'dired-diff "dired-aux" "\
Compare file at point with file FILE using `diff'.
-FILE defaults to the file at the mark. (That's the mark set by
-\\[set-mark-command], not by Dired's \\[dired-mark] command.)
-The prompted-for FILE is the first file given to `diff'.
+If called interactively, prompt for FILE; if the file at point
+has a backup file, use that as the default.
+
+FILE is the first file given to `diff'.
With prefix arg, prompt for second argument SWITCHES,
which is the string of command switches for `diff'.
diff --git a/lisp/ehelp.el b/lisp/ehelp.el
index abb897f73f..281148d9cf 100644
--- a/lisp/ehelp.el
+++ b/lisp/ehelp.el
@@ -193,7 +193,9 @@ BUFFER is put back into its original major mode."
(replace-buffer-in-windows buffer)
;; must do this outside of save-window-excursion
(bury-buffer buffer))
- (eval electric-help-form-to-execute))))
+ (if (functionp electric-help-form-to-execute)
+ (funcall electric-help-form-to-execute)
+ (eval electric-help-form-to-execute)))))
(defun electric-help-command-loop ()
(catch 'exit
@@ -349,14 +351,19 @@ will select it.)"
;; continues with execute-extended-command.
(defun electric-help-execute-extended (_prefixarg)
(interactive "p")
- (setq electric-help-form-to-execute '(execute-extended-command nil))
+ (setq electric-help-form-to-execute
+ (lambda () (execute-extended-command nil)))
(electric-help-retain))
;; This is to be buond to C-x in ehelp mode. Retains ehelp buffer and then
;; continues with ctrl-x prefix.
(defun electric-help-ctrl-x-prefix (_prefixarg)
(interactive "p")
- (setq electric-help-form-to-execute '(progn (message nil) (setq unread-command-char ?\C-x)))
+ (setq electric-help-form-to-execute
+ (lambda ()
+ (message nil)
+ (setq unread-command-events
+ (append unread-command-events '(?\C-x)))))
(electric-help-retain))
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index cac76d2bce..d96076d17a 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -1,4 +1,4 @@
-;;; advice.el --- an overloading mechanism for Emacs Lisp functions
+;;; advice.el --- An overloading mechanism for Emacs Lisp functions
;; Copyright (C) 1993-1994, 2000-2012 Free Software Foundation, Inc.
@@ -1746,7 +1746,8 @@
(provide 'advice-preload)
;; During a normal load this is a noop:
(require 'advice-preload "advice.el")
-
+(require 'macroexp)
+(eval-when-compile (require 'cl-lib))
;; @@ Variable definitions:
;; ========================
@@ -1812,54 +1813,6 @@ generates a copy of TREE."
(funcall fUnCtIoN tReE))
(t tReE)))
-;; this is just faster than `ad-substitute-tree':
-(defun ad-copy-tree (tree)
- "Return a copy of the list structure of TREE."
- (cond ((consp tree)
- (cons (ad-copy-tree (car tree))
- (ad-copy-tree (cdr tree))))
- (t tree)))
-
-(defmacro ad-dolist (varform &rest body)
- "A Common-Lisp-style dolist iterator with the following syntax:
-
- (ad-dolist (VAR INIT-FORM [RESULT-FORM])
- BODY-FORM...)
-
-which will iterate over the list yielded by INIT-FORM binding VAR to the
-current head at every iteration. If RESULT-FORM is supplied its value will
-be returned at the end of the iteration, nil otherwise. The iteration can be
-exited prematurely with `(ad-do-return [VALUE])'."
- (let ((expansion
- `(let ((ad-dO-vAr ,(car (cdr varform)))
- ,(car varform))
- (while ad-dO-vAr
- (setq ,(car varform) (car ad-dO-vAr))
- ,@body
- ;;work around a backquote bug:
- ;;(` ((,@ '(foo)) (bar))) => (append '(foo) '(((bar)))) wrong
- ;;(` ((,@ '(foo)) (, '(bar)))) => (append '(foo) (list '(bar)))
- ,'(setq ad-dO-vAr (cdr ad-dO-vAr)))
- ,(car (cdr (cdr varform))))))
- ;;ok, this wastes some cons cells but only during compilation:
- (if (catch 'contains-return
- (ad-substitute-tree
- (function (lambda (subtree)
- (cond ((eq (car-safe subtree) 'ad-dolist))
- ((eq (car-safe subtree) 'ad-do-return)
- (throw 'contains-return t)))))
- 'identity body)
- nil)
- `(catch 'ad-dO-eXiT ,expansion)
- expansion)))
-
-(defmacro ad-do-return (value)
- `(throw 'ad-dO-eXiT ,value))
-
-(if (not (get 'ad-dolist 'lisp-indent-hook))
- (put 'ad-dolist 'lisp-indent-hook 1))
-
-
;; @@ Save real definitions of subrs used by Advice:
;; =================================================
;; Advice depends on the real, unmodified functionality of various subrs,
@@ -1924,16 +1877,16 @@ exited prematurely with `(ad-do-return [VALUE])'."
ad-advised-functions)))
(defmacro ad-do-advised-functions (varform &rest body)
- "`ad-dolist'-style iterator that maps over `ad-advised-functions'.
+ "`dolist'-style iterator that maps over `ad-advised-functions'.
\(ad-do-advised-functions (VAR [RESULT-FORM])
BODY-FORM...)
On each iteration VAR will be bound to the name of an advised function
\(a symbol)."
- `(ad-dolist (,(car varform)
+ `(cl-dolist (,(car varform)
ad-advised-functions
,(car (cdr varform)))
- (setq ,(car varform) (intern (car ,(car varform))))
- ,@body))
+ (setq ,(car varform) (intern (car ,(car varform))))
+ ,@body))
(if (not (get 'ad-do-advised-functions 'lisp-indent-hook))
(put 'ad-do-advised-functions 'lisp-indent-hook 1))
@@ -1948,7 +1901,7 @@ On each iteration VAR will be bound to the name of an advised function
`(put ,function 'ad-advice-info ,advice-info))
(defmacro ad-copy-advice-info (function)
- `(ad-copy-tree (get ,function 'ad-advice-info)))
+ `(copy-tree (get ,function 'ad-advice-info)))
(defmacro ad-is-advised (function)
"Return non-nil if FUNCTION has any advice info associated with it.
@@ -2022,8 +1975,8 @@ either t or nil, and DEFINITION should be a list of the form
(defun ad-has-enabled-advice (function class)
"True if at least one of FUNCTION's advices in CLASS is enabled."
- (ad-dolist (advice (ad-get-advice-info-field function class))
- (if (ad-advice-enabled advice) (ad-do-return t))))
+ (cl-dolist (advice (ad-get-advice-info-field function class))
+ (if (ad-advice-enabled advice) (cl-return t))))
(defun ad-has-redefining-advice (function)
"True if FUNCTION's advice info defines at least 1 redefining advice.
@@ -2036,14 +1989,14 @@ Redefining advices affect the construction of an advised definition."
(defun ad-has-any-advice (function)
"True if the advice info of FUNCTION defines at least one advice."
(and (ad-is-advised function)
- (ad-dolist (class ad-advice-classes nil)
+ (cl-dolist (class ad-advice-classes nil)
(if (ad-get-advice-info-field function class)
- (ad-do-return t)))))
+ (cl-return t)))))
(defun ad-get-enabled-advices (function class)
"Return the list of enabled advices of FUNCTION in CLASS."
(let (enabled-advices)
- (ad-dolist (advice (ad-get-advice-info-field function class))
+ (dolist (advice (ad-get-advice-info-field function class))
(if (ad-advice-enabled advice)
(push advice enabled-advices)))
(reverse enabled-advices)))
@@ -2151,7 +2104,7 @@ function at point for which PREDICATE returns non-nil)."
(ad-do-advised-functions (function)
(if (or (null predicate)
(funcall predicate function))
- (ad-do-return function)))
+ (cl-return function)))
(error "ad-read-advised-function: %s"
"There are no qualifying advised functions")))
(let* ((ad-pReDiCaTe predicate)
@@ -2184,9 +2137,9 @@ be returned on empty input (defaults to the first non-empty advice
class of FUNCTION)."
(setq default
(or default
- (ad-dolist (class ad-advice-classes)
+ (cl-dolist (class ad-advice-classes)
(if (ad-get-advice-info-field function class)
- (ad-do-return class)))
+ (cl-return class)))
(error "ad-read-advice-class: `%s' has no advices" function)))
(let ((class (completing-read
(format "%s (default %s): " (or prompt "Class") default)
@@ -2255,18 +2208,18 @@ NAME can be a symbol or a regular expression matching part of an advice name.
If CLASS is `any' all valid advice classes will be checked."
(if (ad-is-advised function)
(let (found-advice)
- (ad-dolist (advice-class ad-advice-classes)
+ (cl-dolist (advice-class ad-advice-classes)
(if (or (eq class 'any) (eq advice-class class))
(setq found-advice
- (ad-dolist (advice (ad-get-advice-info-field
+ (cl-dolist (advice (ad-get-advice-info-field
function advice-class))
(if (or (and (stringp name)
(string-match
name (symbol-name
(ad-advice-name advice))))
(eq name (ad-advice-name advice)))
- (ad-do-return advice)))))
- (if found-advice (ad-do-return found-advice))))))
+ (cl-return advice)))))
+ (if found-advice (cl-return found-advice))))))
(defun ad-enable-advice-internal (function class name flag)
"Set enable FLAG of FUNCTION's advices in CLASS matching NAME.
@@ -2277,10 +2230,10 @@ considered. The number of changed advices will be returned (or nil if
FUNCTION was not advised)."
(if (ad-is-advised function)
(let ((matched-advices 0))
- (ad-dolist (advice-class ad-advice-classes)
+ (dolist (advice-class ad-advice-classes)
(if (or (eq class 'any) (eq advice-class class))
- (ad-dolist (advice (ad-get-advice-info-field
- function advice-class))
+ (dolist (advice (ad-get-advice-info-field
+ function advice-class))
(cond ((or (and (stringp name)
(string-match
name (symbol-name (ad-advice-name advice))))
@@ -2586,11 +2539,6 @@ For that it has to be fbound with a non-autoload definition."
(byte-compile symbol)
(fset function (symbol-function symbol))))))
-(defun ad-prognify (forms)
- (cond ((<= (length forms) 1)
- (car forms))
- (t (cons 'progn forms))))
-
;; @@@ Accessing argument lists:
;; =============================
@@ -2868,8 +2816,8 @@ in any of these classes."
(if origdoc (setq paragraphs (list origdoc)))
(unless (eq style 'plain)
(push (concat "This " origtype " is advised.") paragraphs))
- (ad-dolist (class ad-advice-classes)
- (ad-dolist (advice (ad-get-enabled-advices function class))
+ (dolist (class ad-advice-classes)
+ (dolist (advice (ad-get-enabled-advices function class))
(setq advice-docstring
(ad-make-single-advice-docstring advice class style))
(if advice-docstring
@@ -2891,24 +2839,24 @@ in any of these classes."
(defun ad-advised-arglist (function)
"Find first defined arglist in FUNCTION's redefining advices."
- (ad-dolist (advice (append (ad-get-enabled-advices function 'before)
+ (cl-dolist (advice (append (ad-get-enabled-advices function 'before)
(ad-get-enabled-advices function 'around)
(ad-get-enabled-advices function 'after)))
(let ((arglist (ad-arglist (ad-advice-definition advice))))
(if arglist
;; We found the first one, use it:
- (ad-do-return arglist)))))
+ (cl-return arglist)))))
(defun ad-advised-interactive-form (function)
"Find first interactive form in FUNCTION's redefining advices."
- (ad-dolist (advice (append (ad-get-enabled-advices function 'before)
+ (cl-dolist (advice (append (ad-get-enabled-advices function 'before)
(ad-get-enabled-advices function 'around)
(ad-get-enabled-advices function 'after)))
(let ((interactive-form
(ad-interactive-form (ad-advice-definition advice))))
(if interactive-form
;; We found the first one, use it:
- (ad-do-return interactive-form)))))
+ (cl-return interactive-form)))))
;; @@@ Putting it all together:
;; ============================
@@ -2997,47 +2945,47 @@ and BEFORES, AROUNDS and AFTERS are the lists of advices with which ORIG
should be modified. The assembled function will be returned."
(let (before-forms around-form around-form-protected after-forms definition)
- (ad-dolist (advice befores)
- (cond ((and (ad-advice-protected advice)
- before-forms)
- (setq before-forms
- `((unwind-protect
- ,(ad-prognify before-forms)
- ,@(ad-body-forms
- (ad-advice-definition advice))))))
- (t (setq before-forms
- (append before-forms
- (ad-body-forms (ad-advice-definition advice)))))))
+ (dolist (advice befores)
+ (cond ((and (ad-advice-protected advice)
+ before-forms)
+ (setq before-forms
+ `((unwind-protect
+ ,(macroexp-progn before-forms)
+ ,@(ad-body-forms
+ (ad-advice-definition advice))))))
+ (t (setq before-forms
+ (append before-forms
+ (ad-body-forms (ad-advice-definition advice)))))))
(setq around-form `(setq ad-return-value ,orig))
- (ad-dolist (advice (reverse arounds))
- ;; If any of the around advices is protected then we
- ;; protect the complete around advice onion:
- (if (ad-advice-protected advice)
- (setq around-form-protected t))
- (setq around-form
- (ad-substitute-tree
- (function (lambda (form) (eq form 'ad-do-it)))
- (function (lambda (form) around-form))
- (ad-prognify (ad-body-forms (ad-advice-definition advice))))))
+ (dolist (advice (reverse arounds))
+ ;; If any of the around advices is protected then we
+ ;; protect the complete around advice onion:
+ (if (ad-advice-protected advice)
+ (setq around-form-protected t))
+ (setq around-form
+ (ad-substitute-tree
+ (function (lambda (form) (eq form 'ad-do-it)))
+ (function (lambda (form) around-form))
+ (macroexp-progn (ad-body-forms (ad-advice-definition advice))))))
(setq after-forms
(if (and around-form-protected before-forms)
`((unwind-protect
- ,(ad-prognify before-forms)
+ ,(macroexp-progn before-forms)
,around-form))
(append before-forms (list around-form))))
- (ad-dolist (advice afters)
- (cond ((and (ad-advice-protected advice)
- after-forms)
- (setq after-forms
- `((unwind-protect
- ,(ad-prognify after-forms)
- ,@(ad-body-forms
- (ad-advice-definition advice))))))
- (t (setq after-forms
- (append after-forms
- (ad-body-forms (ad-advice-definition advice)))))))
+ (dolist (advice afters)
+ (cond ((and (ad-advice-protected advice)
+ after-forms)
+ (setq after-forms
+ `((unwind-protect
+ ,(macroexp-progn after-forms)
+ ,@(ad-body-forms
+ (ad-advice-definition advice))))))
+ (t (setq after-forms
+ (append after-forms
+ (ad-body-forms (ad-advice-definition advice)))))))
(setq definition
`(,@(if (memq type '(macro special-form)) '(macro))
@@ -3061,7 +3009,7 @@ should be modified. The assembled function will be returned."
(ad-body-forms (ad-advice-definition advice))))
(ad-get-enabled-advices function hook-name))))
(if hook-forms
- (ad-prognify (apply 'append hook-forms)))))
+ (macroexp-progn (apply 'append hook-forms)))))
;; @@ Caching:
@@ -3171,11 +3119,11 @@ advised definition from scratch."
(nth 2 cache-id)))))
(defun ad-verify-cache-class-id (cache-class-id advices)
- (ad-dolist (advice advices (null cache-class-id))
+ (cl-dolist (advice advices (null cache-class-id))
(if (ad-advice-enabled advice)
(if (eq (car cache-class-id) (ad-advice-name advice))
(setq cache-class-id (cdr cache-class-id))
- (ad-do-return nil)))))
+ (cl-return nil)))))
;; There should be a way to monitor if and why a cache verification failed
;; in order to determine whether a certain preactivation could be used or
@@ -3670,7 +3618,16 @@ See Info node `(elisp)Advising Functions' for comprehensive documentation.
usage: (defadvice FUNCTION (CLASS NAME [POSITION] [ARGLIST] FLAG...)
[DOCSTRING] [INTERACTIVE-FORM]
BODY...)"
- (declare (doc-string 3))
+ (declare (doc-string 3)
+ (debug (&define name ;; thing being advised.
+ (name ;; class is [&or "before" "around" "after"
+ ;; "activation" "deactivation"]
+ name ;; name of advice
+ &rest sexp ;; optional position and flags
+ )
+ [&optional stringp]
+ [&optional ("interactive" interactive)]
+ def-body)))
(if (not (ad-name-p function))
(error "defadvice: Invalid function name: %s" function))
(let* ((class (car args))
diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el
index 646be3e1b7..9029c81f27 100644
--- a/lisp/emacs-lisp/benchmark.el
+++ b/lisp/emacs-lisp/benchmark.el
@@ -53,6 +53,7 @@ FORMS once.
Return a list of the total elapsed time for execution, the number of
garbage collections that ran, and the time taken by garbage collection.
See also `benchmark-run-compiled'."
+ (declare (indent 1) (debug t))
(unless (natnump repetitions)
(setq forms (cons repetitions forms)
repetitions 1))
@@ -69,8 +70,6 @@ See also `benchmark-run-compiled'."
`(benchmark-elapse ,@forms))
(- gcs-done ,gcs)
(- gc-elapsed ,gc)))))
-(put 'benchmark-run 'edebug-form-spec t)
-(put 'benchmark-run 'lisp-indent-function 2)
;;;###autoload
(defmacro benchmark-run-compiled (&optional repetitions &rest forms)
@@ -78,6 +77,7 @@ See also `benchmark-run-compiled'."
This is like `benchmark-run', but what is timed is a funcall of the
byte code obtained by wrapping FORMS in a `lambda' and compiling the
result. The overhead of the `lambda's is accounted for."
+ (declare (indent 1) (debug t))
(unless (natnump repetitions)
(setq forms (cons repetitions forms)
repetitions 1))
@@ -96,8 +96,6 @@ result. The overhead of the `lambda's is accounted for."
(funcall ,lambda-code))))
`(benchmark-elapse (funcall ,code)))
(- gcs-done ,gcs) (- gc-elapsed ,gc)))))
-(put 'benchmark-run-compiled 'edebug-form-spec t)
-(put 'benchmark-run-compiled 'lisp-indent-function 2)
;;;###autoload
(defun benchmark (repetitions form)
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 9b66c8ffd6..93e890a20c 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -185,11 +185,10 @@ The return value is undefined.
((and (featurep 'cl)
(memq (car x) ;C.f. cl-do-proclaim.
'(special inline notinline optimize warn)))
- (if (null (stringp docstring))
- (push (list 'declare x) body)
- (setcdr body (cons (list 'declare x) (cdr body))))
+ (push (list 'declare x)
+ (if (stringp docstring) (cdr body) body))
nil)
- (t (message "Warning: Unknown defun property %S in %S"
+ (t (message "Warning: Unknown defun property `%S' in %S"
(car x) name)))))
decls))
(def (list 'defalias
@@ -313,7 +312,7 @@ This uses `defvaralias' and `make-obsolete-variable' (which see).
See the Info node `(elisp)Variable Aliases' for more details.
If CURRENT-NAME is a defcustom (more generally, any variable
-where OBSOLETE-NAME may be set, e.g. in a .emacs file, before the
+where OBSOLETE-NAME may be set, e.g. in an init file, before the
alias is defined), then the define-obsolete-variable-alias
statement should be evaluated before the defcustom, if user
customizations are to be respected. The simplest way to achieve
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 10bc37c6dc..c42ae21aae 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1016,6 +1016,10 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
((bufferp byte-compile-current-file)
(format "Buffer %s:"
(buffer-name byte-compile-current-file)))
+ ;; We might be simply loading a file that
+ ;; contains explicit calls to byte-compile functions.
+ ((stringp load-file-name)
+ (format "%s:" (file-relative-name load-file-name dir)))
(t "")))
(pos (if (and byte-compile-current-file
(integerp byte-compile-read-position))
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 532c81c502..5749ff91b4 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -121,7 +121,7 @@ a future Emacs interpreter will be able to use it.")
;;; Generalized variables.
;; These macros are defined here so that they
-;; can safely be used in .emacs files.
+;; can safely be used in init files.
(defmacro cl-incf (place &optional x)
"Increment PLACE by X (1 by default).
diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el
index 470ca17d3a..c12e8ccacb 100644
--- a/lisp/emacs-lisp/cl-loaddefs.el
+++ b/lisp/emacs-lisp/cl-loaddefs.el
@@ -249,8 +249,7 @@ Remove from SYMBOL's plist the property PROPNAME and its value.
;;;***
-;;;### (autoloads (cl--compiler-macro-cXXr cl--compiler-macro-list*
-;;;;;; cl--compiler-macro-adjoin cl-defsubst cl-compiler-macroexpand
+;;;### (autoloads (cl--compiler-macro-adjoin cl-defsubst cl-compiler-macroexpand
;;;;;; cl-define-compiler-macro cl-assert cl-check-type cl-typep
;;;;;; cl-deftype cl-defstruct cl-callf2 cl-callf cl-letf* cl-letf
;;;;;; cl-rotatef cl-shiftf cl-remf cl-psetf cl-declare cl-the cl-locally
@@ -260,9 +259,20 @@ Remove from SYMBOL's plist the property PROPNAME and its value.
;;;;;; cl-do cl-loop cl-return-from cl-return cl-block cl-etypecase
;;;;;; cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when
;;;;;; cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp
-;;;;;; cl-gensym) "cl-macs" "cl-macs.el" "9676d5517e8b9246c09fe78984c68bef")
+;;;;;; cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*)
+;;;;;; "cl-macs" "cl-macs.el" "6d0676869af66e5b5a671f95ee069461")
;;; Generated autoloads from cl-macs.el
+(autoload 'cl--compiler-macro-list* "cl-macs" "\
+
+
+\(fn FORM ARG &rest OTHERS)" nil nil)
+
+(autoload 'cl--compiler-macro-cXXr "cl-macs" "\
+
+
+\(fn FORM X)" nil nil)
+
(autoload 'cl-gensym "cl-macs" "\
Generate a new uninterned symbol.
The name is made by appending a number to PREFIX, default \"G\".
@@ -659,6 +669,8 @@ value, that slot cannot be set via `setf'.
(put 'cl-defstruct 'doc-string-elt '2)
+(put 'cl-defstruct 'lisp-indent-function '1)
+
(autoload 'cl-deftype "cl-macs" "\
Define NAME as a new data type.
The type name can then be used in `cl-typecase', `cl-check-type', etc.
@@ -722,16 +734,6 @@ surrounded by (cl-block NAME ...).
\(fn FORM A LIST &rest KEYS)" nil nil)
-(autoload 'cl--compiler-macro-list* "cl-macs" "\
-
-
-\(fn FORM ARG &rest OTHERS)" nil nil)
-
-(autoload 'cl--compiler-macro-cXXr "cl-macs" "\
-
-
-\(fn FORM X)" nil nil)
-
;;;***
;;;### (autoloads (cl-tree-equal cl-nsublis cl-sublis cl-nsubst-if-not
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 9a59aa0c6d..16ac14f8fe 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -58,6 +58,33 @@
;;; Initialization.
+;; Place compiler macros at the beginning, otherwise uses of the corresponding
+;; functions can lead to recursive-loads that prevent the calls from
+;; being optimized.
+
+;;;###autoload
+(defun cl--compiler-macro-list* (_form arg &rest others)
+ (let* ((args (reverse (cons arg others)))
+ (form (car args)))
+ (while (setq args (cdr args))
+ (setq form `(cons ,(car args) ,form)))
+ form))
+
+;;;###autoload
+(defun cl--compiler-macro-cXXr (form x)
+ (let* ((head (car form))
+ (n (symbol-name (car form)))
+ (i (- (length n) 2)))
+ (if (not (string-match "c[ad]+r\\'" n))
+ (if (and (fboundp head) (symbolp (symbol-function head)))
+ (cl--compiler-macro-cXXr (cons (symbol-function head) (cdr form))
+ x)
+ (error "Compiler macro for cXXr applied to non-cXXr form"))
+ (while (> i (match-beginning 0))
+ (setq x (list (if (eq (aref n i) ?a) 'car 'cdr) x))
+ (setq i (1- i)))
+ x)))
+
;;; Some predicates for analyzing Lisp forms.
;; These are used by various
;; macro expanders to optimize the results in certain common cases.
@@ -366,9 +393,14 @@ its argument list allows full Common Lisp conventions."
(mapcar (lambda (x)
(cond
((symbolp x)
- (if (eq ?\& (aref (symbol-name x) 0))
- (setq state x)
- (make-symbol (upcase (symbol-name x)))))
+ (let ((first (aref (symbol-name x) 0)))
+ (if (eq ?\& first)
+ (setq state x)
+ ;; Strip a leading underscore, since it only
+ ;; means that this argument is unused.
+ (make-symbol (upcase (if (eq ?_ first)
+ (substring (symbol-name x) 1)
+ (symbol-name x)))))))
((not (consp x)) x)
((memq state '(nil &rest)) (cl--make-usage-args x))
(t ;(VAR INITFORM SVAR) or ((KEYWORD VAR) INITFORM SVAR).
@@ -452,7 +484,13 @@ its argument list allows full Common Lisp conventions."
(let ((arg (pop args)))
(or (consp arg) (setq arg (list arg)))
(let* ((karg (if (consp (car arg)) (caar arg)
- (intern (format ":%s" (car arg)))))
+ (let ((name (symbol-name (car arg))))
+ ;; Strip a leading underscore, since it only
+ ;; means that this argument is unused, but
+ ;; shouldn't affect the key's name (bug#12367).
+ (if (eq ?_ (aref name 0))
+ (setq name (substring name 1)))
+ (intern (format ":%s" name)))))
(varg (if (consp (car arg)) (cl-cadar arg) (car arg)))
(def (if (cdr arg) (cadr arg)
(or (car cl--bind-defs) (cadr (assq varg cl--bind-defs)))))
@@ -1425,8 +1463,15 @@ Valid clauses are:
cl--loop-accum-var))))
(defun cl--loop-build-ands (clauses)
+ "Return various representations of (and . CLAUSES).
+CLAUSES is a list of Elisp expressions, where clauses of the form
+\(progn E1 E2 E3 .. t) are the focus of particular optimizations.
+The return value has shape (COND BODY COMBO)
+such that COMBO is equivalent to (and . CLAUSES)."
(let ((ands nil)
(body nil))
+ ;; Look through `clauses', trying to optimize (progn ,@A t) (progn ,@B) ,@C
+ ;; into (progn ,@A ,@B) ,@C.
(while clauses
(if (and (eq (car-safe (car clauses)) 'progn)
(eq (car (last (car clauses))) t))
@@ -1437,6 +1482,7 @@ Valid clauses are:
(cl-cdadr clauses)
(list (cadr clauses))))
(cddr clauses)))
+ ;; A final (progn ,@A t) is moved outside of the `and'.
(setq body (cdr (butlast (pop clauses)))))
(push (pop clauses) ands)))
(setq ands (or (nreverse ands) (list t)))
@@ -1905,8 +1951,6 @@ See Info node `(cl)Declarations' for details."
(cl-do-proclaim (pop specs) nil)))
nil)
-
-
;;; The standard modify macros.
;; `setf' is now part of core Elisp, defined in gv.el.
@@ -1929,7 +1973,7 @@ before assigning any PLACEs to the corresponding values.
(or p (error "Odd number of arguments to cl-psetf"))
(pop p))
(if simple
- `(progn (setf ,@args) nil)
+ `(progn (setq ,@args) nil)
(setq args (reverse args))
(let ((expr `(setf ,(cadr args) ,(car args))))
(while (setq args (cddr args))
@@ -2119,7 +2163,7 @@ one keyword is supported, `:read-only'. If this has a non-nil
value, that slot cannot be set via `setf'.
\(fn NAME SLOTS...)"
- (declare (doc-string 2)
+ (declare (doc-string 2) (indent 1)
(debug
(&define ;Makes top-level form not be wrapped.
[&or symbolp
@@ -2597,14 +2641,6 @@ surrounded by (cl-block NAME ...).
`(if (cl-member ,a ,list ,@keys) ,list (cons ,a ,list))
form))
-;;;###autoload
-(defun cl--compiler-macro-list* (_form arg &rest others)
- (let* ((args (reverse (cons arg others)))
- (form (car args)))
- (while (setq args (cdr args))
- (setq form `(cons ,(car args) ,form)))
- form))
-
(defun cl--compiler-macro-get (_form sym prop &optional def)
(if def
`(cl-getf (symbol-plist ,sym) ,prop ,def)
@@ -2616,21 +2652,6 @@ surrounded by (cl-block NAME ...).
(cl--make-type-test temp (cl--const-expr-val type)))
form))
-;;;###autoload
-(defun cl--compiler-macro-cXXr (form x)
- (let* ((head (car form))
- (n (symbol-name (car form)))
- (i (- (length n) 2)))
- (if (not (string-match "c[ad]+r\\'" n))
- (if (and (fboundp head) (symbolp (symbol-function head)))
- (cl--compiler-macro-cXXr (cons (symbol-function head) (cdr form))
- x)
- (error "Compiler macro for cXXr applied to non-cXXr form"))
- (while (> i (match-beginning 0))
- (setq x (list (if (eq (aref n i) ?a) 'car 'cdr) x))
- (setq i (1- i)))
- x)))
-
(dolist (y '(cl-first cl-second cl-third cl-fourth
cl-fifth cl-sixth cl-seventh
cl-eighth cl-ninth cl-tenth
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 7bc93a19d1..774b4d3d60 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -48,6 +48,39 @@ the middle is discarded, and just the beginning and end are displayed."
:group 'debugger
:version "21.1")
+(defcustom debugger-bury-or-kill 'bury
+ "How to proceed with the debugger buffer when exiting `debug'.
+The value used here affects the behavior of operations on any
+window previously showing the debugger buffer.
+
+`nil' means that if its window is not deleted when exiting the
+ debugger, invoking `switch-to-prev-buffer' will usually show
+ the debugger buffer again.
+
+`append' means that if the window is not deleted, the debugger
+ buffer moves to the end of the window's previous buffers so
+ it's less likely that a future invocation of
+ `switch-to-prev-buffer' will switch to it. Also, it moves the
+ buffer to the end of the frame's buffer list.
+
+`bury' means that if the window is not deleted, its buffer is
+ removed from the window's list of previous buffers. Also, it
+ moves the buffer to the end of the frame's buffer list. This
+ value provides the most reliable remedy to not have
+ `switch-to-prev-buffer' switch to the debugger buffer again
+ without killing the buffer.
+
+`kill' means to kill the debugger buffer.
+
+The value used here is passed to `quit-restore-window'."
+ :type '(choice
+ (const :tag "Keep alive" nil)
+ (const :tag "Append" 'append)
+ (const :tag "Bury" 'bury)
+ (const :tag "Kill" 'kill))
+ :group 'debugger
+ :version "24.2")
+
(defvar debug-function-list nil
"List of functions currently set for debug on entry.")
@@ -60,6 +93,12 @@ the middle is discarded, and just the beginning and end are displayed."
(defvar debugger-old-buffer nil
"This is the buffer that was current when the debugger was entered.")
+(defvar debugger-previous-window nil
+ "This is the window last showing the debugger buffer.")
+
+(defvar debugger-previous-window-height nil
+ "The last recorded height of `debugger-previous-window'.")
+
(defvar debugger-previous-backtrace nil
"The contents of the previous backtrace (including text properties).
This is to optimize `debugger-make-xrefs'.")
@@ -71,10 +110,6 @@ This is to optimize `debugger-make-xrefs'.")
(defvar debugger-outer-track-mouse)
(defvar debugger-outer-last-command)
(defvar debugger-outer-this-command)
-;; unread-command-char is obsolete,
-;; but we still save and restore it
-;; in case some user program still tries to set it.
-(defvar debugger-outer-unread-command-char)
(defvar debugger-outer-unread-command-events)
(defvar debugger-outer-unread-post-input-method-events)
(defvar debugger-outer-last-input-event)
@@ -126,14 +161,12 @@ first will be printed into the backtrace buffer."
(unless noninteractive
(message "Entering debugger..."))
(let (debugger-value
- (debug-on-error nil)
- (debug-on-quit nil)
(debugger-previous-state
(if (get-buffer "*Backtrace*")
(with-current-buffer (get-buffer "*Backtrace*")
(list major-mode (buffer-string)))))
(debugger-buffer (get-buffer-create "*Backtrace*"))
- (debugger-old-buffer (current-buffer))
+ (debugger-window nil)
(debugger-step-after-exit nil)
(debugger-will-be-back nil)
;; Don't keep reading from an executing kbd macro!
@@ -148,8 +181,6 @@ first will be printed into the backtrace buffer."
(debugger-outer-track-mouse track-mouse)
(debugger-outer-last-command last-command)
(debugger-outer-this-command this-command)
- (debugger-outer-unread-command-char
- (with-no-warnings unread-command-char))
(debugger-outer-unread-command-events unread-command-events)
(debugger-outer-unread-post-input-method-events
unread-post-input-method-events)
@@ -184,78 +215,74 @@ first will be printed into the backtrace buffer."
(cursor-in-echo-area nil))
(unwind-protect
(save-excursion
- (save-window-excursion
- (with-no-warnings
- (setq unread-command-char -1))
- (when (eq (car debugger-args) 'debug)
- ;; Skip the frames for backtrace-debug, byte-code,
- ;; and implement-debug-on-entry.
- (backtrace-debug 4 t)
- ;; Place an extra debug-on-exit for macro's.
- (when (eq 'lambda (car-safe (cadr (backtrace-frame 4))))
- (backtrace-debug 5 t)))
- (pop-to-buffer debugger-buffer)
- (debugger-mode)
- (debugger-setup-buffer debugger-args)
- (when noninteractive
- ;; If the backtrace is long, save the beginning
- ;; and the end, but discard the middle.
- (when (> (count-lines (point-min) (point-max))
- debugger-batch-max-lines)
- (goto-char (point-min))
- (forward-line (/ 2 debugger-batch-max-lines))
- (let ((middlestart (point)))
- (goto-char (point-max))
- (forward-line (- (/ 2 debugger-batch-max-lines)
- debugger-batch-max-lines))
- (delete-region middlestart (point)))
- (insert "...\n"))
+ (when (eq (car debugger-args) 'debug)
+ ;; Skip the frames for backtrace-debug, byte-code,
+ ;; and implement-debug-on-entry.
+ (backtrace-debug 4 t)
+ ;; Place an extra debug-on-exit for macro's.
+ (when (eq 'lambda (car-safe (cadr (backtrace-frame 4))))
+ (backtrace-debug 5 t)))
+ (pop-to-buffer
+ debugger-buffer
+ `((display-buffer-reuse-window
+ display-buffer-in-previous-window)
+ . (,(when debugger-previous-window
+ `(previous-window . ,debugger-previous-window)))))
+ (setq debugger-window (selected-window))
+ (if (eq debugger-previous-window debugger-window)
+ (when debugger-jumping-flag
+ ;; Try to restore previous height of debugger
+ ;; window.
+ (condition-case nil
+ (window-resize
+ debugger-window
+ (- debugger-previous-window-height
+ (window-total-size debugger-window)))
+ (error nil)))
+ (setq debugger-previous-window debugger-window))
+ (debugger-mode)
+ (debugger-setup-buffer debugger-args)
+ (when noninteractive
+ ;; If the backtrace is long, save the beginning
+ ;; and the end, but discard the middle.
+ (when (> (count-lines (point-min) (point-max))
+ debugger-batch-max-lines)
(goto-char (point-min))
- (message "%s" (buffer-string))
- (kill-emacs -1))
+ (forward-line (/ 2 debugger-batch-max-lines))
+ (let ((middlestart (point)))
+ (goto-char (point-max))
+ (forward-line (- (/ 2 debugger-batch-max-lines)
+ debugger-batch-max-lines))
+ (delete-region middlestart (point)))
+ (insert "...\n"))
+ (goto-char (point-min))
+ (message "%s" (buffer-string))
+ (kill-emacs -1))
+ (message "")
+ (let ((standard-output nil)
+ (buffer-read-only t))
(message "")
- (let ((standard-output nil)
- (buffer-read-only t))
- (message "")
- ;; Make sure we unbind buffer-read-only in the right buffer.
- (save-excursion
- (recursive-edit)))))
- ;; Kill or at least neuter the backtrace buffer, so that users
- ;; don't try to execute debugger commands in an invalid context.
- (if (get-buffer-window debugger-buffer 0)
- ;; Still visible despite the save-window-excursion? Maybe it
- ;; it's in a pop-up frame. It would be annoying to delete and
- ;; recreate it every time the debugger stops, so instead we'll
- ;; erase it (and maybe hide it) but keep it alive.
- (with-current-buffer debugger-buffer
- (with-selected-window (get-buffer-window debugger-buffer 0)
- (when (and (window-dedicated-p (selected-window))
- (not debugger-will-be-back))
- ;; If the window is not dedicated, burying the buffer
- ;; will mean that the frame created for it is left
- ;; around showing some random buffer, and next time we
- ;; pop to the debugger buffer we'll create yet
- ;; another frame.
- ;; If debugger-will-be-back is non-nil, the frame
- ;; would need to be de-iconified anyway immediately
- ;; after when we re-enter the debugger, so iconifying it
- ;; here would cause flashing.
- ;; Drew Adams is not happy with this: he wants to frame
- ;; to be left at the top-level, still working on how
- ;; best to do that.
- (bury-buffer))))
- (unless debugger-previous-state
- (kill-buffer debugger-buffer)))
- ;; Restore the previous state of the debugger-buffer, in case we were
- ;; in a recursive invocation of the debugger.
- (when (buffer-live-p debugger-buffer)
- (with-current-buffer debugger-buffer
- (let ((inhibit-read-only t))
- (erase-buffer)
- (if (null debugger-previous-state)
- (fundamental-mode)
- (insert (nth 1 debugger-previous-state))
- (funcall (nth 0 debugger-previous-state))))))
+ ;; Make sure we unbind buffer-read-only in the right buffer.
+ (save-excursion
+ (recursive-edit))))
+ (when (and (window-live-p debugger-window)
+ (eq (window-buffer debugger-window) debugger-buffer))
+ ;; Record height of debugger window.
+ (setq debugger-previous-window-height
+ (window-total-size debugger-window))
+ ;; Unshow debugger-buffer.
+ (quit-restore-window debugger-window debugger-bury-or-kill))
+ ;; Restore previous state of debugger-buffer in case we were
+ ;; in a recursive invocation of the debugger, otherwise just
+ ;; erase the buffer and put it into fundamental mode.
+ (when (buffer-live-p debugger-buffer)
+ (with-current-buffer debugger-buffer
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (if (null debugger-previous-state)
+ (fundamental-mode)
+ (insert (nth 1 debugger-previous-state))
+ (funcall (nth 0 debugger-previous-state))))))
(with-timeout-unsuspend debugger-with-timeout-suspend)
(set-match-data debugger-outer-match-data)))
;; Put into effect the modified values of these variables
@@ -267,8 +294,6 @@ first will be printed into the backtrace buffer."
(setq track-mouse debugger-outer-track-mouse)
(setq last-command debugger-outer-last-command)
(setq this-command debugger-outer-this-command)
- (with-no-warnings
- (setq unread-command-char debugger-outer-unread-command-char))
(setq unread-command-events debugger-outer-unread-command-events)
(setq unread-post-input-method-events
debugger-outer-unread-post-input-method-events)
@@ -570,16 +595,7 @@ Applies to the frame whose line point is on in the backtrace."
(cursor-in-echo-area debugger-outer-cursor-in-echo-area))
(set-match-data debugger-outer-match-data)
(prog1
- (let ((save-ucc (with-no-warnings unread-command-char)))
- (unwind-protect
- (progn
- (with-no-warnings
- (setq unread-command-char debugger-outer-unread-command-char))
- (prog1 (progn ,@body)
- (with-no-warnings
- (setq debugger-outer-unread-command-char unread-command-char))))
- (with-no-warnings
- (setq unread-command-char save-ucc))))
+ (progn ,@body)
(setq debugger-outer-match-data (match-data))
(setq debugger-outer-load-read-function load-read-function)
(setq debugger-outer-overriding-terminal-local-map
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index 7f9f8a3363..939fab7894 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -148,7 +148,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))
+ (declare (indent defun) (debug (symbolp body)))
`(progn
,(if symbol `(defvar ,symbol nil ,doc))
(easy-menu-do-define (quote ,symbol) ,maps ,doc ,menu)))
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 7fcd339d6d..d656dcf952 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -1,4 +1,4 @@
-;;; edebug.el --- a source-level debugger for Emacs Lisp
+;;; edebug.el --- a source-level debugger for Emacs Lisp -*- lexical-binding: t -*-
;; Copyright (C) 1988-1995, 1997, 1999-2012 Free Software Foundation, Inc.
@@ -52,10 +52,7 @@
;;; Code:
(require 'macroexp)
-
-;;; Bug reporting
-
-(defalias 'edebug-submit-bug-report 'report-emacs-bug)
+(eval-when-compile (require 'cl-lib))
;;; Options
@@ -235,14 +232,9 @@ If the result is non-nil, then break. Errors are ignored."
;;; Form spec utilities.
-(defmacro def-edebug-form-spec (symbol spec-form)
- "For compatibility with old version."
- (def-edebug-spec symbol (eval spec-form)))
-(make-obsolete 'def-edebug-form-spec 'def-edebug-spec "22.1")
-
(defun get-edebug-spec (symbol)
;; Get the spec of symbol resolving all indirection.
- (let ((edebug-form-spec nil)
+ (let ((spec nil)
(indirect symbol))
(while
(progn
@@ -250,9 +242,8 @@ If the result is non-nil, then break. Errors are ignored."
(setq indirect
(function-get indirect 'edebug-form-spec 'macro))))
;; (edebug-trace "indirection: %s" edebug-form-spec)
- (setq edebug-form-spec indirect))
- edebug-form-spec
- ))
+ (setq spec indirect))
+ spec))
;;;###autoload
(defun edebug-basic-spec (spec)
@@ -342,9 +333,7 @@ A lambda list keyword is a symbol that starts with `&'."
(lambda (e1 e2)
(funcall function (car e1) (car e2))))))
-;;(def-edebug-spec edebug-save-restriction t)
-
-;; Not used. If it is used, def-edebug-spec must be defined before use.
+;; Not used.
'(defmacro edebug-save-restriction (&rest body)
"Evaluate BODY while saving the current buffers restriction.
BODY may change buffer outside of current restriction, unlike
@@ -352,6 +341,7 @@ save-restriction. BODY may change the current buffer,
and the restriction will be restored to the original buffer,
and the current buffer remains current.
Return the result of the last expression in BODY."
+ (declare (debug t))
`(let ((edebug:s-r-beg (point-min-marker))
(edebug:s-r-end (point-max-marker)))
(unwind-protect
@@ -369,6 +359,7 @@ Return the result of the last expression in BODY."
;; Select WINDOW if it is provided and still exists. Otherwise,
;; if buffer is currently shown in several windows, choose one.
;; Otherwise, find a new window, possibly splitting one.
+ ;; FIXME: We should probably just be using `pop-to-buffer'.
(setq window
(cond
((and (edebug-window-live-p window)
@@ -377,7 +368,7 @@ Return the result of the last expression in BODY."
((eq (window-buffer (selected-window)) buffer)
;; Selected window already displays BUFFER.
(selected-window))
- ((edebug-get-buffer-window buffer))
+ ((get-buffer-window buffer 0))
((one-window-p 'nomini)
;; When there's one window only, split it.
(split-window))
@@ -450,18 +441,14 @@ Return the result of the last expression in BODY."
window-info)
(set-window-configuration window-info)))
-(defalias 'edebug-get-buffer-window 'get-buffer-window)
-(defalias 'edebug-sit-for 'sit-for)
-(defalias 'edebug-input-pending-p 'input-pending-p)
-
-
;;; Redefine read and eval functions
;; read is redefined to maybe instrument forms.
;; eval-defun is redefined to check edebug-all-forms and edebug-all-defs.
;; Save the original read function
-(or (fboundp 'edebug-original-read)
- (defalias 'edebug-original-read (symbol-function 'read)))
+(defalias 'edebug-original-read
+ (symbol-function (if (fboundp 'edebug-original-read)
+ 'edebug-original-read 'read)))
(defun edebug-read (&optional stream)
"Read one Lisp expression as text from STREAM, return as Lisp object.
@@ -626,36 +613,29 @@ already is one.)"
;; The internal data that is needed for edebugging is kept in the
;; buffer-local variable `edebug-form-data'.
-(make-variable-buffer-local 'edebug-form-data)
-
-(defvar edebug-form-data nil)
-;; A list of entries associating symbols with buffer regions.
-;; This is an automatic buffer local variable. Each entry looks like:
-;; @code{(@var{symbol} @var{begin-marker} @var{end-marker}). The markers
-;; are at the beginning and end of an entry level form and @var{symbol} is
-;; a symbol that holds all edebug related information for the form on its
-;; property list.
-
-;; In the future, the symbol will be irrelevant and edebug data will
-;; be stored in the definitions themselves rather than in the property
-;; list of a symbol.
-
-(defun edebug-make-form-data-entry (symbol begin end)
- (list symbol begin end))
-
-(defsubst edebug-form-data-name (entry)
- (car entry))
-
-(defsubst edebug-form-data-begin (entry)
- (nth 1 entry))
-
-(defsubst edebug-form-data-end (entry)
- (nth 2 entry))
+(defvar-local edebug-form-data nil
+ "A list of entries associating symbols with buffer regions.
+Each entry is an `edebug--form-data' struct with fields:
+SYMBOL, BEGIN-MARKER, and END-MARKER. The markers
+are at the beginning and end of an entry level form and SYMBOL is
+a symbol that holds all edebug related information for the form on its
+property list.
+
+In the future (haha!), the symbol will be irrelevant and edebug data will
+be stored in the definitions themselves rather than in the property
+list of a symbol.")
+
+(cl-defstruct (edebug--form-data
+ ;; Some callers expect accessors to return nil when passed nil.
+ (:type list)
+ (:constructor edebug--make-form-data-entry (name begin end))
+ (:predicate nil) (:constructor nil) (:copier nil))
+ name begin end)
(defsubst edebug-set-form-data-entry (entry name begin end)
- (setcar entry name);; in case name is changed
- (set-marker (nth 1 entry) begin)
- (set-marker (nth 2 entry) end))
+ (setf (edebug--form-data-name entry) name) ;; In case name is changed.
+ (set-marker (edebug--form-data-begin entry) begin)
+ (set-marker (edebug--form-data-end entry) end))
(defun edebug-get-form-data-entry (pnt &optional end-point)
;; Find the edebug form data entry which is closest to PNT.
@@ -663,17 +643,17 @@ already is one.)"
;; Return `nil' if none found.
(let ((rest edebug-form-data)
closest-entry
- (closest-dist 999999)) ;; need maxint here
+ (closest-dist 999999)) ;; Need maxint here.
(while (and rest (< 0 closest-dist))
(let* ((entry (car rest))
- (begin (edebug-form-data-begin entry))
+ (begin (edebug--form-data-begin entry))
(dist (- pnt begin)))
(setq rest (cdr rest))
(if (and (<= 0 dist)
(< dist closest-dist)
(or (not end-point)
- (= end-point (edebug-form-data-end entry)))
- (<= pnt (edebug-form-data-end entry)))
+ (= end-point (edebug--form-data-end entry)))
+ (<= pnt (edebug--form-data-end entry)))
(setq closest-dist dist
closest-entry entry))))
closest-entry))
@@ -682,19 +662,19 @@ already is one.)"
;; and find an entry given a symbol, which should be just assq.
(defun edebug-form-data-symbol ()
-;; Return the edebug data symbol of the form where point is in.
-;; If point is not inside a edebuggable form, cause error.
- (or (edebug-form-data-name (edebug-get-form-data-entry (point)))
+ "Return the edebug data symbol of the form where point is in.
+If point is not inside a edebuggable form, cause error."
+ (or (edebug--form-data-name (edebug-get-form-data-entry (point)))
(error "Not inside instrumented form")))
(defun edebug-make-top-form-data-entry (new-entry)
;; Make NEW-ENTRY the first element in the `edebug-form-data' list.
(edebug-clear-form-data-entry new-entry)
- (setq edebug-form-data (cons new-entry edebug-form-data)))
+ (push new-entry edebug-form-data))
(defun edebug-clear-form-data-entry (entry)
-;; If non-nil, clear ENTRY out of the form data.
-;; Maybe clear the markers and delete the symbol's edebug property?
+ "If non-nil, clear ENTRY out of the form data.
+Maybe clear the markers and delete the symbol's edebug property?"
(if entry
(progn
;; Instead of this, we could just find all contained forms.
@@ -1086,7 +1066,8 @@ already is one.)"
;; If it gets an error, make it nil.
(let ((temp-hook edebug-setup-hook))
(setq edebug-setup-hook nil)
- (run-hooks 'temp-hook))
+ (if (functionp temp-hook) (funcall temp-hook)
+ (mapc #'funcall temp-hook)))
(let (result
edebug-top-window-data
@@ -1223,8 +1204,8 @@ already is one.)"
(defvar edebug-offset-list) ; the list of offset positions.
(defun edebug-inc-offset (offset)
- ;; modifies edebug-offset-index and edebug-offset-list
- ;; accesses edebug-func-marc and buffer point
+ ;; Modifies edebug-offset-index and edebug-offset-list
+ ;; accesses edebug-func-marc and buffer point.
(prog1
edebug-offset-index
(setq edebug-offset-list (cons (- offset edebug-form-begin-marker)
@@ -1237,13 +1218,11 @@ already is one.)"
;; given FORM. Looks like:
;; (edebug-after (edebug-before BEFORE-INDEX) AFTER-INDEX FORM)
;; Also increment the offset index for subsequent use.
- (list 'edebug-after
- (list 'edebug-before before-index)
- after-index form))
+ `(edebug-after (edebug-before ,before-index) ,after-index ,form))
(defun edebug-make-after-form (form after-index)
;; Like edebug-make-before-and-after-form, but only after.
- (list 'edebug-after 0 after-index form))
+ `(edebug-after 0 ,after-index ,form))
(defun edebug-unwrap (sexp)
@@ -1293,7 +1272,7 @@ expressions; a `progn' form will be returned enclosing these forms."
;; Set this marker before parsing.
(edebug-form-begin-marker
(if form-data-entry
- (edebug-form-data-begin form-data-entry)
+ (edebug--form-data-begin form-data-entry)
;; Buffer must be current-buffer for this to work:
(set-marker (make-marker) form-begin))))
@@ -1303,7 +1282,7 @@ expressions; a `progn' form will be returned enclosing these forms."
;; For definitions.
;; (edebug-containing-def-name edebug-def-name)
;; Get name from form-data, if any.
- (edebug-old-def-name (edebug-form-data-name form-data-entry))
+ (edebug-old-def-name (edebug--form-data-name form-data-entry))
edebug-def-name
edebug-def-args
edebug-def-interactive
@@ -1333,7 +1312,7 @@ expressions; a `progn' form will be returned enclosing these forms."
;; In the latter case, pointers to the entry remain eq.
(if (not form-data-entry)
(setq form-data-entry
- (edebug-make-form-data-entry
+ (edebug--make-form-data-entry
edebug-def-name
edebug-form-begin-marker
;; Buffer must be current-buffer.
@@ -1519,18 +1498,18 @@ expressions; a `progn' form will be returned enclosing these forms."
;; Otherwise it signals an error. The place of the error is found
;; with the two before- and after-offset functions.
-(defun edebug-no-match (cursor &rest edebug-args)
+(defun edebug-no-match (cursor &rest args)
;; Throw a no-match, or signal an error immediately if gate is active.
;; Remember this point in case we need to report this error.
(setq edebug-error-point (or edebug-error-point
(edebug-before-offset cursor))
- edebug-best-error (or edebug-best-error edebug-args))
+ edebug-best-error (or edebug-best-error args))
(if (and edebug-gate (not edebug-&optional))
(progn
(if edebug-error-point
(goto-char edebug-error-point))
- (apply 'edebug-syntax-error edebug-args))
- (funcall 'throw 'no-match edebug-args)))
+ (apply 'edebug-syntax-error args))
+ (throw 'no-match args)))
(defun edebug-match (cursor specs)
@@ -1757,7 +1736,7 @@ expressions; a `progn' form will be returned enclosing these forms."
specs))))
-(defun edebug-match-gate (cursor)
+(defun edebug-match-gate (_cursor)
;; Simply set the gate to prevent backtracking at this level.
(setq edebug-gate t)
nil)
@@ -1846,7 +1825,7 @@ expressions; a `progn' form will be returned enclosing these forms."
nil))
-(defun edebug-match-function (cursor)
+(defun edebug-match-function (_cursor)
(error "Use function-form instead of function in edebug spec"))
(defun edebug-match-&define (cursor specs)
@@ -1903,7 +1882,7 @@ expressions; a `progn' form will be returned enclosing these forms."
(edebug-move-cursor cursor)
(list name)))
-(defun edebug-match-colon-name (cursor spec)
+(defun edebug-match-colon-name (_cursor spec)
;; Set the edebug-def-name to the spec.
(setq edebug-def-name
(if edebug-def-name
@@ -1988,6 +1967,8 @@ expressions; a `progn' form will be returned enclosing these forms."
def-body))
;; FIXME? Isn't this missing the doc-string? Cf defun.
(def-edebug-spec defmacro
+ ;; FIXME: Improve `declare' so we can Edebug gv-expander and
+ ;; gv-setter declarations.
(&define name lambda-list [&optional ("declare" &rest sexp)] def-body))
(def-edebug-spec arglist lambda-list) ;; deprecated - use lambda-list.
@@ -2018,11 +1999,6 @@ expressions; a `progn' form will be returned enclosing these forms."
;; (def-edebug-spec anonymous-form ((&or ["lambda" lambda] ["macro" macro])))
;; Standard functions that take function-forms arguments.
-(def-edebug-spec mapcar (function-form form))
-(def-edebug-spec mapconcat (function-form form form))
-(def-edebug-spec mapatoms (function-form &optional form))
-(def-edebug-spec apply (function-form &rest form))
-(def-edebug-spec funcall (function-form &rest form))
;; FIXME? The manual uses this form (maybe that's just for illustration?):
;; (def-edebug-spec let
@@ -2088,49 +2064,12 @@ expressions; a `progn' form will be returned enclosing these forms."
&or ("quote" edebug-\`) def-form))
;; New byte compiler.
-(def-edebug-spec defsubst defun)
-(def-edebug-spec dont-compile t)
-(def-edebug-spec eval-when-compile t)
-(def-edebug-spec eval-and-compile t)
(def-edebug-spec save-selected-window t)
(def-edebug-spec save-current-buffer t)
-(def-edebug-spec delay-mode-hooks t)
-(def-edebug-spec with-temp-file t)
-(def-edebug-spec with-temp-message t)
-(def-edebug-spec with-syntax-table t)
-(def-edebug-spec push (form sexp))
-(def-edebug-spec pop (sexp))
-
-(def-edebug-spec 1value (form))
-(def-edebug-spec noreturn (form))
-
;; Anything else?
-
-;; Some miscellaneous specs for macros in public packages.
-;; Send me yours.
-
-;; advice.el by Hans Chalupsky ([email protected])
-
-(def-edebug-spec ad-dolist ((symbolp form &optional form) body))
-(def-edebug-spec defadvice
- (&define name ;; thing being advised.
- (name ;; class is [&or "before" "around" "after"
- ;; "activation" "deactivation"]
- name ;; name of advice
- &rest sexp ;; optional position and flags
- )
- [&optional stringp]
- [&optional ("interactive" interactive)]
- def-body))
-
-(def-edebug-spec easy-menu-define (symbolp body))
-
-(def-edebug-spec with-custom-print body)
-
-
;;; The debugger itself
(defvar edebug-active nil) ;; Non-nil when edebug is active
@@ -2167,10 +2106,7 @@ expressions; a `progn' form will be returned enclosing these forms."
;; Dynamically bound variables, declared globally but left unbound.
(defvar edebug-function) ; the function being executed. change name!!
-(defvar edebug-args) ; the arguments of the function
(defvar edebug-data) ; the edebug data for the function
-(defvar edebug-value) ; the result of the expression
-(defvar edebug-after-index)
(defvar edebug-def-mark) ; the mark for the definition
(defvar edebug-freq-count) ; the count of expression visits.
(defvar edebug-coverage) ; the coverage results of each expression of function.
@@ -2186,8 +2122,6 @@ expressions; a `progn' form will be returned enclosing these forms."
(defvar edebug-outside-debug-on-error) ; the value of debug-on-error outside
(defvar edebug-outside-debug-on-quit) ; the value of debug-on-quit outside
-(defvar edebug-outside-overriding-local-map)
-(defvar edebug-outside-overriding-terminal-local-map)
(defvar edebug-outside-pre-command-hook)
(defvar edebug-outside-post-command-hook)
@@ -2196,7 +2130,7 @@ expressions; a `progn' form will be returned enclosing these forms."
;;; Handling signals
-(defun edebug-signal (edebug-signal-name edebug-signal-data)
+(defun edebug-signal (signal-name signal-data)
"Signal an error. Args are SIGNAL-NAME, and associated DATA.
A signal name is a symbol with an `error-conditions' property
that is a list of condition names.
@@ -2210,19 +2144,18 @@ See `condition-case'.
This is the Edebug replacement for the standard `signal'. It should
only be active while Edebug is. It checks `debug-on-error' to see
whether it should call the debugger. When execution is resumed, the
-error is signaled again.
-\n(fn SIGNAL-NAME DATA)"
- (if (and (listp debug-on-error) (memq edebug-signal-name debug-on-error))
- (edebug 'error (cons edebug-signal-name edebug-signal-data)))
+error is signaled again."
+ (if (and (listp debug-on-error) (memq signal-name debug-on-error))
+ (edebug 'error (cons signal-name signal-data)))
;; If we reach here without another non-local exit, then send signal again.
;; i.e. the signal is not continuable, yet.
;; Avoid infinite recursion.
(let ((signal-hook-function nil))
- (signal edebug-signal-name edebug-signal-data)))
+ (signal signal-name signal-data)))
;;; Entering Edebug
-(defun edebug-enter (edebug-function edebug-args edebug-body)
+(defun edebug-enter (function args body)
;; Entering FUNC. The arguments are ARGS, and the body is BODY.
;; Setup edebug variables and evaluate BODY. This function is called
;; when a function evaluated with edebug-eval-top-level-form is entered.
@@ -2231,83 +2164,51 @@ error is signaled again.
;; Is this the first time we are entering edebug since
;; lower-level recursive-edit command?
;; More precisely, this tests whether Edebug is currently active.
- (if (not edebug-entered)
- (let ((edebug-entered t)
- ;; Binding max-lisp-eval-depth here is OK,
- ;; but not inside an unwind-protect.
- ;; Doing it here also keeps it from growing too large.
- (max-lisp-eval-depth (+ 100 max-lisp-eval-depth)) ; too much??
- (max-specpdl-size (+ 200 max-specpdl-size))
-
- (debugger edebug-debugger) ; only while edebug is active.
- (edebug-outside-debug-on-error debug-on-error)
- (edebug-outside-debug-on-quit debug-on-quit)
- ;; Binding these may not be the right thing to do.
- ;; We want to allow the global values to be changed.
- (debug-on-error (or debug-on-error edebug-on-error))
- (debug-on-quit edebug-on-quit)
-
- ;; Lexical bindings must be uncompiled for this to work.
- (cl-lexical-debug t)
-
- (edebug-outside-overriding-local-map overriding-local-map)
- (edebug-outside-overriding-terminal-local-map
- overriding-terminal-local-map)
-
- ;; Save the outside value of executing macro. (here??)
- (edebug-outside-executing-macro executing-kbd-macro)
- (edebug-outside-pre-command-hook
- (edebug-var-status 'pre-command-hook))
- (edebug-outside-post-command-hook
- (edebug-var-status 'post-command-hook)))
- (unwind-protect
- (let (;; Don't keep reading from an executing kbd macro
- ;; within edebug unless edebug-continue-kbd-macro is
- ;; non-nil. Again, local binding may not be best.
- (executing-kbd-macro
- (if edebug-continue-kbd-macro executing-kbd-macro))
-
- ;; Don't get confused by the user's keymap changes.
- (overriding-local-map nil)
- (overriding-terminal-local-map nil)
-
- (signal-hook-function 'edebug-signal)
-
- ;; Disable command hooks. This is essential when
- ;; a hook function is instrumented - to avoid infinite loop.
- ;; This may be more than we need, however.
- (pre-command-hook nil)
- (post-command-hook nil))
- (setq edebug-execution-mode (or edebug-next-execution-mode
- edebug-initial-mode
- edebug-execution-mode)
- edebug-next-execution-mode nil)
- (edebug-enter edebug-function edebug-args edebug-body))
- ;; Reset global variables in case outside value was changed.
- (setq executing-kbd-macro edebug-outside-executing-macro)
- (edebug-restore-status
- 'post-command-hook edebug-outside-post-command-hook)
- (edebug-restore-status
- 'pre-command-hook edebug-outside-pre-command-hook)))
-
- (let* ((edebug-data (get edebug-function 'edebug))
- (edebug-def-mark (car edebug-data)) ; mark at def start
- (edebug-freq-count (get edebug-function 'edebug-freq-count))
- (edebug-coverage (get edebug-function 'edebug-coverage))
- (edebug-buffer (marker-buffer edebug-def-mark))
-
- (edebug-stack (cons edebug-function edebug-stack))
- (edebug-offset-indices (cons 0 edebug-offset-indices))
- )
- (if (get edebug-function 'edebug-on-entry)
- (progn
- (setq edebug-execution-mode 'step)
- (if (eq (get edebug-function 'edebug-on-entry) 'temp)
- (put edebug-function 'edebug-on-entry nil))))
- (if edebug-trace
- (edebug-enter-trace edebug-body)
- (funcall edebug-body))
- )))
+ (let ((edebug-function function))
+ (if (not edebug-entered)
+ (let ((edebug-entered t)
+ ;; Binding max-lisp-eval-depth here is OK,
+ ;; but not inside an unwind-protect.
+ ;; Doing it here also keeps it from growing too large.
+ (max-lisp-eval-depth (+ 100 max-lisp-eval-depth)) ; too much??
+ (max-specpdl-size (+ 200 max-specpdl-size))
+
+ (debugger edebug-debugger) ; only while edebug is active.
+ (edebug-outside-debug-on-error debug-on-error)
+ (edebug-outside-debug-on-quit debug-on-quit)
+ ;; Binding these may not be the right thing to do.
+ ;; We want to allow the global values to be changed.
+ (debug-on-error (or debug-on-error edebug-on-error))
+ (debug-on-quit edebug-on-quit)
+
+ ;; Lexical bindings must be uncompiled for this to work.
+ (cl-lexical-debug t))
+ (unwind-protect
+ (let ((signal-hook-function 'edebug-signal))
+ (setq edebug-execution-mode (or edebug-next-execution-mode
+ edebug-initial-mode
+ edebug-execution-mode)
+ edebug-next-execution-mode nil)
+ (edebug-enter function args body))))
+
+ (let* ((edebug-data (get function 'edebug))
+ (edebug-def-mark (car edebug-data)) ; mark at def start
+ (edebug-freq-count (get function 'edebug-freq-count))
+ (edebug-coverage (get function 'edebug-coverage))
+ (edebug-buffer (marker-buffer edebug-def-mark))
+
+ (edebug-stack (cons function edebug-stack))
+ (edebug-offset-indices (cons 0 edebug-offset-indices))
+ )
+ (if (get function 'edebug-on-entry)
+ (progn
+ (setq edebug-execution-mode 'step)
+ (if (eq (get function 'edebug-on-entry) 'temp)
+ (put function 'edebug-on-entry nil))))
+ (if edebug-trace
+ (edebug--enter-trace function args body)
+ (funcall body))
+ ))))
(defun edebug-var-status (var)
"Return a cons cell describing the status of VAR's current binding.
@@ -2334,14 +2235,14 @@ STATUS should be a list returned by `edebug-var-status'."
(t
(set var value)))))
-(defun edebug-enter-trace (edebug-body)
+(defun edebug--enter-trace (function args body)
(let ((edebug-stack-depth (1+ edebug-stack-depth))
edebug-result)
(edebug-print-trace-before
- (format "%s args: %s" edebug-function edebug-args))
- (prog1 (setq edebug-result (funcall edebug-body))
+ (format "%s args: %s" function args))
+ (prog1 (setq edebug-result (funcall body))
(edebug-print-trace-after
- (format "%s result: %s" edebug-function edebug-result)))))
+ (format "%s result: %s" function edebug-result)))))
(def-edebug-spec edebug-tracing (form body))
@@ -2369,49 +2270,49 @@ MSG is printed after `::::} '."
-(defun edebug-slow-before (edebug-before-index)
+(defun edebug-slow-before (before-index)
(unless edebug-active
;; Debug current function given BEFORE position.
;; Called from functions compiled with edebug-eval-top-level-form.
;; Return the before index.
- (setcar edebug-offset-indices edebug-before-index)
+ (setcar edebug-offset-indices before-index)
;; Increment frequency count
- (aset edebug-freq-count edebug-before-index
- (1+ (aref edebug-freq-count edebug-before-index)))
+ (aset edebug-freq-count before-index
+ (1+ (aref edebug-freq-count before-index)))
(if (or (not (memq edebug-execution-mode '(Go-nonstop next)))
- (edebug-input-pending-p))
- (edebug-debugger edebug-before-index 'before nil)))
- edebug-before-index)
+ (input-pending-p))
+ (edebug-debugger before-index 'before nil)))
+ before-index)
-(defun edebug-fast-before (edebug-before-index)
+(defun edebug-fast-before (_before-index)
;; Do nothing.
)
-(defun edebug-slow-after (edebug-before-index edebug-after-index edebug-value)
+(defun edebug-slow-after (_before-index after-index value)
(if edebug-active
- edebug-value
+ value
;; Debug current function given AFTER position and VALUE.
;; Called from functions compiled with edebug-eval-top-level-form.
;; Return VALUE.
- (setcar edebug-offset-indices edebug-after-index)
+ (setcar edebug-offset-indices after-index)
;; Increment frequency count
- (aset edebug-freq-count edebug-after-index
- (1+ (aref edebug-freq-count edebug-after-index)))
- (if edebug-test-coverage (edebug-update-coverage))
+ (aset edebug-freq-count after-index
+ (1+ (aref edebug-freq-count after-index)))
+ (if edebug-test-coverage (edebug--update-coverage after-index value))
(if (and (eq edebug-execution-mode 'Go-nonstop)
- (not (edebug-input-pending-p)))
+ (not (input-pending-p)))
;; Just return result.
- edebug-value
- (edebug-debugger edebug-after-index 'after edebug-value)
+ value
+ (edebug-debugger after-index 'after value)
)))
-(defun edebug-fast-after (edebug-before-index edebug-after-index edebug-value)
+(defun edebug-fast-after (_before-index _after-index value)
;; Do nothing but return the value.
- edebug-value)
+ value)
(defun edebug-run-slow ()
(defalias 'edebug-before 'edebug-slow-before)
@@ -2425,19 +2326,18 @@ MSG is printed after `::::} '."
(edebug-run-slow)
-(defun edebug-update-coverage ()
- (let ((old-result (aref edebug-coverage edebug-after-index)))
+(defun edebug--update-coverage (after-index value)
+ (let ((old-result (aref edebug-coverage after-index)))
(cond
((eq 'ok-coverage old-result))
((eq 'unknown old-result)
- (aset edebug-coverage edebug-after-index edebug-value))
+ (aset edebug-coverage after-index value))
;; Test if a different result.
- ((not (eq edebug-value old-result))
- (aset edebug-coverage edebug-after-index 'ok-coverage)))))
+ ((not (eq value old-result))
+ (aset edebug-coverage after-index 'ok-coverage)))))
;; Dynamically declared unbound variables.
-(defvar edebug-arg-mode) ; the mode, either before, after, or error
(defvar edebug-breakpoints)
(defvar edebug-break-data) ; break data for current function.
(defvar edebug-break) ; whether a break occurred.
@@ -2448,16 +2348,16 @@ MSG is printed after `::::} '."
(defvar edebug-global-break-result nil)
-(defun edebug-debugger (edebug-offset-index edebug-arg-mode edebug-value)
+(defun edebug-debugger (offset-index arg-mode value)
(if inhibit-redisplay
;; Don't really try to enter edebug within an eval from redisplay.
- edebug-value
+ value
;; Check breakpoints and pending input.
- ;; If edebug display should be updated, call edebug-display.
- ;; Return edebug-value.
+ ;; If edebug display should be updated, call edebug--display.
+ ;; Return value.
(let* ( ;; This needs to be here since breakpoints may be changed.
(edebug-breakpoints (car (cdr edebug-data))) ; list of breakpoints
- (edebug-break-data (assq edebug-offset-index edebug-breakpoints))
+ (edebug-break-data (assq offset-index edebug-breakpoints))
(edebug-break-condition (car (cdr edebug-break-data)))
(edebug-global-break
(if edebug-global-break-condition
@@ -2468,7 +2368,7 @@ MSG is printed after `::::} '."
(error nil))))
(edebug-break))
-;;; (edebug-trace "exp: %s" edebug-value)
+ ;;(edebug-trace "exp: %s" value)
;; Test whether we should break.
(setq edebug-break
(or edebug-global-break
@@ -2488,11 +2388,10 @@ MSG is printed after `::::} '."
;; or break, or input is pending,
(if (or (not (memq edebug-execution-mode '(go continue Continue-fast)))
edebug-break
- (edebug-input-pending-p))
- (edebug-display)) ; <--------------- display
+ (input-pending-p))
+ (edebug--display value offset-index arg-mode)) ; <---------- display
- edebug-value
- )))
+ value)))
;; window-start now stored with each function.
@@ -2524,8 +2423,9 @@ MSG is printed after `::::} '."
;; Emacs 19 adds an arg to mark and mark-marker.
(defalias 'edebug-mark-marker 'mark-marker)
+(defvar edebug-outside-unread-command-events)
-(defun edebug-display ()
+(defun edebug--display (value offset-index arg-mode)
(unless (marker-position edebug-def-mark)
;; The buffer holding the source has been killed.
;; Let's at least show a backtrace so the user can figure out
@@ -2534,11 +2434,11 @@ MSG is printed after `::::} '."
;; Setup windows for edebug, determine mode, maybe enter recursive-edit.
;; Uses local variables of edebug-enter, edebug-before, edebug-after
;; and edebug-debugger.
- (let ((edebug-active t) ; for minor mode alist
+ (let ((edebug-active t) ; For minor mode alist.
(edebug-with-timeout-suspend (with-timeout-suspend))
- edebug-stop ; should we enter recursive-edit
+ edebug-stop ; Should we enter recursive-edit?
(edebug-point (+ edebug-def-mark
- (aref (nth 2 edebug-data) edebug-offset-index)))
+ (aref (nth 2 edebug-data) offset-index)))
edebug-buffer-outside-point ; current point in edebug-buffer
;; window displaying edebug-buffer
(edebug-window-data (nth 3 edebug-data))
@@ -2547,12 +2447,12 @@ MSG is printed after `::::} '."
(edebug-outside-point (point))
(edebug-outside-mark (edebug-mark))
(edebug-outside-unread-command-events unread-command-events)
- edebug-outside-windows ; window or screen configuration
+ edebug-outside-windows ; Window or screen configuration.
edebug-buffer-points
- edebug-eval-buffer ; declared here so we can kill it below
- (edebug-eval-result-list (and edebug-eval-list
- (edebug-eval-result-list)))
+ edebug-eval-buffer ; Declared here so we can kill it below.
+ (eval-result-list (and edebug-eval-list
+ (edebug-eval-result-list)))
edebug-trace-window
edebug-trace-window-start
@@ -2565,7 +2465,7 @@ MSG is printed after `::::} '."
(let ((overlay-arrow-position overlay-arrow-position)
(overlay-arrow-string overlay-arrow-string)
(cursor-in-echo-area nil)
- (unread-command-events unread-command-events)
+ (unread-command-events nil)
;; any others??
)
(setq-default cursor-in-non-selected-windows t)
@@ -2573,9 +2473,9 @@ MSG is printed after `::::} '."
(let ((debug-on-error nil))
(error "Buffer defining %s not found" edebug-function)))
- (if (eq 'after edebug-arg-mode)
+ (if (eq 'after arg-mode)
;; Compute result string now before windows are modified.
- (edebug-compute-previous-result edebug-value))
+ (edebug-compute-previous-result value))
(if edebug-save-windows
;; Save windows now before we modify them.
@@ -2599,7 +2499,7 @@ MSG is printed after `::::} '."
;; Now display eval list, if any.
;; This is done after the pop to edebug-buffer
;; so that buffer-window correspondence is correct after quitting.
- (edebug-eval-display edebug-eval-result-list)
+ (edebug-eval-display eval-result-list)
;; The evaluation list better not have deleted edebug-window-data.
(select-window (car edebug-window-data))
(set-buffer edebug-buffer)
@@ -2607,7 +2507,7 @@ MSG is printed after `::::} '."
(setq edebug-buffer-outside-point (point))
(goto-char edebug-point)
- (if (eq 'before edebug-arg-mode)
+ (if (eq 'before arg-mode)
;; Check whether positions are up-to-date.
;; This assumes point is never before symbol.
(if (not (memq (following-char) '(?\( ?\# ?\` )))
@@ -2620,7 +2520,7 @@ MSG is printed after `::::} '."
(edebug-adjust-window (cdr edebug-window-data)))
;; Test if there is input, not including keyboard macros.
- (if (edebug-input-pending-p)
+ (if (input-pending-p)
(progn
(setq edebug-execution-mode 'step
edebug-stop t)
@@ -2631,14 +2531,14 @@ MSG is printed after `::::} '."
(edebug-overlay-arrow)
(cond
- ((eq 'error edebug-arg-mode)
+ ((eq 'error arg-mode)
;; Display error message
(setq edebug-execution-mode 'step)
(edebug-overlay-arrow)
(beep)
- (if (eq 'quit (car edebug-value))
+ (if (eq 'quit (car value))
(message "Quit")
- (edebug-report-error edebug-value)))
+ (edebug-report-error value)))
(edebug-break
(cond
(edebug-global-break
@@ -2655,41 +2555,40 @@ MSG is printed after `::::} '."
(t (message "")))
- (setq unread-command-events nil)
- (if (eq 'after edebug-arg-mode)
+ (if (eq 'after arg-mode)
(progn
;; Display result of previous evaluation.
(if (and edebug-break
(not (eq edebug-execution-mode 'Continue-fast)))
- (edebug-sit-for edebug-sit-for-seconds)) ; Show message.
+ (sit-for edebug-sit-for-seconds)) ; Show message.
(edebug-previous-result)))
(cond
(edebug-break
(cond
((eq edebug-execution-mode 'continue)
- (edebug-sit-for edebug-sit-for-seconds))
- ((eq edebug-execution-mode 'Continue-fast) (edebug-sit-for 0))
+ (sit-for edebug-sit-for-seconds))
+ ((eq edebug-execution-mode 'Continue-fast) (sit-for 0))
(t (setq edebug-stop t))))
;; not edebug-break
((eq edebug-execution-mode 'trace)
- (edebug-sit-for edebug-sit-for-seconds)) ; Force update and pause.
+ (sit-for edebug-sit-for-seconds)) ; Force update and pause.
((eq edebug-execution-mode 'Trace-fast)
- (edebug-sit-for 0))) ; Force update and continue.
+ (sit-for 0))) ; Force update and continue.
(unwind-protect
(if (or edebug-stop
(memq edebug-execution-mode '(step next))
- (eq edebug-arg-mode 'error))
+ (eq arg-mode 'error))
(progn
;; (setq edebug-execution-mode 'step)
;; (edebug-overlay-arrow) ; This doesn't always show up.
- (edebug-recursive-edit))) ; <---------- Recursive edit
+ (edebug--recursive-edit arg-mode))) ; <----- Recursive edit
;; Reset the edebug-window-data to whatever it is now.
(let ((window (if (eq (window-buffer) edebug-buffer)
(selected-window)
- (edebug-get-buffer-window edebug-buffer))))
+ (get-buffer-window edebug-buffer))))
;; Remember window-start for edebug-buffer, if still displayed.
(if window
(progn
@@ -2767,6 +2666,8 @@ MSG is printed after `::::} '."
(goto-char edebug-buffer-outside-point))
;; ... nothing more.
)
+ ;; Could be an option to keep eval display up.
+ (if edebug-eval-buffer (kill-buffer edebug-eval-buffer))
(with-timeout-unsuspend edebug-with-timeout-suspend)
;; Reset global variables to outside values in case they were changed.
(setq
@@ -2804,26 +2705,15 @@ MSG is printed after `::::} '."
;; in versions where the variable is *not* built-in.
;; Emacs 18 FIXME
-(defvar edebug-outside-unread-command-char)
;; Emacs 19.
(defvar edebug-outside-last-command-event)
-(defvar edebug-outside-unread-command-events)
(defvar edebug-outside-last-input-event)
(defvar edebug-outside-last-event-frame)
(defvar edebug-outside-last-nonmenu-event)
(defvar edebug-outside-track-mouse)
-;; Disable byte compiler warnings about unread-command-char and -event
-;; (maybe works with byte-compile-version 2.22 at least)
-(defvar edebug-unread-command-char-warning)
-(defvar edebug-unread-command-event-warning)
-(eval-when-compile ; FIXME
- (setq edebug-unread-command-char-warning
- (get 'unread-command-char 'byte-obsolete-variable))
- (put 'unread-command-char 'byte-obsolete-variable nil))
-
-(defun edebug-recursive-edit ()
+(defun edebug--recursive-edit (arg-mode)
;; Start up a recursive edit inside of edebug.
;; The current buffer is the edebug-buffer, which is put into edebug-mode.
;; Assume that none of the variables below are buffer-local.
@@ -2844,14 +2734,20 @@ MSG is printed after `::::} '."
(edebug-outside-map (current-local-map))
- (edebug-outside-standard-output standard-output)
+ ;; Save the outside value of executing macro. (here??)
+ (edebug-outside-executing-macro executing-kbd-macro)
+ (edebug-outside-pre-command-hook
+ (edebug-var-status 'pre-command-hook))
+ (edebug-outside-post-command-hook
+ (edebug-var-status 'post-command-hook))
+
+ (edebug-outside-standard-output standard-output)
(edebug-outside-standard-input standard-input)
(edebug-outside-defining-kbd-macro defining-kbd-macro)
(edebug-outside-last-command last-command)
(edebug-outside-this-command this-command)
- (edebug-outside-unread-command-char unread-command-char) ; FIXME
(edebug-outside-current-prefix-arg current-prefix-arg)
(edebug-outside-last-input-event last-input-event)
@@ -2867,9 +2763,6 @@ MSG is printed after `::::} '."
;; We could set these to the values for previous edebug call.
(last-command last-command)
(this-command this-command)
-
- ;; Assume no edebug command sets unread-command-char.
- (unread-command-char -1)
(current-prefix-arg nil)
;; More for Emacs 19
@@ -2879,7 +2772,20 @@ MSG is printed after `::::} '."
(last-nonmenu-event nil)
(track-mouse nil)
- ;; Bind again to outside values.
+ (standard-output t)
+ (standard-input t)
+
+ ;; Don't keep reading from an executing kbd macro
+ ;; within edebug unless edebug-continue-kbd-macro is
+ ;; non-nil. Again, local binding may not be best.
+ (executing-kbd-macro
+ (if edebug-continue-kbd-macro executing-kbd-macro))
+
+ ;; Don't get confused by the user's keymap changes.
+ (overriding-local-map nil)
+ (overriding-terminal-local-map nil)
+
+ ;; Bind again to outside values.
(debug-on-error edebug-outside-debug-on-error)
(debug-on-quit edebug-outside-debug-on-quit)
@@ -2887,11 +2793,17 @@ MSG is printed after `::::} '."
(defining-kbd-macro
(if edebug-continue-kbd-macro defining-kbd-macro))
+ ;; Disable command hooks. This is essential when
+ ;; a hook function is instrumented - to avoid infinite loop.
+ ;; This may be more than we need, however.
+ (pre-command-hook nil)
+ (post-command-hook nil)
+
;; others??
)
(if (and (eq edebug-execution-mode 'go)
- (not (memq edebug-arg-mode '(after error))))
+ (not (memq arg-mode '(after error))))
(message "Break"))
(setq buffer-read-only t)
@@ -2905,8 +2817,6 @@ MSG is printed after `::::} '."
(setq signal-hook-function 'edebug-signal)
(if edebug-backtrace-buffer
(kill-buffer edebug-backtrace-buffer))
- ;; Could be an option to keep eval display up.
- (if edebug-eval-buffer (kill-buffer edebug-eval-buffer))
;; Remember selected-window after recursive-edit.
;; (setq edebug-inside-window (selected-window))
@@ -2933,7 +2843,6 @@ MSG is printed after `::::} '."
last-command-event edebug-outside-last-command-event
last-command edebug-outside-last-command
this-command edebug-outside-this-command
- unread-command-char edebug-outside-unread-command-char
current-prefix-arg edebug-outside-current-prefix-arg
last-input-event edebug-outside-last-input-event
last-event-frame edebug-outside-last-event-frame
@@ -2942,17 +2851,21 @@ MSG is printed after `::::} '."
standard-output edebug-outside-standard-output
standard-input edebug-outside-standard-input
- defining-kbd-macro edebug-outside-defining-kbd-macro
- ))
- ))
+ defining-kbd-macro edebug-outside-defining-kbd-macro)
+
+ (setq executing-kbd-macro edebug-outside-executing-macro)
+ (edebug-restore-status
+ 'post-command-hook edebug-outside-post-command-hook)
+ (edebug-restore-status
+ 'pre-command-hook edebug-outside-pre-command-hook))))
;;; Display related functions
(defun edebug-adjust-window (old-start)
;; If pos is not visible, adjust current window to fit following context.
-;;; (message "window: %s old-start: %s window-start: %s pos: %s"
-;;; (selected-window) old-start (window-start) (point)) (sit-for 5)
+ ;; (message "window: %s old-start: %s window-start: %s pos: %s"
+ ;; (selected-window) old-start (window-start) (point)) (sit-for 5)
(if (not (pos-visible-in-window-p))
(progn
;; First try old-start
@@ -2960,7 +2873,7 @@ MSG is printed after `::::} '."
(set-window-start (selected-window) old-start))
(if (not (pos-visible-in-window-p))
(progn
-;; (message "resetting window start") (sit-for 2)
+ ;; (message "resetting window start") (sit-for 2)
(set-window-start
(selected-window)
(save-excursion
@@ -3099,12 +3012,12 @@ before returning. The default is one second."
(current-buffer) (point)
(if (marker-buffer (edebug-mark-marker))
(marker-position (edebug-mark-marker)) "<not set>"))
- (edebug-sit-for arg)
+ (sit-for arg)
(edebug-pop-to-buffer edebug-buffer (car edebug-window-data)))))
;; Joe Wells, here is a start at your idea of adding a buffer to the internal
-;; display list. Still need to use this list in edebug-display.
+;; display list. Still need to use this list in edebug--display.
'(defvar edebug-display-buffer-list nil
"List of buffers that edebug will display when it is active.")
@@ -3426,7 +3339,7 @@ function or macro is called, Edebug will be called there as well."
(save-excursion
(down-list 1)
(if (looking-at "\(")
- (edebug-form-data-name
+ (edebug--form-data-name
(edebug-get-form-data-entry (point)))
(edebug-original-read (current-buffer))))))
(edebug-instrument-function func))))
@@ -3539,11 +3452,10 @@ edebug-mode."
;;; Evaluation of expressions
-(def-edebug-spec edebug-outside-excursion t)
-
(defmacro edebug-outside-excursion (&rest body)
"Evaluate an expression list in the outside context.
Return the result of the last expression."
+ (declare (debug t))
`(save-excursion ; of current-buffer
(if edebug-save-windows
(progn
@@ -3562,7 +3474,6 @@ Return the result of the last expression."
(last-command-event edebug-outside-last-command-event)
(last-command edebug-outside-last-command)
(this-command edebug-outside-this-command)
- (unread-command-char edebug-outside-unread-command-char)
(unread-command-events edebug-outside-unread-command-events)
(current-prefix-arg edebug-outside-current-prefix-arg)
(last-input-event edebug-outside-last-input-event)
@@ -3578,7 +3489,7 @@ Return the result of the last expression."
(pre-command-hook (cdr edebug-outside-pre-command-hook))
(post-command-hook (cdr edebug-outside-post-command-hook))
- ;; See edebug-display
+ ;; See edebug-display.
(overlay-arrow-position edebug-outside-o-a-p)
(overlay-arrow-string edebug-outside-o-a-s)
(cursor-in-echo-area edebug-outside-c-i-e-a)
@@ -3602,7 +3513,6 @@ Return the result of the last expression."
edebug-outside-last-command-event last-command-event
edebug-outside-last-command last-command
edebug-outside-this-command this-command
- edebug-outside-unread-command-char unread-command-char
edebug-outside-unread-command-events unread-command-events
edebug-outside-current-prefix-arg current-prefix-arg
edebug-outside-last-input-event last-input-event
@@ -3633,18 +3543,19 @@ Return the result of the last expression."
(defvar cl-debug-env) ; defined in cl; non-nil when lexical env used.
-(defun edebug-eval (edebug-expr)
+(defun edebug-eval (expr)
;; Are there cl lexical variables active?
- (eval (if (bound-and-true-p cl-debug-env)
- (cl-macroexpand-all edebug-expr cl-debug-env)
- edebug-expr)
+ (eval (if (and (bound-and-true-p cl-debug-env)
+ (fboundp 'cl-macroexpand-all))
+ (cl-macroexpand-all expr cl-debug-env)
+ expr)
lexical-binding))
-(defun edebug-safe-eval (edebug-expr)
+(defun edebug-safe-eval (expr)
;; Evaluate EXPR safely.
;; If there is an error, a string is returned describing the error.
(condition-case edebug-err
- (edebug-eval edebug-expr)
+ (edebug-eval expr)
(error (edebug-format "%s: %s" ;; could
(get (car edebug-err) 'error-message)
(car (cdr edebug-err))))))
@@ -3652,17 +3563,17 @@ Return the result of the last expression."
;;; Printing
-(defun edebug-report-error (edebug-value)
+(defun edebug-report-error (value)
;; Print an error message like command level does.
;; This also prints the error name if it has no error-message.
(message "%s: %s"
- (or (get (car edebug-value) 'error-message)
- (format "peculiar error (%s)" (car edebug-value)))
+ (or (get (car value) 'error-message)
+ (format "peculiar error (%s)" (car value)))
(mapconcat (function (lambda (edebug-arg)
;; continuing after an error may
;; complain about edebug-arg. why??
(prin1-to-string edebug-arg)))
- (cdr edebug-value) ", ")))
+ (cdr value) ", ")))
(defvar print-readably) ; defined by lemacs
;; Alternatively, we could change the definition of
@@ -3678,14 +3589,14 @@ Return the result of the last expression."
(edebug-prin1-to-string value)
(error "#Apparently circular structure#"))))
-(defun edebug-compute-previous-result (edebug-previous-value)
+(defun edebug-compute-previous-result (previous-value)
(if edebug-unwrap-results
- (setq edebug-previous-value
- (edebug-unwrap* edebug-previous-value)))
+ (setq previous-value
+ (edebug-unwrap* previous-value)))
(setq edebug-previous-result
(concat "Result: "
- (edebug-safe-prin1-to-string edebug-previous-value)
- (eval-expression-print-format edebug-previous-value))))
+ (edebug-safe-prin1-to-string previous-value)
+ (eval-expression-print-format previous-value))))
(defun edebug-previous-result ()
"Print the previous result."
@@ -3700,7 +3611,7 @@ Return the result of the last expression."
(defalias 'edebug-format 'format)
(defalias 'edebug-message 'message)
-(defun edebug-eval-expression (edebug-expr)
+(defun edebug-eval-expression (expr)
"Evaluate an expression in the outside environment.
If interactive, prompt for the expression.
Print result in minibuffer."
@@ -3709,7 +3620,7 @@ Print result in minibuffer."
'read-expression-history)))
(princ
(edebug-outside-excursion
- (setq values (cons (edebug-eval edebug-expr) values))
+ (setq values (cons (edebug-eval expr) values))
(concat (edebug-safe-prin1-to-string (car values))
(eval-expression-print-format (car values))))))
@@ -3723,14 +3634,14 @@ Print value in minibuffer."
"Evaluate sexp before point in outside environment; insert value.
This prints the value into current buffer."
(interactive)
- (let* ((edebug-form (edebug-last-sexp))
- (edebug-result-string
+ (let* ((form (edebug-last-sexp))
+ (result-string
(edebug-outside-excursion
- (edebug-safe-prin1-to-string (edebug-safe-eval edebug-form))))
+ (edebug-safe-prin1-to-string (edebug-safe-eval form))))
(standard-output (current-buffer)))
(princ "\n")
;; princ the string to get rid of quotes.
- (princ edebug-result-string)
+ (princ result-string)
(princ "\n")
))
@@ -3922,44 +3833,38 @@ Options:
(edebug-trace nil))
(mapcar 'edebug-safe-eval edebug-eval-list)))
-(defun edebug-eval-display-list (edebug-eval-result-list)
+(defun edebug-eval-display-list (eval-result-list)
;; Assumes edebug-eval-buffer exists.
- (let ((edebug-eval-list-temp edebug-eval-list)
- (standard-output edebug-eval-buffer)
+ (let ((standard-output edebug-eval-buffer)
(edebug-comment-line
(format ";%s\n" (make-string (- (window-width) 2) ?-))))
(set-buffer edebug-eval-buffer)
(erase-buffer)
- (while edebug-eval-list-temp
- (prin1 (car edebug-eval-list-temp)) (terpri)
- (prin1 (car edebug-eval-result-list)) (terpri)
- (princ edebug-comment-line)
- (setq edebug-eval-list-temp (cdr edebug-eval-list-temp))
- (setq edebug-eval-result-list (cdr edebug-eval-result-list)))
+ (dolist (exp edebug-eval-list)
+ (prin1 exp) (terpri)
+ (prin1 (pop eval-result-list)) (terpri)
+ (princ edebug-comment-line))
(edebug-pop-to-buffer edebug-eval-buffer)
))
(defun edebug-create-eval-buffer ()
- (if (not (and edebug-eval-buffer (buffer-name edebug-eval-buffer)))
- (progn
- (set-buffer (setq edebug-eval-buffer (get-buffer-create "*edebug*")))
- (edebug-eval-mode))))
+ (unless (and edebug-eval-buffer (buffer-name edebug-eval-buffer))
+ (set-buffer (setq edebug-eval-buffer (get-buffer-create "*edebug*")))
+ (edebug-eval-mode)))
;; Should generalize this to be callable outside of edebug
;; with calls in user functions, e.g. (edebug-eval-display)
-(defun edebug-eval-display (edebug-eval-result-list)
- "Display expressions and evaluations in EDEBUG-EVAL-RESULT-LIST.
+(defun edebug-eval-display (eval-result-list)
+ "Display expressions and evaluations in EVAL-RESULT-LIST.
It modifies the context by popping up the eval display."
- (if edebug-eval-result-list
- (progn
- (edebug-create-eval-buffer)
- (edebug-eval-display-list edebug-eval-result-list)
- )))
+ (when eval-result-list
+ (edebug-create-eval-buffer)
+ (edebug-eval-display-list eval-result-list)))
(defun edebug-eval-redisplay ()
"Redisplay eval list in outside environment.
-May only be called from within `edebug-recursive-edit'."
+May only be called from within `edebug--recursive-edit'."
(edebug-create-eval-buffer)
(edebug-outside-excursion
(edebug-eval-display-list (edebug-eval-result-list))
@@ -3983,7 +3888,7 @@ May only be called from within `edebug-recursive-edit'."
(if (not (eobp))
(progn
(forward-sexp 1)
- (setq new-list (cons (edebug-last-sexp) new-list))))
+ (push (edebug-last-sexp) new-list)))
(while (re-search-forward "^;" nil t)
(forward-line 1)
@@ -3992,7 +3897,7 @@ May only be called from within `edebug-recursive-edit'."
(not (eobp)))
(progn
(forward-sexp 1)
- (setq new-list (cons (edebug-last-sexp) new-list)))))
+ (push (edebug-last-sexp) new-list))))
(setq edebug-eval-list (nreverse new-list))
(edebug-eval-redisplay)
@@ -4021,8 +3926,8 @@ May only be called from within `edebug-recursive-edit'."
(define-key map "\C-c\C-u" 'edebug-update-eval-list)
(define-key map "\C-x\C-e" 'edebug-eval-last-sexp)
(define-key map "\C-j" 'edebug-eval-print-last-sexp)
- map)
-"Keymap for Edebug Eval mode. Superset of Lisp Interaction mode.")
+ map)
+ "Keymap for Edebug Eval mode. Superset of Lisp Interaction mode.")
(put 'edebug-eval-mode 'mode-class 'special)
@@ -4049,32 +3954,32 @@ Global commands prefixed by `global-edebug-prefix':
;; since they depend on the backtrace looking a certain way. But
;; edebug is not dependent on this, yet.
-(defun edebug (&optional edebug-arg-mode &rest debugger-args)
+(defun edebug (&optional arg-mode &rest args)
"Replacement for `debug'.
If we are running an edebugged function, show where we last were.
Otherwise call `debug' normally."
-;; (message "entered: %s depth: %s edebug-recursion-depth: %s"
-;; edebug-entered (recursion-depth) edebug-recursion-depth) (sit-for 1)
+ ;;(message "entered: %s depth: %s edebug-recursion-depth: %s"
+ ;; edebug-entered (recursion-depth) edebug-recursion-depth) (sit-for 1)
(if (and edebug-entered ; anything active?
(eq (recursion-depth) edebug-recursion-depth))
(let (;; Where were we before the error occurred?
- (edebug-offset-index (car edebug-offset-indices))
- ;; Bind variables required by edebug-display
- (edebug-value (car debugger-args))
+ (offset-index (car edebug-offset-indices))
+ (value (car args))
+ ;; Bind variables required by edebug--display.
edebug-breakpoints
edebug-break-data
edebug-break-condition
edebug-global-break
- (edebug-break (null edebug-arg-mode)) ;; if called explicitly
+ (edebug-break (null arg-mode)) ;; If called explicitly.
)
- (edebug-display)
- (if (eq edebug-arg-mode 'error)
+ (edebug--display value offset-index arg-mode)
+ (if (eq arg-mode 'error)
nil
- edebug-value))
+ value))
;; Otherwise call debug normally.
;; Still need to remove extraneous edebug calls from stack.
- (apply 'debug edebug-arg-mode debugger-args)
+ (apply 'debug arg-mode args)
))
@@ -4085,7 +3990,7 @@ Otherwise call `debug' normally."
(null (buffer-name edebug-backtrace-buffer)))
(setq edebug-backtrace-buffer
(generate-new-buffer "*Backtrace*"))
- ;; else, could just display edebug-backtrace-buffer
+ ;; Else, could just display edebug-backtrace-buffer.
)
(with-output-to-temp-buffer (buffer-name edebug-backtrace-buffer)
(setq edebug-backtrace-buffer standard-output)
@@ -4107,7 +4012,7 @@ Otherwise call `debug' normally."
(beginning-of-line)
(cond
((looking-at "^ \(edebug-after")
- ;; Previous lines may contain code, so just delete this line
+ ;; Previous lines may contain code, so just delete this line.
(setq last-ok-point (point))
(forward-line 1)
(delete-region last-ok-point (point)))
@@ -4125,15 +4030,15 @@ Otherwise call `debug' normally."
"In buffer BUF-NAME, display FMT and ARGS at the end and make it visible.
The buffer is created if it does not exist.
You must include newlines in FMT to break lines, but one newline is appended."
-;; e.g.
-;; (edebug-trace-display "*trace-point*"
-;; "saving: point = %s window-start = %s"
-;; (point) (window-start))
+ ;; e.g.
+ ;; (edebug-trace-display "*trace-point*"
+ ;; "saving: point = %s window-start = %s"
+ ;; (point) (window-start))
(let* ((oldbuf (current-buffer))
(selected-window (selected-window))
(buffer (get-buffer-create buf-name))
buf-window)
-;; (message "before pop-to-buffer") (sit-for 1)
+ ;; (message "before pop-to-buffer") (sit-for 1)
(edebug-pop-to-buffer buffer)
(setq truncate-lines t)
(setq buf-window (selected-window))
@@ -4143,8 +4048,8 @@ You must include newlines in FMT to break lines, but one newline is appended."
(vertical-motion (- 1 (window-height)))
(set-window-start buf-window (point))
(goto-char (point-max))
-;; (set-window-point buf-window (point))
-;; (edebug-sit-for 0)
+ ;; (set-window-point buf-window (point))
+ ;; (sit-for 0)
(bury-buffer buffer)
(select-window selected-window)
(set-buffer oldbuf))
@@ -4207,8 +4112,8 @@ reinstrument it."
;; Insert all the indices for this line.
(forward-line 1)
(setq start-of-count-line (point)
- first-index i ; really last index for line above this one.
- last-count -1) ; cause first count to always appear.
+ first-index i ; Really, last index for line above this one.
+ last-count -1) ; Cause first count to always appear.
(insert ";#")
;; i == first-index still
(while (<= (setq i (1+ i)) last-index)
@@ -4240,7 +4145,8 @@ It is removed when you hit any char."
(let ((buffer-read-only nil))
(undo-boundary)
(edebug-display-freq-count)
- (setq unread-command-char (read-char))
+ (setq unread-command-events
+ (append unread-command-events (list (read-event))))
;; Yuck! This doesn't seem to work at all for me.
(undo)))
@@ -4352,87 +4258,6 @@ With prefix argument, make it a temporary breakpoint."
(easy-menu-define edebug-menu edebug-mode-map "Edebug menus" edebug-mode-menus)
-;;; Byte-compiler
-
-;; Extension for bytecomp to resolve undefined function references.
-;; Requires new byte compiler.
-
-;; Reenable byte compiler warnings about unread-command-char and -event.
-;; Disabled before edebug-recursive-edit.
-(eval-when-compile
- (if edebug-unread-command-char-warning
- (put 'unread-command-char 'byte-obsolete-variable
- edebug-unread-command-char-warning)))
-
-(eval-when-compile
- ;; The body of eval-when-compile seems to get evaluated with eval-defun.
- ;; We only want to evaluate when actually byte compiling.
- ;; But it is OK to evaluate as long as byte-compiler has been loaded.
- (if (featurep 'byte-compile) (progn
-
- (defun byte-compile-resolve-functions (funcs)
- "Say it is OK for the named functions to be unresolved."
- (mapc
- (function
- (lambda (func)
- (setq byte-compile-unresolved-functions
- (delq (assq func byte-compile-unresolved-functions)
- byte-compile-unresolved-functions))))
- funcs)
- nil)
-
- '(defun byte-compile-resolve-free-references (vars)
- "Say it is OK for the named variables to be referenced."
- (mapcar
- (function
- (lambda (var)
- (setq byte-compile-free-references
- (delq var byte-compile-free-references))))
- vars)
- nil)
-
- '(defun byte-compile-resolve-free-assignments (vars)
- "Say it is OK for the named variables to be assigned."
- (mapcar
- (function
- (lambda (var)
- (setq byte-compile-free-assignments
- (delq var byte-compile-free-assignments))))
- vars)
- nil)
-
- (byte-compile-resolve-functions
- '(reporter-submit-bug-report
- edebug-gensym ;; also in cl.el
- ;; Interfaces to standard functions.
- edebug-original-eval-defun
- edebug-original-read
- edebug-get-buffer-window
- edebug-mark
- edebug-mark-marker
- edebug-input-pending-p
- edebug-sit-for
- edebug-prin1-to-string
- edebug-format
- ;; lemacs
- zmacs-deactivate-region
- popup-menu
- ;; CL
- cl-macroexpand-all
- ;; And believe it or not, the byte compiler doesn't know about:
- byte-compile-resolve-functions
- ))
-
- '(byte-compile-resolve-free-references
- '(read-expression-history
- read-expression-map))
-
- '(byte-compile-resolve-free-assignments
- '(read-expression-history))
-
- )))
-
-
;;; Autoloading of Edebug accessories
;; edebug-cl-read and cl-read are available from [email protected]
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 666e31f690..64aac4b81d 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -431,6 +431,61 @@ if that value is non-nil."
(add-hook 'completion-at-point-functions
'lisp-completion-at-point nil 'local))
+;;; Emacs Lisp Byte-Code mode
+
+(eval-and-compile
+ (defconst emacs-list-byte-code-comment-re
+ (concat "\\(#\\)@\\([0-9]+\\) "
+ ;; Make sure it's a docstring and not a lazy-loaded byte-code.
+ "\\(?:[^(]\\|([^\"]\\)")))
+
+(defun emacs-lisp-byte-code-comment (end &optional _point)
+ "Try to syntactically mark the #@NNN ....^_ docstrings in byte-code files."
+ (let ((ppss (syntax-ppss)))
+ (when (and (nth 4 ppss)
+ (eq (char-after (nth 8 ppss)) ?#))
+ (let* ((n (save-excursion
+ (goto-char (nth 8 ppss))
+ (when (looking-at emacs-list-byte-code-comment-re)
+ (string-to-number (match-string 2)))))
+ ;; `maxdiff' tries to make sure the loop below terminates.
+ (maxdiff n))
+ (when n
+ (let* ((bchar (match-end 2))
+ (b (position-bytes bchar)))
+ (goto-char (+ b n))
+ (while (let ((diff (- (position-bytes (point)) b n)))
+ (unless (zerop diff)
+ (when (> diff maxdiff) (setq diff maxdiff))
+ (forward-char (- diff))
+ (setq maxdiff (if (> diff 0) diff
+ (max (1- maxdiff) 1)))
+ t))))
+ (if (<= (point) end)
+ (put-text-property (1- (point)) (point)
+ 'syntax-table
+ (string-to-syntax "> b"))
+ (goto-char end)))))))
+
+(defun emacs-lisp-byte-code-syntax-propertize (start end)
+ (emacs-lisp-byte-code-comment end (point))
+ (funcall
+ (syntax-propertize-rules
+ (emacs-list-byte-code-comment-re
+ (1 (prog1 "< b" (emacs-lisp-byte-code-comment end (point))))))
+ start end))
+
+(add-to-list 'auto-mode-alist '("\\.elc\\'" . emacs-lisp-byte-code-mode))
+(define-derived-mode emacs-lisp-byte-code-mode emacs-lisp-mode
+ "Elisp-Byte-Code"
+ "Major mode for *.elc files."
+ ;; TODO: Add way to disassemble byte-code under point.
+ (setq-local open-paren-in-column-0-is-defun-start nil)
+ (setq-local syntax-propertize-function
+ #'emacs-lisp-byte-code-syntax-propertize))
+
+;;; Generic Lisp mode.
+
(defvar lisp-mode-map
(let ((map (make-sparse-keymap))
(menu-map (make-sparse-keymap "Lisp")))
@@ -730,10 +785,12 @@ POS specifies the starting position where EXP was found and defaults to point."
(let ((vars ()))
(goto-char (point-min))
(while (re-search-forward
- "^(def\\(?:var\\|const\\|custom\\)[ \t\n]+\\([^; '()\n\t]+\\)"
+ "(def\\(?:var\\|const\\|custom\\)[ \t\n]+\\([^; '()\n\t]+\\)"
pos t)
(let ((var (intern (match-string 1))))
- (unless (special-variable-p var)
+ (and (not (special-variable-p var))
+ (save-excursion
+ (zerop (car (syntax-ppss (match-beginning 0)))))
(push var vars))))
`(progn ,@(mapcar (lambda (v) `(defvar ,v)) vars) ,exp)))))
@@ -820,7 +877,6 @@ if it already has a value.\)
With argument, insert value in current buffer after the defun.
Return the result of evaluation."
- (interactive "P")
;; FIXME: the print-length/level bindings should only be applied while
;; printing, not while evaluating.
(let ((debug-on-error eval-expression-debug-on-error)
@@ -925,6 +981,7 @@ rigidly along with this one."
(if (or (null indent) (looking-at "\\s<\\s<\\s<"))
;; Don't alter indentation of a ;;; comment line
;; or a line that starts in a string.
+ ;; FIXME: inconsistency: comment-indent moves ;;; to column 0.
(goto-char (- (point-max) pos))
(if (and (looking-at "\\s<") (not (looking-at "\\s<\\s<")))
;; Single-semicolon comment lines should be indented
@@ -939,18 +996,7 @@ rigidly along with this one."
;; If initial point was within line's indentation,
;; position after the indentation. Else stay at same point in text.
(if (> (- (point-max) pos) (point))
- (goto-char (- (point-max) pos)))
- ;; If desired, shift remaining lines of expression the same amount.
- (and whole-exp (not (zerop shift-amt))
- (save-excursion
- (goto-char beg)
- (forward-sexp 1)
- (setq end (point))
- (goto-char beg)
- (forward-line 1)
- (setq beg (point))
- (> end beg))
- (indent-code-rigidly beg end shift-amt)))))
+ (goto-char (- (point-max) pos))))))
(defvar calculate-lisp-indent-last-sexp)
@@ -1230,7 +1276,6 @@ Lisp function does not specify a special indentation."
(put 'prog2 'lisp-indent-function 2)
(put 'save-excursion '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 'let 'lisp-indent-function 1)
(put 'let* 'lisp-indent-function 1)
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 70eab14983..394225d697 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -100,6 +100,17 @@ each clause."
(error (message "Compiler-macro error for %S: %S" (car form) err)
form)))
+(defun macroexp--eval-if-compile (&rest _forms)
+ "Pseudo function used internally by macroexp to delay warnings.
+The purpose is to delay warnings to bytecomp.el, so they can use things
+like `byte-compile-log-warning' to get better file-and-line-number data
+and also to avoid outputting the warning during normal execution."
+ nil)
+(put 'macroexp--eval-if-compile 'byte-compile
+ (lambda (form)
+ (mapc (lambda (x) (funcall (eval x))) (cdr form))
+ (byte-compile-constant nil)))
+
(defun macroexp--expand-all (form)
"Expand all macros in FORM.
This is an internal version of `macroexpand-all'.
@@ -112,14 +123,17 @@ Assumes the caller has bound `macroexpand-all-environment'."
(macroexpand (macroexp--all-forms form 1)
macroexpand-all-environment)
;; Normal form; get its expansion, and then expand arguments.
- (let ((new-form (macroexpand form macroexpand-all-environment)))
- (when (and (not (eq form new-form)) ;It was a macro call.
- (car-safe form)
- (symbolp (car form))
- (get (car form) 'byte-obsolete-info)
- (fboundp 'byte-compile-warn-obsolete))
- (byte-compile-warn-obsolete (car form)))
- (setq form new-form))
+ (let ((new-form
+ (macroexpand form macroexpand-all-environment)))
+ (setq form
+ (if (and (not (eq form new-form)) ;It was a macro call.
+ (car-safe form)
+ (symbolp (car form))
+ (get (car form) 'byte-obsolete-info))
+ `(progn (macroexp--eval-if-compile
+ (lambda () (byte-compile-warn-obsolete ',(car form))))
+ ,new-form)
+ new-form)))
(pcase form
(`(cond . ,clauses)
(macroexp--cons 'cond (macroexp--all-clauses clauses) form))
@@ -323,6 +337,86 @@ symbol itself."
"Return non-nil if EXP can be copied without extra cost."
(or (symbolp exp) (macroexp-const-p exp)))
+;;; Load-time macro-expansion.
+
+;; Because macro-expansion used to be more lazy, eager macro-expansion
+;; tends to bump into previously harmless/unnoticeable cyclic-dependencies.
+;; So, we have to delay macro-expansion like we used to when we detect
+;; such a cycle, and we also want to help coders resolve those cycles (since
+;; they can be non-obvious) by providing a usefully trimmed backtrace
+;; (hopefully) highlighting the problem.
+
+(defun macroexp--backtrace ()
+ "Return the Elisp backtrace, more recent frames first."
+ (let ((bt ())
+ (i 0))
+ (while
+ (let ((frame (backtrace-frame i)))
+ (when frame
+ (push frame bt)
+ (setq i (1+ i)))))
+ (nreverse bt)))
+
+(defun macroexp--trim-backtrace-frame (frame)
+ (pcase frame
+ (`(,_ macroexpand (,head . ,_) . ,_) `(macroexpand (,head …)))
+ (`(,_ internal-macroexpand-for-load (,head ,second . ,_) . ,_)
+ (if (or (symbolp second)
+ (and (eq 'quote (car-safe second))
+ (symbolp (cadr second))))
+ `(macroexpand-all (,head ,second …))
+ '(macroexpand-all …)))
+ (`(,_ load-with-code-conversion ,name . ,_)
+ `(load ,(file-name-nondirectory name)))))
+
+(defvar macroexp--pending-eager-loads nil
+ "Stack of files currently undergoing eager macro-expansion.")
+
+(defun internal-macroexpand-for-load (form)
+ ;; Called from the eager-macroexpansion in readevalloop.
+ (cond
+ ;; Don't repeat the same warning for every top-level element.
+ ((eq 'skip (car macroexp--pending-eager-loads)) form)
+ ;; If we detect a cycle, skip macro-expansion for now, and output a warning
+ ;; with a trimmed backtrace.
+ ((and load-file-name (member load-file-name macroexp--pending-eager-loads))
+ (let* ((bt (delq nil
+ (mapcar #'macroexp--trim-backtrace-frame
+ (macroexp--backtrace))))
+ (elem `(load ,(file-name-nondirectory load-file-name)))
+ (tail (member elem (cdr (member elem bt)))))
+ (if tail (setcdr tail (list '…)))
+ (if (eq (car-safe (car bt)) 'macroexpand-all) (setq bt (cdr bt)))
+ (message "Warning: Eager macro-expansion skipped due to cycle:\n %s"
+ (mapconcat #'prin1-to-string (nreverse bt) " => "))
+ (push 'skip macroexp--pending-eager-loads)
+ form))
+ (t
+ (condition-case err
+ (let ((macroexp--pending-eager-loads
+ (cons load-file-name macroexp--pending-eager-loads)))
+ (macroexpand-all form))
+ (error
+ ;; Hopefully this shouldn't happen thanks to the cycle detection,
+ ;; but in case it does happen, let's catch the error and give the
+ ;; code a chance to macro-expand later.
+ (message "Eager macro-expansion failure: %S" err)
+ form)))))
+
+;; ¡¡¡ Big Ugly Hack !!!
+;; src/bootstrap-emacs is mostly used to compile .el files, so it needs
+;; macroexp, bytecomp, cconv, and byte-opt to be fast. Generally this is done
+;; by compiling those files first, but this only makes a difference if those
+;; files are not preloaded. But macroexp.el is preloaded so we reload it if
+;; the current version is interpreted and there's a compiled version available.
+(eval-when-compile
+ (add-hook 'emacs-startup-hook
+ (lambda ()
+ (and (not (byte-code-function-p
+ (symbol-function 'macroexpand-all)))
+ (locate-library "macroexp.elc")
+ (load "macroexp.elc")))))
+
(provide 'macroexp)
;;; macroexp.el ends here
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index e7806440bf..289751f494 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -123,16 +123,6 @@ Returns the number of actions taken."
map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map query-replace-map)
- (define-key map [?\C-\M-v] 'scroll-other-window)
- (define-key map [M-next] 'scroll-other-window)
- (define-key map [?\C-\M-\S-v] 'scroll-other-window-down)
- (define-key map [M-prior] 'scroll-other-window-down)
- ;; The above are rather inconvenient, so maybe we should
- ;; provide the non-other keys for the other-scroll as well.
- ;; (define-key map [?\C-v] 'scroll-other-window)
- ;; (define-key map [next] 'scroll-other-window)
- ;; (define-key map [?\M-v] 'scroll-other-window-down)
- ;; (define-key map [prior] 'scroll-other-window-down)
(dolist (elt action-alist)
(define-key map (vector (car elt)) (vector (nth 1 elt))))
map)))
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 4aeed7e4d0..09e47b69b9 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -60,6 +60,8 @@
;; 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.
+;; FIXME: Now that macroexpansion is also performed when loading an interpreted
+;; file, this is not a real problem any more.
(defconst pcase--memoize (make-hash-table :weakness 'key :test 'eq))
;; (defconst pcase--memoize-1 (make-hash-table :test 'eq))
;; (defconst pcase--memoize-2 (make-hash-table :weakness 'key :test 'equal))
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index a66d5972d8..2248dde8c0 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -28,8 +28,8 @@
;;; Code:
;; Layout of a timer vector:
-;; [triggered-p high-seconds low-seconds usecs psecs repeat-delay
-;; function args idle-delay]
+;; [triggered-p high-seconds low-seconds usecs repeat-delay
+;; function args idle-delay psecs]
;; triggered-p is nil if the timer is active (waiting to be triggered),
;; t if it is inactive ("already triggered", in theory)
@@ -42,7 +42,7 @@
(:type vector)
(:conc-name timer--))
(triggered t)
- high-seconds low-seconds usecs psecs repeat-delay function args idle-delay)
+ high-seconds low-seconds usecs repeat-delay function args idle-delay psecs)
(defun timerp (object)
"Return t if OBJECT is a timer."
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index 39ce590152..f63d79adf4 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -1423,7 +1423,9 @@ With prefix arg, indent to that column."
(define-key cua--rectangle-keymap [remap set-mark-command] 'cua-toggle-rectangle-mark)
(define-key cua--rectangle-keymap [remap forward-char] 'cua-resize-rectangle-right)
+ (define-key cua--rectangle-keymap [remap right-char] 'cua-resize-rectangle-right)
(define-key cua--rectangle-keymap [remap backward-char] 'cua-resize-rectangle-left)
+ (define-key cua--rectangle-keymap [remap left-char] 'cua-resize-rectangle-left)
(define-key cua--rectangle-keymap [remap next-line] 'cua-resize-rectangle-down)
(define-key cua--rectangle-keymap [remap previous-line] 'cua-resize-rectangle-up)
(define-key cua--rectangle-keymap [remap end-of-line] 'cua-resize-rectangle-eol)
diff --git a/lisp/emulation/edt-mapper.el b/lisp/emulation/edt-mapper.el
index 7fc24773b9..87b6bcf0aa 100644
--- a/lisp/emulation/edt-mapper.el
+++ b/lisp/emulation/edt-mapper.el
@@ -61,7 +61,7 @@
;; emacs -q -l edt-mapper.el
-;; The "-q" option prevents loading of your .emacs file (commands
+;; The "-q" option prevents loading of your init file (commands
;; therein might confuse this program).
;; An instruction screen showing the typical LK-201 terminal
@@ -74,7 +74,7 @@
;; and loaded automatically when the EDT emulation is started. If
;; you specify a different file name, you will need to set the
;; variable "edt-keys-file" before starting the EDT emulation.
-;; Here's how you might go about doing that in your .emacs file.
+;; Here's how you might go about doing that in your init file:
;; (setq edt-keys-file (expand-file-name "~/.my-emacs-keys"))
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el
index dbd13a01a8..3810dcccbb 100644
--- a/lisp/emulation/edt.el
+++ b/lisp/emulation/edt.el
@@ -48,7 +48,7 @@
;; You can have the EDT Emulation start up automatically, each time
;; you initiate a GNU Emacs session, by adding the following line to
-;; your .emacs file:
+;; your init file:
;;
;; (add-hook term-setup-hook 'edt-emulation-on)
@@ -75,7 +75,7 @@
;; default, this feature is enabled, with the top margin set to
;; 10% of the window and the bottom margin set to 15% of the
;; window. To change these settings, you can invoke the function
-;; edt-set-scroll-margins in your .emacs file. For example, the
+;; edt-set-scroll-margins in your init file. For example, the
;; following line
;;
;; (edt-set-scroll-margins "20%" "25%")
@@ -363,7 +363,7 @@ This means that an edt-user.el file was found in the user's `load-path'.")
;;;
;;; (setq edt-keep-current-page-delimiter t)
;;;
-;;; in your .emacs file.
+;;; in your init file.
(defun edt-page-forward (num)
"Move forward to just after next page delimiter.
@@ -1961,14 +1961,14 @@ 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 program. It is safest to run it from an Emacs loaded
- without any of your own customizations found in your .emacs file, etc.
+ without any of your own customizations found in your init 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
- [NOTE: If you do nothing out of the ordinary in your .emacs file, and
+ [NOTE: If you do nothing out of the ordinary in your init file, and
the search for edt-mapper is successful, you can try running it now.]
The library edt-mapper includes these same directions on how to
diff --git a/lisp/emulation/tpu-edt.el b/lisp/emulation/tpu-edt.el
index b8d07e8b74..d375725af5 100644
--- a/lisp/emulation/tpu-edt.el
+++ b/lisp/emulation/tpu-edt.el
@@ -163,8 +163,8 @@
;; and type `tpu-edt' followed by a carriage return.
;; If you like TPU-edt and want to use it all the time, you can start
-;; TPU-edt using the Emacs initialization file, .emacs. Simply create
-;; a .emacs file in your home directory containing the line:
+;; TPU-edt using the Emacs initialization file, .emacs. Simply add
+;; the following line to your init file:
;; (tpu-edt)
@@ -2440,7 +2440,7 @@ If FILE is nil, try to load a default file. The default file names are
;;;### (autoloads (tpu-set-cursor-bound tpu-set-cursor-free tpu-set-scroll-margins
-;;;;;; tpu-cursor-free-mode) "tpu-extras" "tpu-extras.el" "76f06905db4c5bfb3b86491a51512a0e")
+;;;;;; tpu-cursor-free-mode) "tpu-extras" "tpu-extras.el" "bf5e7322f9a2c324a3bb306415813374")
;;; Generated autoloads from tpu-extras.el
(autoload 'tpu-cursor-free-mode "tpu-extras" "\
diff --git a/lisp/emulation/tpu-extras.el b/lisp/emulation/tpu-extras.el
index 521b189e3b..4cf9eee037 100644
--- a/lisp/emulation/tpu-extras.el
+++ b/lisp/emulation/tpu-extras.el
@@ -26,7 +26,7 @@
;; Use the functions defined here to customize TPU-edt to your tastes by
;; setting scroll margins and/or turning on free cursor mode. Here's an
-;; example for your .emacs file.
+;; example for your init file.
;; (tpu-set-cursor-free) ; Set cursor free.
;; (tpu-set-scroll-margins "10%" "15%") ; Set scroll margins.
diff --git a/lisp/emulation/tpu-mapper.el b/lisp/emulation/tpu-mapper.el
index ef4e9b305f..9cced60816 100644
--- a/lisp/emulation/tpu-mapper.el
+++ b/lisp/emulation/tpu-mapper.el
@@ -81,7 +81,7 @@ Finally, you will be prompted for the name of the file to store the key
definitions. If you chose the default, TPU-edt will find it and load it
automatically. If you specify a different file name, you will need to
set the variable ``tpu-xkeys-file'' before starting TPU-edt. Here's how
-you might go about doing that in your .emacs file.
+you might go about doing that in your init file.
(setq tpu-xkeys-file (expand-file-name \"~/.my-emacs-x-keys\"))
(tpu-edt)
diff --git a/lisp/emulation/vi.el b/lisp/emulation/vi.el
index 9bf108c8c3..a59dd610c2 100644
--- a/lisp/emulation/vi.el
+++ b/lisp/emulation/vi.el
@@ -28,7 +28,7 @@
;; (if (not (or (eq major-mode 'Info-mode)
;; (eq major-mode 'vi-mode)))
;; (vi-mode))))))
-;; 3) In your .emacs file you can define the command "vi-mode" to be "autoload"
+;; 3) In your init file you can define the command "vi-mode" to be "autoload"
;; or you can execute the "load" command to load "vi" directly.
;; 4) Read the comments for command "vi-mode" before you start using it.
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index 81fbfb0394..8de253d19b 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -351,7 +351,7 @@ user decide when to invoke Viper in a major mode."
If t, viperize Emacs. If nil -- don't. If `ask', ask the user.
This variable is used primarily when Viper is being loaded.
-Must be set in `~/.emacs' before Viper is loaded.
+Must be set in your init file before Viper is loaded.
DO NOT set this variable interactively, unless you are using the customization
widget."
:type '(choice (const nil) (const t) (const ask))
@@ -1173,7 +1173,7 @@ If you wish to Viperize AND make this your way of life, please put
(setq viper-mode t)
(require 'viper)
-in your .emacs file (preferably, close to the top).
+in your init file (preferably, close to the top).
These two lines must come in the order given.
** Viper users:
diff --git a/lisp/epa-mail.el b/lisp/epa-mail.el
index be5b849651..a16fa5abdd 100644
--- a/lisp/epa-mail.el
+++ b/lisp/epa-mail.el
@@ -170,24 +170,26 @@ Don't use this command in Lisp programs!"
If no one is selected, symmetric encryption will be performed. "
recipients)
(if recipients
- (mapcar
- (lambda (recipient)
- (setq recipient-key
- (epa-mail--find-usable-key
- (epg-list-keys
- (epg-make-context epa-protocol)
- (if (string-match "@" recipient)
- (concat "<" recipient ">")
- recipient))
- 'encrypt))
- (unless (or recipient-key
- (y-or-n-p
- (format
- "No public key for %s; skip it? "
- recipient)))
- (error "No public key for %s" recipient))
- recipient-key)
- recipients)))
+ (apply
+ 'nconc
+ (mapcar
+ (lambda (recipient)
+ (setq recipient-key
+ (epa-mail--find-usable-key
+ (epg-list-keys
+ (epg-make-context epa-protocol)
+ (if (string-match "@" recipient)
+ (concat "<" recipient ">")
+ recipient))
+ 'encrypt))
+ (unless (or recipient-key
+ (y-or-n-p
+ (format
+ "No public key for %s; skip it? "
+ recipient)))
+ (error "No public key for %s" recipient))
+ (if recipient-key (list recipient-key)))
+ recipients))))
(setq sign (if verbose (y-or-n-p "Sign? ")))
(if sign
(epa-select-keys context
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 37e755e765..674a6c97ee 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,9 @@
+2012-09-17 Chong Yidong <[email protected]>
+
+ * erc-page.el (erc-page-function):
+
+ * erc-stamp.el (erc-stamp): Doc fix.
+
2012-08-21 Josh Feinstein <[email protected]>
* erc-join.el (erc-autojoin-timing): Fix defcustom type.
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index c8a7fec32b..a0593dcb74 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -25,7 +25,7 @@
;; Heavily borrowed from gnus-art.el. Thanks to the original authors.
;; This buttonizes nicks and other stuff to make it all clickable.
-;; To enable, add to your ~/.emacs:
+;; To enable, add to your init file:
;; (require 'erc-button)
;; (erc-button-mode 1)
;;
diff --git a/lisp/erc/erc-capab.el b/lisp/erc/erc-capab.el
index 4f6361ee92..c7103d6dc6 100644
--- a/lisp/erc/erc-capab.el
+++ b/lisp/erc/erc-capab.el
@@ -48,7 +48,7 @@
;;; Usage:
-;; Put the following in your ~/.emacs file.
+;; Put the following in your init file.
;; (require 'erc-capab)
;; (erc-capab-identify-mode 1)
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index cac042c029..de7f213719 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -29,7 +29,7 @@
;; customizable variables.
;; Usage:
-;; Put (erc-match-mode 1) into your ~/.emacs file.
+;; Put (erc-match-mode 1) into your init file.
;;; Code:
diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el
index 44fbc9563d..355b345492 100644
--- a/lisp/erc/erc-netsplit.el
+++ b/lisp/erc/erc-netsplit.el
@@ -23,7 +23,7 @@
;;; Commentary:
;; This module hides quit/join messages if a netsplit occurs.
-;; To enable, add the following to your ~/.emacs:
+;; To enable, add the following to your init file:
;; (require 'erc-netsplit)
;; (erc-netsplit-mode 1)
diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el
index e6b670c91b..51ddc33e1c 100644
--- a/lisp/erc/erc-page.el
+++ b/lisp/erc/erc-page.el
@@ -45,7 +45,7 @@ If nil, this prints the page message in the minibuffer and calls
`beep'. If non-nil, it must be a function that takes two arguments:
SENDER and MSG, both strings.
-Example for your ~/.emacs file:
+Example for your init file:
\(setq erc-page-function
(lambda (sender msg)
diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el
index 04c5885bc3..6c5804c62a 100644
--- a/lisp/erc/erc-replace.el
+++ b/lisp/erc/erc-replace.el
@@ -25,7 +25,7 @@
;; This module allows you to systematically replace text in incoming
;; messages. Load erc-replace, and customize `erc-replace-alist'.
-;; Then add to your ~/.emacs:
+;; Then add to your init file:
;; (require 'erc-replace)
;; (erc-replace-mode 1)
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index 5831233aff..4ce2f18e04 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -43,7 +43,7 @@ group provides settings related to the format and display
of timestamp information in `erc-mode' buffer.
For timestamping to be activated, you just need to load `erc-stamp'
-in your .emacs file or interactively using `load-library'."
+in your init file or interactively using `load-library'."
:group 'erc)
(defcustom erc-timestamp-format "[%H:%M]"
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index 9c56c72422..88a3285730 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -24,7 +24,7 @@
;;; Commentary:
;; Highlights keywords and pals (friends), and hides or highlights fools
-;; (using a dark color). Add to your ~/.emacs:
+;; (using a dark color). Add to your init file:
;; (require 'erc-track)
;; (erc-track-mode 1)
diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el
index 4b62fec95e..940056b643 100644
--- a/lisp/eshell/em-alias.el
+++ b/lisp/eshell/em-alias.el
@@ -133,10 +133,10 @@ Each element of this alias is a list of the form:
Where NAME is the textual name of the alias, and DEFINITION is the
command string to replace that command with.
-Note: this list should not be modified in your '.emacs' file. Rather,
-any desired alias definitions should be declared using the `alias'
-command, which will automatically write them to the file named by
-`eshell-aliases-file'.")
+Note: this list should not be modified in your init file.
+Rather, any desired alias definitions should be declared using
+the `alias' command, which will automatically write them to the
+file named by `eshell-aliases-file'.")
(put 'eshell-command-aliases-list 'risky-local-variable t)
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index 58402e3750..d3ddab8af1 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -1111,7 +1111,7 @@ Execute a COMMAND as the superuser or another USER.")
(substring prefix 0 -1) user host dir)
(format "/sudo:%s@%s:%s" user host dir))))
;; Ensure, that Tramp has connected to that construct already.
- (file-exists-p default-directory)
+ (ignore (file-exists-p default-directory))
(eshell-named-command (car orig-args) (cdr orig-args))))))))
(put 'eshell/sudo 'eshell-no-numeric-conversions t)
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index 8218e91ddc..fa0336232f 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -84,7 +84,7 @@ Numeric form is tested using the regular expression
NOTE: If you find that numeric conversions are interfering with the
specification of filenames (for example, in calling `find-file', or
some other Lisp function that deals with files, not numbers), add the
-following in your .emacs file:
+following in your init file:
(put 'find-file 'eshell-no-numeric-conversions t)
diff --git a/lisp/ffap.el b/lisp/ffap.el
index ebe8b6dee9..f3e8d4c194 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -34,7 +34,7 @@
;; README's, MANIFEST's, and so on. Submit bugs or suggestions with
;; M-x ffap-bug.
;;
-;; For the default installation, add this line to your .emacs file:
+;; For the default installation, add this line to your init file:
;;
;; (ffap-bindings) ; do default key bindings
;;
@@ -206,7 +206,7 @@ Sensible values are nil, \"news\", or \"mailto\"."
;; those features interesting but not clear winners (a matter of
;; personal taste) I try to leave options to enable them. Read
;; through this section for features that you like, put an appropriate
-;; enabler in your .emacs file.
+;; enabler in your init file.
(defcustom ffap-dired-wildcards "[*?][^/]*\\'"
"A regexp matching filename wildcard characters, or nil.
diff --git a/lisp/files.el b/lisp/files.el
index ef7f8e43a4..289f5c6b0b 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -658,22 +658,13 @@ Not actually set up until the first time you use it.")
(defun parse-colon-path (search-path)
"Explode a search path into a list of directory names.
-Directories are separated by occurrences of `path-separator'
-\(which is colon in GNU and GNU-like systems)."
- ;; We could use split-string here.
- (and search-path
- (let (cd-list (cd-start 0) cd-colon)
- (setq search-path (concat search-path path-separator))
- (while (setq cd-colon (string-match path-separator search-path cd-start))
- (setq cd-list
- (nconc cd-list
- (list (if (= cd-start cd-colon)
- nil
- (substitute-in-file-name
- (file-name-as-directory
- (substring search-path cd-start cd-colon)))))))
- (setq cd-start (+ cd-colon 1)))
- cd-list)))
+Directories are separated by `path-separator' (which is colon in
+GNU and Unix systems). Substitute environment variables into the
+resulting list of directory names."
+ (when (stringp search-path)
+ (mapcar (lambda (f)
+ (substitute-in-file-name (file-name-as-directory f)))
+ (split-string search-path path-separator t))))
(defun cd-absolute (dir)
"Change current directory to given absolute file name DIR."
@@ -2145,7 +2136,7 @@ unless NOMODES is non-nil."
(not buffer-read-only)
(save-excursion
(goto-char (point-max))
- (insert "\n")))
+ (ignore-errors (insert "\n"))))
(when (and buffer-read-only
view-read-only
(not (eq (get major-mode 'mode-class) 'special)))
@@ -2951,20 +2942,16 @@ UNSAFE-VARS is the list of those that aren't marked as safe or risky.
RISKY-VARS is the list of those that are marked as risky.
If these settings come from directory-local variables, then
DIR-NAME is the name of the associated directory. Otherwise it is nil."
- (if noninteractive
- nil
- (save-window-excursion
- (let* ((name (or dir-name
- (if buffer-file-name
- (file-name-nondirectory buffer-file-name)
- (concat "buffer " (buffer-name)))))
- (offer-save (and (eq enable-local-variables t)
- unsafe-vars))
- (exit-chars
- (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g)))
- (buf (pop-to-buffer "*Local Variables*"))
- prompt char)
- (set (make-local-variable 'cursor-type) nil)
+ (unless noninteractive
+ (let ((name (cond (dir-name)
+ (buffer-file-name
+ (file-name-nondirectory buffer-file-name))
+ ((concat "buffer " (buffer-name)))))
+ (offer-save (and (eq enable-local-variables t)
+ unsafe-vars))
+ (buf (get-buffer-create "*Local Variables*")))
+ ;; Set up the contents of the *Local Variables* buffer.
+ (with-current-buffer buf
(erase-buffer)
(cond
(unsafe-vars
@@ -2999,25 +2986,35 @@ n -- to ignore the local variables list.")
(let ((print-escape-newlines t))
(prin1 (cdr elt) buf))
(insert "\n"))
- (setq prompt
- (format "Please type %s%s: "
- (if offer-save "y, n, or !" "y or n")
- (if (< (line-number-at-pos) (window-body-height))
- ""
- (push ?\C-v exit-chars)
- ", or C-v to scroll")))
- (goto-char (point-min))
- (while (null char)
- (setq char (read-char-choice prompt exit-chars t))
- (when (eq char ?\C-v)
- (condition-case nil
- (scroll-up)
- (error (goto-char (point-min))))
- (setq char nil)))
- (kill-buffer buf)
- (when (and offer-save (= char ?!) unsafe-vars)
- (customize-push-and-save 'safe-local-variable-values unsafe-vars))
- (memq char '(?! ?\s ?y))))))
+ (set (make-local-variable 'cursor-type) nil)
+ (set-buffer-modified-p nil)
+ (goto-char (point-min)))
+
+ ;; Display the buffer and read a choice.
+ (save-window-excursion
+ (pop-to-buffer buf)
+ (let* ((exit-chars '(?y ?n ?\s ?\C-g ?\C-v))
+ (prompt (format "Please type %s%s: "
+ (if offer-save "y, n, or !" "y or n")
+ (if (< (line-number-at-pos (point-max))
+ (window-body-height))
+ ""
+ (push ?\C-v exit-chars)
+ ", or C-v to scroll")))
+ char)
+ (if offer-save (push ?! exit-chars))
+ (while (null char)
+ (setq char (read-char-choice prompt exit-chars t))
+ (when (eq char ?\C-v)
+ (condition-case nil
+ (scroll-up)
+ (error (goto-char (point-min))
+ (recenter 1)))
+ (setq char nil)))
+ (when (and offer-save (= char ?!) unsafe-vars)
+ (customize-push-and-save 'safe-local-variable-values unsafe-vars))
+ (prog1 (memq char '(?! ?\s ?y))
+ (quit-window t)))))))
(defun hack-local-variables-prop-line (&optional mode-only)
"Return local variables specified in the -*- line.
@@ -5350,23 +5347,26 @@ non-nil, it is called instead of rereading visited file contents."
(not (file-exists-p file-name)))
(error "Auto-save file %s not current"
(abbreviate-file-name file-name)))
- ((save-window-excursion
- (with-output-to-temp-buffer "*Directory*"
- (buffer-disable-undo standard-output)
- (save-excursion
- (let ((switches dired-listing-switches))
- (if (file-symlink-p file)
- (setq switches (concat switches " -L")))
- (set-buffer standard-output)
- ;; Use insert-directory-safely, not insert-directory,
- ;; because these files might not exist. In particular,
- ;; FILE might not exist if the auto-save file was for
- ;; a buffer that didn't visit a file, such as "*mail*".
- ;; The code in v20.x called `ls' directly, so we need
- ;; to emulate what `ls' did in that case.
- (insert-directory-safely file switches)
- (insert-directory-safely file-name switches))))
- (yes-or-no-p (format "Recover auto save file %s? " file-name)))
+ ((with-temp-buffer-window
+ "*Directory*" nil
+ #'(lambda (window _value)
+ (with-selected-window window
+ (unwind-protect
+ (yes-or-no-p (format "Recover auto save file %s? " file-name))
+ (when (window-live-p window)
+ (quit-restore-window window 'kill)))))
+ (with-current-buffer standard-output
+ (let ((switches dired-listing-switches))
+ (if (file-symlink-p file)
+ (setq switches (concat switches " -L")))
+ ;; Use insert-directory-safely, not insert-directory,
+ ;; because these files might not exist. In particular,
+ ;; FILE might not exist if the auto-save file was for
+ ;; a buffer that didn't visit a file, such as "*mail*".
+ ;; The code in v20.x called `ls' directly, so we need
+ ;; to emulate what `ls' did in that case.
+ (insert-directory-safely file switches)
+ (insert-directory-safely file-name switches))))
(switch-to-buffer (find-file-noselect file t))
(let ((inhibit-read-only t)
;; Keep the current buffer-file-coding-system.
@@ -6327,8 +6327,15 @@ if any returns nil. If `confirm-kill-emacs' is non-nil, calls it."
(setq active t))
(setq processes (cdr processes)))
(or (not active)
- (progn (list-processes t)
- (yes-or-no-p "Active processes exist; kill them and exit anyway? ")))))
+ (with-temp-buffer-window
+ (get-buffer-create "*Process List*") nil
+ #'(lambda (window _value)
+ (with-selected-window window
+ (unwind-protect
+ (yes-or-no-p "Active processes exist; kill them and exit anyway? ")
+ (when (window-live-p window)
+ (quit-restore-window window 'kill)))))
+ (list-processes t)))))
;; Query the user for other things, perhaps.
(run-hook-with-args-until-failure 'kill-emacs-query-functions)
(or (null confirm-kill-emacs)
diff --git a/lisp/filesets.el b/lisp/filesets.el
index 6c24a4f43d..a91d8cf0fc 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -35,7 +35,7 @@
;; inclusion group (i.e. a base file including other files).
;; Usage:
-;; 1. Put (require 'filesets) and (filesets-init) in your .emacs file.
+;; 1. Put (require 'filesets) and (filesets-init) in your init file.
;; 2. Type ;; M-x filesets-edit or choose "Edit Filesets" from the menu.
;; 3. Save your customizations.
diff --git a/lisp/flow-ctrl.el b/lisp/flow-ctrl.el
index 747a4ca018..b301886de5 100644
--- a/lisp/flow-ctrl.el
+++ b/lisp/flow-ctrl.el
@@ -31,7 +31,7 @@
;;
;; To invoke these adjustments, a user need only invoke the function
;; enable-flow-control-on with a list of terminal types in his/her own
-;; .emacs file. As arguments, give it the names of one or more terminal
+;; init file. As arguments, give it the names of one or more terminal
;; types in use by that user which require flow control adjustments.
;; Here's an example:
;;
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 77c21d2653..6404af7703 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -37,7 +37,7 @@
;; When this minor mode is on, the faces of the current line are updated with
;; every insertion or deletion.
;;
-;; To turn Font Lock mode on automatically, add this to your ~/.emacs file:
+;; To turn Font Lock mode on automatically, add this to your init file:
;;
;; (add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
;;
diff --git a/lisp/frame.el b/lisp/frame.el
index 1e8883eb98..b7b61bcc57 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -309,7 +309,7 @@ there (in decreasing order of priority)."
;; existing frame. We need to explicitly include
;; default-frame-alist in the parameters of the screen we
;; create here, so that its new value, gleaned from the user's
- ;; .emacs file, will be applied to the existing screen.
+ ;; init file, will be applied to the existing screen.
(if (not (eq (cdr (or (assq 'minibuffer initial-frame-alist)
(assq 'minibuffer window-system-frame-alist)
(assq 'minibuffer default-frame-alist)
@@ -1668,6 +1668,10 @@ terminals, cursor blinking is controlled by the terminal."
(make-variable-buffer-local 'show-trailing-whitespace)
+;; Defined in dispnew.c.
+(make-obsolete-variable
+ 'window-system-version "it does not give useful information." "24.3")
+
(provide 'frame)
;;; frame.el ends here
diff --git a/lisp/generic-x.el b/lisp/generic-x.el
index cc7963b171..a97c5649c9 100644
--- a/lisp/generic-x.el
+++ b/lisp/generic-x.el
@@ -28,7 +28,7 @@
;;
;; INSTALLATION:
;;
-;; Add this line to your .emacs file:
+;; Add this line to your init file:
;;
;; (require 'generic-x)
;;
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index a4e3d9bde2..69f0025b52 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,129 @@
+2012-09-13 Katsumi Yamaoka <[email protected]>
+
+ * gnus-util.el (gnus-timer--function): New function.
+
+ * gnus-art.el (gnus-article-stop-animations): Use it.
+
+2012-09-13 Paul Eggert <[email protected]>
+
+ Fix glitches caused by addition of psec to timers.
+ * gnus-art.el (gnus-article-stop-animations): Use timer--function
+ rather than raw access to timer vector.
+
+2012-09-11 Julien Danjou <[email protected]>
+
+ * gnus-notifications.el (gnus-notifications): Check for nil values in
+ ignored addresses check.
+
+2012-09-10 Stefan Monnier <[email protected]>
+
+ * qp.el (quoted-printable-decode-region): Inline+CSE+strength-reduction.
+
+2012-09-07 Chong Yidong <[email protected]>
+
+ * gnus-util.el
+ (gnus-put-text-property-excluding-characters-with-faces): Restore.
+
+ * gnus-salt.el (gnus-tree-highlight-node):
+ * gnus-sum.el (gnus-summary-highlight-line):
+ * gnus-group.el (gnus-group-highlight-line): Revert use of add-face.
+
+2012-09-06 Lars Ingebrigtsen <[email protected]>
+
+ * gnus-util.el: Fix compilation error on XEmacs 21.4.
+
+2012-09-06 Juri Linkov <[email protected]>
+
+ * gnus-group.el (gnus-read-ephemeral-gmane-group): Change the naming
+ scheme for buffer names to be more consistent with other group and
+ article buffer names in Gnus.
+
+2012-09-06 Lars Ingebrigtsen <[email protected]>
+
+ * gnus-util.el
+ (gnus-put-text-property-excluding-characters-with-faces): Remove.
+
+ * gnus-compat.el: Define compat function `add-face' from Wolfgang
+ Jenkner.
+
+ * gnus-group.el (gnus-group-highlight-line): Use combining faces.
+
+ * gnus-sum.el (gnus-summary-highlight-line): Ditto.
+
+ * gnus-salt.el (gnus-tree-highlight-node): Ditto.
+
+2012-09-06 Katsumi Yamaoka <[email protected]>
+
+ * gnus-score.el (gnus-score-decode-text-parts): Use #' for
+ mm-text-parts used in labels macro to make it work with XEmacs 21.5.
+
+ * gnus-util.el (gnus-string-prefix-p): New function, an alias to
+ string-prefix-p in Emacs >=23.2.
+
+ * nnmaildir.el (nnmaildir--ensure-suffix, nnmaildir--add-flag)
+ (nnmaildir--remove-flag, nnmaildir--scan): Use gnus-string-match-p
+ instead of string-match-p.
+ (nnmaildir--scan): Use gnus-string-prefix-p instead of string-prefix-p.
+
+2012-09-06 Kenichi Handa <[email protected]>
+
+ * qp.el (quoted-printable-decode-region): Fix previous change; handle
+ lowercase a..f.
+
+2012-09-05 Magnus Henoch <[email protected]>
+
+ * nnmaildir.el (nnmaildir--article-set-flags): Fix compilation error.
+
+2012-09-05 Martin Stjernholm <[email protected]>
+
+ * gnus-demon.el (gnus-demon-init): Fixed regression when IDLE is t and
+ TIME is set.
+
+2012-09-05 Juri Linkov <[email protected]>
+
+ * gnus-group.el (gnus-read-ephemeral-bug-group): Allow opening more
+ than one group at a time (bug#11961).
+
+2012-09-05 Julien Danjou <[email protected]>
+
+ * gnus-srvr.el (gnus-server-open-server): Don't message on failure:
+ this hide the real reason with a message giving absolutely no hint.
+
+2012-09-05 Lars Ingebrigtsen <[email protected]>
+
+ * gnus-group.el (gnus-group-mark-article-read): Propagate the read mark
+ to the backend (bug#11804).
+
+ * message.el (message-insert-newsgroups): Don't insert newsgroup
+ duplicates (bug#12275).
+
+2012-09-05 John Wiegley <[email protected]>
+
+ * gnus.el (gnus-expand-group-parameters): Allow regexp substitutions in
+ sieve rules.
+
+2012-09-05 Jan Tatarik <[email protected]>
+
+ * gnus-score.el (gnus-score-decode-text-parts): Use #' for the local
+ function.
+
+ * gnus-logic.el (gnus-advanced-body): Allow scoring on decoded bodies.
+
+ * gnus-score.el (gnus-score-decode-text-parts): Ditto.
+
+2012-09-05 Magnus Henoch <[email protected]>
+
+ * nnmaildir.el: Make nnmaildir understand and write maildir flags.
+ That is, rename files from "unique:2," to "unique:2,S" for "seen", etc.
+ This should make nnmaildir more usable with offlineimap.
+
+2012-09-03 Lars Ingebrigtsen <[email protected]>
+
+ * gnus-notifications.el (gnus-notifications-notify): Use it.
+
+ * gnus-fun.el (gnus-funcall-no-warning): New function to silence
+ warnings on XEmacs.
+
2012-09-01 Paul Eggert <[email protected]>
Better seeds for (random).
@@ -2291,8 +2417,6 @@
2011-06-30 Lars Magne Ingebrigtsen <[email protected]>
- * dgnushack.el: Autoload sha1 on XEmacs.
-
* gnus-group.el (gnus-read-ephemeral-emacs-bug-group): Take an optional
quit window configuration.
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index b9020a40b7..7dcbd61316 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -4554,7 +4554,7 @@ commands:
(defun gnus-article-stop-animations ()
(dolist (timer (and (boundp 'timer-list)
timer-list))
- (when (eq (elt timer 5) 'image-animate-timeout)
+ (when (eq (gnus-timer--function timer) 'image-animate-timeout)
(cancel-timer timer))))
(defun gnus-stop-downloads ()
diff --git a/lisp/gnus/gnus-demon.el b/lisp/gnus/gnus-demon.el
index 115c577744..671c566d09 100644
--- a/lisp/gnus/gnus-demon.el
+++ b/lisp/gnus/gnus-demon.el
@@ -144,9 +144,12 @@ marked with SPECIAL."
(* (gnus-demon-time-to-step time) gnus-demon-timestep))
(t
(* time gnus-demon-timestep))))
- (idle (if (numberp idle)
- (* idle gnus-demon-timestep)
- idle))
+ (idle (cond ((numberp idle)
+ (* idle gnus-demon-timestep))
+ ((and (eq idle t) (numberp time))
+ time)
+ (t
+ idle)))
(timer
(cond
diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el
index f33eb910c6..f5e1c5ad69 100644
--- a/lisp/gnus/gnus-fun.el
+++ b/lisp/gnus/gnus-fun.el
@@ -278,6 +278,10 @@ colors of the displayed X-Faces."
values))
(mapconcat 'identity values " ")))
+(defun gnus-funcall-no-warning (function &rest args)
+ (when (fboundp function)
+ (apply function args)))
+
(provide 'gnus-fun)
;;; gnus-fun.el ends here
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 2f6fc0ccd1..8c7d016597 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2388,7 +2388,7 @@ specified by `gnus-gmane-group-download-format'."
group start (+ start range)))
(write-region (point-min) (point-max) tmpfile)
(gnus-group-read-ephemeral-group
- (format "%s.start-%s.range-%s" group start range)
+ (format "nndoc+ephemeral:%s.start-%s.range-%s" group start range)
`(nndoc ,tmpfile
(nndoc-article-type mbox))))
(delete-file tmpfile)))
@@ -2481,7 +2481,8 @@ the bug number, and browsing the URL must return mbox output."
"/.*$" ""))))
(write-region (point-min) (point-max) tmpfile)
(gnus-group-read-ephemeral-group
- "gnus-read-ephemeral-bug"
+ (format "nndoc+ephemeral:bug#%s"
+ (mapconcat 'number-to-string ids ","))
`(nndoc ,tmpfile
(nndoc-article-type mbox))
nil window-conf))
@@ -4670,6 +4671,8 @@ you the groups that have both dormant articles and cached articles."
(setq mark gnus-expirable-mark))
(setq mark (gnus-request-update-mark
group article mark))
+ (gnus-request-set-mark
+ group (list (list (list article) 'add '(read))))
(gnus-mark-article-as-read article mark)
(setq gnus-newsgroup-active (gnus-active group))
(when active
diff --git a/lisp/gnus/gnus-logic.el b/lisp/gnus/gnus-logic.el
index 954295438c..a440b77993 100644
--- a/lisp/gnus/gnus-logic.el
+++ b/lisp/gnus/gnus-logic.el
@@ -180,46 +180,51 @@
(setq header "article"))
(with-current-buffer nntp-server-buffer
(let* ((request-func (cond ((string= "head" header)
- 'gnus-request-head)
- ((string= "body" header)
- 'gnus-request-body)
- (t 'gnus-request-article)))
- ofunc article)
+ 'gnus-request-head)
+ ;; We need to peek at the headers to detect the
+ ;; content encoding
+ ((string= "body" header)
+ 'gnus-request-article)
+ (t 'gnus-request-article)))
+ ofunc article handles)
;; Not all backends support partial fetching. In that case, we
;; just fetch the entire article.
(unless (gnus-check-backend-function
- (intern (concat "request-" header))
- gnus-newsgroup-name)
- (setq ofunc request-func)
- (setq request-func 'gnus-request-article))
+ (intern (concat "request-" header))
+ gnus-newsgroup-name)
+ (setq ofunc request-func)
+ (setq request-func 'gnus-request-article))
(setq article (mail-header-number gnus-advanced-headers))
(gnus-message 7 "Scoring article %s..." article)
(when (funcall request-func article gnus-newsgroup-name)
- (goto-char (point-min))
- ;; If just parts of the article is to be searched and the
- ;; backend didn't support partial fetching, we just narrow to
- ;; the relevant parts.
- (when ofunc
- (if (eq ofunc 'gnus-request-head)
- (narrow-to-region
- (point)
- (or (search-forward "\n\n" nil t) (point-max)))
- (narrow-to-region
- (or (search-forward "\n\n" nil t) (point))
- (point-max))))
- (let* ((case-fold-search (not (eq (downcase (symbol-name type))
- (symbol-name type))))
- (search-func
- (cond ((memq type '(r R regexp Regexp))
- 're-search-forward)
- ((memq type '(s S string String))
- 'search-forward)
- (t
- (error "Invalid match type: %s" type)))))
- (goto-char (point-min))
- (prog1
- (funcall search-func match nil t)
- (widen)))))))
+ (when (string= "body" header)
+ (setq handles (gnus-score-decode-text-parts)))
+ (goto-char (point-min))
+ ;; If just parts of the article is to be searched and the
+ ;; backend didn't support partial fetching, we just narrow to
+ ;; the relevant parts.
+ (when ofunc
+ (if (eq ofunc 'gnus-request-head)
+ (narrow-to-region
+ (point)
+ (or (search-forward "\n\n" nil t) (point-max)))
+ (narrow-to-region
+ (or (search-forward "\n\n" nil t) (point))
+ (point-max))))
+ (let* ((case-fold-search (not (eq (downcase (symbol-name type))
+ (symbol-name type))))
+ (search-func
+ (cond ((memq type '(r R regexp Regexp))
+ 're-search-forward)
+ ((memq type '(s S string String))
+ 'search-forward)
+ (t
+ (error "Invalid match type: %s" type)))))
+ (goto-char (point-min))
+ (prog1
+ (funcall search-func match nil t)
+ (widen)))
+ (when handles (mm-destroy-parts handles))))))
(provide 'gnus-logic)
diff --git a/lisp/gnus/gnus-notifications.el b/lisp/gnus/gnus-notifications.el
index c512995899..5104a56c6e 100644
--- a/lisp/gnus/gnus-notifications.el
+++ b/lisp/gnus/gnus-notifications.el
@@ -29,13 +29,16 @@
;;; Code:
-(require 'notifications nil t)
+(ignore-errors
+ (require 'notifications))
(require 'gnus-sum)
(require 'gnus-group)
(require 'gnus-int)
(require 'gnus-art)
(require 'gnus-util)
-(require 'google-contacts nil t) ; Optional
+(ignore-errors
+ (require 'google-contacts)) ; Optional
+(require 'gnus-fun)
(defgroup gnus-notifications nil
"Send notifications on new message in Gnus."
@@ -81,12 +84,14 @@ not get notifications."
"Send a notification about a new mail.
Return a notification id if any, or t on success."
(if (fboundp 'notifications-notify)
- (notifications-notify
+ (gnus-funcall-no-warning
+ 'notifications-notify
:title from
:body subject
:actions '("read" "Read")
:on-action 'gnus-notifications-action
- :app-icon (image-search-load-path "gnus/gnus.png")
+ :app-icon (gnus-funcall-no-warning
+ 'image-search-load-path "gnus/gnus.png")
:app-name "Gnus"
:category "email.arrived"
:timeout gnus-notifications-timeout
@@ -100,7 +105,8 @@ Return a notification id if any, or t on success."
(let ((google-photo (when (and gnus-notifications-use-google-contacts
(fboundp 'google-contacts-get-photo))
(ignore-errors
- (google-contacts-get-photo mail-address)))))
+ (gnus-funcall-no-warning
+ 'google-contacts-get-photo mail-address)))))
(if google-photo
google-photo
(when gnus-notifications-use-gravatar
@@ -160,8 +166,10 @@ This is typically a function to add in
(or (mail-fetch-field "From") "")))
(address (cadr address-components)))
;; Ignore mails from ourselves
- (unless (gnus-string-match-p gnus-ignored-from-addresses
- address)
+ (unless (and gnus-ignored-from-addresses
+ address
+ (gnus-string-match-p gnus-ignored-from-addresses
+ address))
(let* ((photo-file (gnus-notifications-get-photo-file address))
(notification-id (gnus-notifications-notify
(or (car address-components) address)
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index f24d889216..f215b84551 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -1717,105 +1717,140 @@ score in `gnus-newsgroup-scored' by SCORE."
(setq entries rest)))))
nil)
+(defun gnus-score-decode-text-parts ()
+ (labels ((mm-text-parts (handle)
+ (cond ((stringp (car handle))
+ (let ((parts (mapcan #'mm-text-parts (cdr handle))))
+ (if (equal "multipart/alternative" (car handle))
+ ;; pick the first supported alternative
+ (list (car parts))
+ parts)))
+
+ ((bufferp (car handle))
+ (when (string-match "^text/" (mm-handle-media-type handle))
+ (list handle)))
+
+ (t (mapcan #'mm-text-parts handle))))
+ (my-mm-display-part (handle)
+ (when handle
+ (save-restriction
+ (narrow-to-region (point) (point))
+ (mm-display-inline handle)
+ (goto-char (point-max))))))
+
+ (let (;(mm-text-html-renderer 'w3m-standalone)
+ (handles (mm-dissect-buffer t)))
+ (save-excursion
+ (article-goto-body)
+ (delete-region (point) (point-max))
+ (mapc #'my-mm-display-part (mm-text-parts handles))
+ handles))))
+
(defun gnus-score-body (scores header now expire &optional trace)
- (if gnus-agent-fetching
- nil
- (save-excursion
- (setq gnus-scores-articles
- (sort gnus-scores-articles
- (lambda (a1 a2)
- (< (mail-header-number (car a1))
- (mail-header-number (car a2))))))
- (set-buffer nntp-server-buffer)
- (save-restriction
- (let* ((buffer-read-only nil)
- (articles gnus-scores-articles)
- (all-scores scores)
- (request-func (cond ((string= "head" header)
- 'gnus-request-head)
- ((string= "body" header)
- 'gnus-request-body)
- (t 'gnus-request-article)))
- entries alist ofunc article last)
- (when articles
- (setq last (mail-header-number (caar (last articles))))
- ;; Not all backends support partial fetching. In that case,
- ;; we just fetch the entire article.
- (unless (gnus-check-backend-function
- (and (string-match "^gnus-" (symbol-name request-func))
- (intern (substring (symbol-name request-func)
- (match-end 0))))
- gnus-newsgroup-name)
- (setq ofunc request-func)
- (setq request-func 'gnus-request-article))
- (while articles
- (setq article (mail-header-number (caar articles)))
- (gnus-message 7 "Scoring article %s of %s..." article last)
- (widen)
- (when (funcall request-func article gnus-newsgroup-name)
- (goto-char (point-min))
- ;; If just parts of the article is to be searched, but the
- ;; backend didn't support partial fetching, we just narrow
- ;; to the relevant parts.
- (when ofunc
- (if (eq ofunc 'gnus-request-head)
- (narrow-to-region
- (point)
- (or (search-forward "\n\n" nil t) (point-max)))
- (narrow-to-region
- (or (search-forward "\n\n" nil t) (point))
- (point-max))))
- (setq scores all-scores)
- ;; Find matches.
- (while scores
- (setq alist (pop scores)
- entries (assoc header alist))
- (while (cdr entries) ;First entry is the header index.
- (let* ((rest (cdr entries))
- (kill (car rest))
- (match (nth 0 kill))
- (type (or (nth 3 kill) 's))
- (score (or (nth 1 kill)
- gnus-score-interactive-default-score))
- (date (nth 2 kill))
- (found nil)
- (case-fold-search
- (not (or (eq type 'R) (eq type 'S)
- (eq type 'Regexp) (eq type 'String))))
- (search-func
- (cond ((or (eq type 'r) (eq type 'R)
- (eq type 'regexp) (eq type 'Regexp))
- 're-search-forward)
- ((or (eq type 's) (eq type 'S)
- (eq type 'string) (eq type 'String))
- 'search-forward)
- (t
- (error "Invalid match type: %s" type)))))
- (goto-char (point-min))
- (when (funcall search-func match nil t)
- ;; Found a match, update scores.
- (setcdr (car articles) (+ score (cdar articles)))
- (setq found t)
- (when trace
- (push
- (cons (car-safe (rassq alist gnus-score-cache))
- kill)
- gnus-score-trace)))
- ;; Update expire date
- (unless trace
- (cond
- ((null date)) ;Permanent entry.
- ((and found gnus-update-score-entry-dates)
- ;; Match, update date.
- (gnus-score-set 'touched '(t) alist)
- (setcar (nthcdr 2 kill) now))
- ((and expire (< date expire)) ;Old entry, remove.
- (gnus-score-set 'touched '(t) alist)
- (setcdr entries (cdr rest))
- (setq rest entries))))
- (setq entries rest)))))
- (setq articles (cdr articles)))))))
- nil))
+ (if gnus-agent-fetching
+ nil
+ (save-excursion
+ (setq gnus-scores-articles
+ (sort gnus-scores-articles
+ (lambda (a1 a2)
+ (< (mail-header-number (car a1))
+ (mail-header-number (car a2))))))
+ (set-buffer nntp-server-buffer)
+ (save-restriction
+ (let* ((buffer-read-only nil)
+ (articles gnus-scores-articles)
+ (all-scores scores)
+ (request-func (cond ((string= "head" header)
+ 'gnus-request-head)
+ ;; We need to peek at the headers to detect
+ ;; the content encoding
+ ((string= "body" header)
+ 'gnus-request-article)
+ (t 'gnus-request-article)))
+ entries alist ofunc article last)
+ (when articles
+ (setq last (mail-header-number (caar (last articles))))
+ ;; Not all backends support partial fetching. In that case,
+ ;; we just fetch the entire article.
+ (unless (gnus-check-backend-function
+ (and (string-match "^gnus-" (symbol-name request-func))
+ (intern (substring (symbol-name request-func)
+ (match-end 0))))
+ gnus-newsgroup-name)
+ (setq ofunc request-func)
+ (setq request-func 'gnus-request-article))
+ (while articles
+ (setq article (mail-header-number (caar articles)))
+ (gnus-message 7 "Scoring article %s of %s..." article last)
+ (widen)
+ (let (handles)
+ (when (funcall request-func article gnus-newsgroup-name)
+ (when (string= "body" header)
+ (setq handles (gnus-score-decode-text-parts)))
+ (goto-char (point-min))
+ ;; If just parts of the article is to be searched, but the
+ ;; backend didn't support partial fetching, we just narrow
+ ;; to the relevant parts.
+ (when ofunc
+ (if (eq ofunc 'gnus-request-head)
+ (narrow-to-region
+ (point)
+ (or (search-forward "\n\n" nil t) (point-max)))
+ (narrow-to-region
+ (or (search-forward "\n\n" nil t) (point))
+ (point-max))))
+ (setq scores all-scores)
+ ;; Find matches.
+ (while scores
+ (setq alist (pop scores)
+ entries (assoc header alist))
+ (while (cdr entries) ;First entry is the header index.
+ (let* ((rest (cdr entries))
+ (kill (car rest))
+ (match (nth 0 kill))
+ (type (or (nth 3 kill) 's))
+ (score (or (nth 1 kill)
+ gnus-score-interactive-default-score))
+ (date (nth 2 kill))
+ (found nil)
+ (case-fold-search
+ (not (or (eq type 'R) (eq type 'S)
+ (eq type 'Regexp) (eq type 'String))))
+ (search-func
+ (cond ((or (eq type 'r) (eq type 'R)
+ (eq type 'regexp) (eq type 'Regexp))
+ 're-search-forward)
+ ((or (eq type 's) (eq type 'S)
+ (eq type 'string) (eq type 'String))
+ 'search-forward)
+ (t
+ (error "Invalid match type: %s" type)))))
+ (goto-char (point-min))
+ (when (funcall search-func match nil t)
+ ;; Found a match, update scores.
+ (setcdr (car articles) (+ score (cdar articles)))
+ (setq found t)
+ (when trace
+ (push
+ (cons (car-safe (rassq alist gnus-score-cache))
+ kill)
+ gnus-score-trace)))
+ ;; Update expire date
+ (unless trace
+ (cond
+ ((null date)) ;Permanent entry.
+ ((and found gnus-update-score-entry-dates)
+ ;; Match, update date.
+ (gnus-score-set 'touched '(t) alist)
+ (setcar (nthcdr 2 kill) now))
+ ((and expire (< date expire)) ;Old entry, remove.
+ (gnus-score-set 'touched '(t) alist)
+ (setcdr entries (cdr rest))
+ (setq rest entries))))
+ (setq entries rest))))
+ (when handles (mm-destroy-parts handles))))
+ (setq articles (cdr articles)))))))
+ nil))
(defun gnus-score-thread (scores header now expire &optional trace)
(gnus-score-followup scores header now expire trace t))
diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el
index 66509c939d..f58cb80311 100644
--- a/lisp/gnus/gnus-srvr.el
+++ b/lisp/gnus/gnus-srvr.el
@@ -490,8 +490,7 @@ The following commands are available:
(error "No such server: %s" server))
(gnus-server-set-status method 'ok)
(prog1
- (or (gnus-open-server method)
- (progn (message "Couldn't open %s" server) nil))
+ (gnus-open-server method)
(gnus-server-update-server server)
(gnus-server-position-point))))
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 26178afa86..f5e1077f8c 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -1926,6 +1926,18 @@ Same as `string-match' except this function does not change the match data."
(save-match-data
(string-match regexp string start))))
+(if (fboundp 'string-prefix-p)
+ (defalias 'gnus-string-prefix-p 'string-prefix-p)
+ (defun gnus-string-prefix-p (str1 str2 &optional ignore-case)
+ "Return non-nil if STR1 is a prefix of STR2.
+If IGNORE-CASE is non-nil, the comparison is done without paying attention
+to case differences."
+ (and (<= (length str1) (length str2))
+ (let ((prefix (substring str2 0 (length str1))))
+ (if ignore-case
+ (string-equal (downcase str1) (downcase prefix))
+ (string-equal str1 prefix))))))
+
(eval-and-compile
(if (fboundp 'macroexpand-all)
(defalias 'gnus-macroexpand-all 'macroexpand-all)
@@ -1952,6 +1964,11 @@ definitions to shadow the loaded ones for use in file byte-compilation."
(defun gnus-bound-and-true-p (sym)
(and (boundp sym) (symbol-value sym)))
+(if (fboundp 'timer--function)
+ (defalias 'gnus-timer--function 'timer--function)
+ (defun gnus-timer--function (timer)
+ (elt timer 5)))
+
(provide 'gnus-util)
;;; gnus-util.el ends here
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 5862e7807a..8fbde5c8ec 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -3824,12 +3824,28 @@ You should probably use `gnus-find-method-for-group' instead."
"Go through PARAMETERS and expand them according to the match data."
(let (new)
(dolist (elem parameters)
- (if (and (stringp (cdr elem))
- (string-match "\\\\[0-9&]" (cdr elem)))
- (push (cons (car elem)
- (gnus-expand-group-parameter match (cdr elem) group))
- new)
- (push elem new)))
+ (cond
+ ((and (stringp (cdr elem))
+ (string-match "\\\\[0-9&]" (cdr elem)))
+ (push (cons (car elem)
+ (gnus-expand-group-parameter match (cdr elem) group))
+ new))
+ ;; For `sieve' group parameters, perform substitutions for every
+ ;; string within the match rule. This allows for parameters such
+ ;; as:
+ ;; ("list\\.\\(.*\\)"
+ ;; (sieve header :is "list-id" "<\\1.domain.org>"))
+ ((eq 'sieve (car elem))
+ (push (mapcar (lambda (sieve-elem)
+ (if (and (stringp sieve-elem)
+ (string-match "\\\\[0-9&]" sieve-elem))
+ (gnus-expand-group-parameter match sieve-elem
+ group)
+ sieve-elem))
+ (cdr elem))
+ new))
+ (t
+ (push elem new))))
new))
(defun gnus-group-fast-parameter (group symbol &optional allow-list)
@@ -3861,9 +3877,20 @@ The function `gnus-group-find-parameter' will do that for you."
(when this-result
(setq result (car this-result))
;; Expand if necessary.
- (if (and (stringp result) (string-match "\\\\[0-9&]" result))
- (setq result (gnus-expand-group-parameter
- (car head) result group)))))))
+ (cond
+ ((and (stringp result) (string-match "\\\\[0-9&]" result))
+ (setq result (gnus-expand-group-parameter
+ (car head) result group)))
+ ;; For `sieve' group parameters, perform substitutions
+ ;; for every string within the match rule (see above).
+ ((eq symbol 'sieve)
+ (setq result
+ (mapcar (lambda (elem)
+ (if (stringp elem)
+ (gnus-expand-group-parameter (car head)
+ elem group)
+ elem))
+ result))))))))
;; Done.
result))))
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 18088423eb..42911ce064 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -3292,11 +3292,33 @@ or in the synonym headers, defined by `message-header-synonyms'."
(defun message-insert-newsgroups ()
"Insert the Newsgroups header from the article being replied to."
(interactive)
- (when (and (message-position-on-field "Newsgroups")
- (mail-fetch-field "newsgroups")
- (not (string-match "\\` *\\'" (mail-fetch-field "newsgroups"))))
- (insert ","))
- (insert (or (message-fetch-reply-field "newsgroups") "")))
+ (let ((old-newsgroups (mail-fetch-field "newsgroups"))
+ (new-newsgroups (message-fetch-reply-field "newsgroups"))
+ (first t)
+ insert-newsgroups)
+ (message-position-on-field "Newsgroups")
+ (cond
+ ((not new-newsgroups)
+ (error "No Newsgroups to insert"))
+ ((not old-newsgroups)
+ (insert new-newsgroups))
+ (t
+ (setq new-newsgroups (split-string new-newsgroups "[, ]+")
+ old-newsgroups (split-string old-newsgroups "[, ]+"))
+ (dolist (group new-newsgroups)
+ (unless (member group old-newsgroups)
+ (push group insert-newsgroups)))
+ (if (null insert-newsgroups)
+ (error "Newgroup%s already in the header"
+ (if (> (length new-newsgroups) 1)
+ "s" ""))
+ (when old-newsgroups
+ (setq first nil))
+ (dolist (group insert-newsgroups)
+ (unless first
+ (insert ","))
+ (setq first nil)
+ (insert group)))))))
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index 7139a528e1..74a693a9c6 100644
--- a/lisp/gnus/nnmaildir.el
+++ b/lisp/gnus/nnmaildir.el
@@ -77,6 +77,56 @@
(defconst nnmaildir-version "Gnus")
+(defconst nnmaildir-flag-mark-mapping
+ '((?F . tick)
+ (?R . reply)
+ (?S . read))
+ "Alist mapping Maildir filename flags to Gnus marks.
+Maildir filenames are of the form \"unique-id:2,FLAGS\",
+where FLAGS are a string of characters in ASCII order.
+Some of the FLAGS correspond to Gnus marks.")
+
+(defsubst nnmaildir--mark-to-flag (mark)
+ "Find the Maildir flag that corresponds to MARK (an atom).
+Return a character, or `nil' if not found.
+See `nnmaildir-flag-mark-mapping'."
+ (car (rassq mark nnmaildir-flag-mark-mapping)))
+
+(defsubst nnmaildir--flag-to-mark (flag)
+ "Find the Gnus mark that corresponds to FLAG (a character).
+Return an atom, or `nil' if not found.
+See `nnmaildir-flag-mark-mapping'."
+ (cdr (assq flag nnmaildir-flag-mark-mapping)))
+
+(defun nnmaildir--ensure-suffix (filename)
+ "Ensure that FILENAME contains the suffix \":2,\"."
+ (if (gnus-string-match-p ":2," filename)
+ filename
+ (concat filename ":2,")))
+
+(defun nnmaildir--add-flag (flag suffix)
+ "Return a copy of SUFFIX where FLAG is set.
+SUFFIX should start with \":2,\"."
+ (unless (gnus-string-match-p "^:2," suffix)
+ (error "Invalid suffix `%s'" suffix))
+ (let* ((flags (substring suffix 3))
+ (flags-as-list (append flags nil))
+ (new-flags
+ (concat (gnus-delete-duplicates
+ ;; maildir flags must be sorted
+ (sort (cons flag flags-as-list) '<)))))
+ (concat ":2," new-flags)))
+
+(defun nnmaildir--remove-flag (flag suffix)
+ "Return a copy of SUFFIX where FLAG is cleared.
+SUFFIX should start with \":2,\"."
+ (unless (gnus-string-match-p "^:2," suffix)
+ (error "Invalid suffix `%s'" suffix))
+ (let* ((flags (substring suffix 3))
+ (flags-as-list (append flags nil))
+ (new-flags (concat (delq flag flags-as-list))))
+ (concat ":2," new-flags)))
+
(defvar nnmaildir-article-file-name nil
"*The filename of the most recently requested article. This variable is set
by nnmaildir-request-article.")
@@ -152,6 +202,16 @@ by nnmaildir-request-article.")
(gnm nil) ;; flag: split from mail-sources?
(target-prefix nil :type string)) ;; symlink target prefix
+(defun nnmaildir--article-set-flags (article new-suffix curdir)
+ (let* ((prefix (nnmaildir--art-prefix article))
+ (suffix (nnmaildir--art-suffix article))
+ (article-file (concat curdir prefix suffix))
+ (new-name (concat curdir prefix new-suffix)))
+ (unless (file-exists-p article-file)
+ (error "Couldn't find article file %s" article-file))
+ (rename-file article-file new-name 'replace)
+ (setf (nnmaildir--art-suffix article) new-suffix)))
+
(defun nnmaildir--expired-article (group article)
(setf (nnmaildir--art-nov article) nil)
(let ((flist (nnmaildir--grp-flist group))
@@ -208,29 +268,33 @@ by nnmaildir-request-article.")
(eval param))
(defmacro nnmaildir--with-nntp-buffer (&rest body)
+ (declare (debug (body)))
`(with-current-buffer nntp-server-buffer
,@body))
(defmacro nnmaildir--with-work-buffer (&rest body)
+ (declare (debug (body)))
`(with-current-buffer (get-buffer-create " *nnmaildir work*")
,@body))
(defmacro nnmaildir--with-nov-buffer (&rest body)
+ (declare (debug (body)))
`(with-current-buffer (get-buffer-create " *nnmaildir nov*")
,@body))
(defmacro nnmaildir--with-move-buffer (&rest body)
+ (declare (debug (body)))
`(with-current-buffer (get-buffer-create " *nnmaildir move*")
,@body))
-(defmacro nnmaildir--subdir (dir subdir)
- `(file-name-as-directory (concat ,dir ,subdir)))
-(defmacro nnmaildir--srvgrp-dir (srv-dir gname)
- `(nnmaildir--subdir ,srv-dir ,gname))
-(defmacro nnmaildir--tmp (dir) `(nnmaildir--subdir ,dir "tmp"))
-(defmacro nnmaildir--new (dir) `(nnmaildir--subdir ,dir "new"))
-(defmacro nnmaildir--cur (dir) `(nnmaildir--subdir ,dir "cur"))
-(defmacro nnmaildir--nndir (dir) `(nnmaildir--subdir ,dir ".nnmaildir"))
-(defmacro nnmaildir--nov-dir (dir) `(nnmaildir--subdir ,dir "nov"))
-(defmacro nnmaildir--marks-dir (dir) `(nnmaildir--subdir ,dir "marks"))
-(defmacro nnmaildir--num-dir (dir) `(nnmaildir--subdir ,dir "num"))
+(defsubst nnmaildir--subdir (dir subdir)
+ (file-name-as-directory (concat dir subdir)))
+(defsubst nnmaildir--srvgrp-dir (srv-dir gname)
+ (nnmaildir--subdir srv-dir gname))
+(defsubst nnmaildir--tmp (dir) (nnmaildir--subdir dir "tmp"))
+(defsubst nnmaildir--new (dir) (nnmaildir--subdir dir "new"))
+(defsubst nnmaildir--cur (dir) (nnmaildir--subdir dir "cur"))
+(defsubst nnmaildir--nndir (dir) (nnmaildir--subdir dir ".nnmaildir"))
+(defsubst nnmaildir--nov-dir (dir) (nnmaildir--subdir dir "nov"))
+(defsubst nnmaildir--marks-dir (dir) (nnmaildir--subdir dir "marks"))
+(defsubst nnmaildir--num-dir (dir) (nnmaildir--subdir dir "num"))
(defmacro nnmaildir--unlink (file-arg)
`(let ((file ,file-arg))
@@ -305,6 +369,7 @@ by nnmaildir-request-article.")
string)
(defmacro nnmaildir--condcase (errsym body &rest handler)
+ (declare (debug (sexp form body)))
`(condition-case ,errsym
(let ((system-messages-locale "C")) ,body)
(error . ,handler)))
@@ -759,7 +824,7 @@ by nnmaildir-request-article.")
(dolist (file (funcall ls ndir nil "\\`[^.]" 'nosort))
(setq x (concat ndir file))
(and (time-less-p (nth 5 (file-attributes x)) (current-time))
- (rename-file x (concat cdir file ":2,"))))
+ (rename-file x (concat cdir (nnmaildir--ensure-suffix file)))))
(setf (nnmaildir--grp-new group) nattr))
(setq cattr (nth 5 (file-attributes cdir)))
(if (equal cattr (nnmaildir--grp-cur group))
@@ -784,11 +849,23 @@ by nnmaildir-request-article.")
cdir (nnmaildir--marks-dir nndir)
ndir (nnmaildir--subdir cdir "tick")
cdir (nnmaildir--subdir cdir "read"))
- (dolist (file files)
- (setq file (car file))
- (if (or (not (file-exists-p (concat cdir file)))
- (file-exists-p (concat ndir file)))
- (setq num (1+ num)))))
+ (dolist (prefix-suffix files)
+ (let ((prefix (car prefix-suffix))
+ (suffix (cdr prefix-suffix)))
+ ;; increase num for each unread or ticked article
+ (when (or
+ ;; first look for marks in suffix, if it's valid...
+ (when (and (stringp suffix)
+ (gnus-string-prefix-p ":2," suffix))
+ (or
+ (not (gnus-string-match-p
+ (string (nnmaildir--mark-to-flag 'read)) suffix))
+ (gnus-string-match-p
+ (string (nnmaildir--mark-to-flag 'tick)) suffix)))
+ ;; then look in marks directories
+ (not (file-exists-p (concat cdir prefix)))
+ (file-exists-p (concat ndir prefix)))
+ (incf num)))))
(setf (nnmaildir--grp-cache group) (make-vector num nil))
(let ((inhibit-quit t))
(set (intern gname groups) group))
@@ -916,12 +993,15 @@ by nnmaildir-request-article.")
"\n")))))
'group)
-(defun nnmaildir-request-marks (gname info &optional server)
- (let ((group (nnmaildir--prepare server gname))
- pgname flist always-marks never-marks old-marks dotfile num dir
- markdirs marks mark ranges markdir article read end new-marks ls
- old-mmth new-mmth mtime mark-sym existing missing deactivate-mark
- article-list)
+(defun nnmaildir-request-update-info (gname info &optional server)
+ (let* ((group (nnmaildir--prepare server gname))
+ (curdir (nnmaildir--cur
+ (nnmaildir--srvgrp-dir
+ (nnmaildir--srv-dir nnmaildir--cur-server) gname)))
+ (curdir-mtime (nth 5 (file-attributes curdir)))
+ pgname flist always-marks never-marks old-marks dotfile num dir
+ all-marks marks mark ranges markdir read end new-marks ls
+ old-mmth new-mmth mtime mark-sym existing missing deactivate-mark)
(catch 'return
(unless group
(setf (nnmaildir--srv-error nnmaildir--cur-server)
@@ -950,34 +1030,71 @@ by nnmaildir-request-article.")
dir (nnmaildir--nndir dir)
dir (nnmaildir--marks-dir dir)
ls (nnmaildir--group-ls nnmaildir--cur-server pgname)
- markdirs (funcall ls dir nil "\\`[^.]" 'nosort)
- new-mmth (nnmaildir--up2-1 (length markdirs))
+ all-marks (gnus-delete-duplicates
+ ;; get mark names from mark dirs and from flag
+ ;; mappings
+ (append
+ (mapcar 'cdr nnmaildir-flag-mark-mapping)
+ (mapcar 'intern (funcall ls dir nil "\\`[^.]" 'nosort))))
+ new-mmth (nnmaildir--up2-1 (length all-marks))
new-mmth (make-vector new-mmth 0)
old-mmth (nnmaildir--grp-mmth group))
- (dolist (mark markdirs)
- (setq markdir (nnmaildir--subdir dir mark)
- mark-sym (intern mark)
+ (dolist (mark all-marks)
+ (setq markdir (nnmaildir--subdir dir (symbol-name mark))
ranges nil)
(catch 'got-ranges
- (if (memq mark-sym never-marks) (throw 'got-ranges nil))
- (when (memq mark-sym always-marks)
+ (if (memq mark never-marks) (throw 'got-ranges nil))
+ (when (memq mark always-marks)
(setq ranges existing)
(throw 'got-ranges nil))
- (setq mtime (nth 5 (file-attributes markdir)))
- (set (intern mark new-mmth) mtime)
- (when (equal mtime (symbol-value (intern-soft mark old-mmth)))
- (setq ranges (assq mark-sym old-marks))
+ ;; Find the mtime for this mark. If this mark can be expressed as
+ ;; a filename flag, get the later of the mtimes for markdir and
+ ;; curdir, otherwise only the markdir counts.
+ (setq mtime
+ (let ((markdir-mtime (nth 5 (file-attributes markdir))))
+ (cond
+ ((null (nnmaildir--mark-to-flag mark))
+ markdir-mtime)
+ ((null markdir-mtime)
+ curdir-mtime)
+ ((null curdir-mtime)
+ ;; this should never happen...
+ markdir-mtime)
+ ((time-less-p markdir-mtime curdir-mtime)
+ curdir-mtime)
+ (t
+ markdir-mtime))))
+ (set (intern (symbol-name mark) new-mmth) mtime)
+ (when (equal mtime (symbol-value (intern-soft (symbol-name mark) old-mmth)))
+ (setq ranges (assq mark old-marks))
(if ranges (setq ranges (cdr ranges)))
(throw 'got-ranges nil))
- (setq article-list nil)
- (dolist (prefix (funcall ls markdir nil "\\`[^.]" 'nosort))
- (setq article (nnmaildir--flist-art flist prefix))
- (if article
- (setq article-list
- (cons (nnmaildir--art-num article) article-list))))
- (setq ranges (gnus-add-to-range ranges (sort article-list '<))))
- (if (eq mark-sym 'read) (setq read ranges)
- (if ranges (setq marks (cons (cons mark-sym ranges) marks)))))
+ (let ((article-list nil))
+ ;; Consider the article marked if it either has the flag in the
+ ;; filename, or is in the markdir. As you'd rarely remove a
+ ;; flag/mark, this should avoid losing information in the most
+ ;; common usage pattern.
+ (or
+ (let ((flag (nnmaildir--mark-to-flag mark)))
+ ;; If this mark has a corresponding maildir flag...
+ (when flag
+ (let ((regexp
+ (concat "\\`[^.].*:2,[A-Z]*" (string flag))))
+ ;; ...then find all files with that flag.
+ (dolist (filename (funcall ls curdir nil regexp 'nosort))
+ (let* ((prefix (car (split-string filename ":2,")))
+ (article (nnmaildir--flist-art flist prefix)))
+ (when article
+ (push (nnmaildir--art-num article) article-list)))))))
+ ;; Also check Gnus-specific mark directory, if it exists.
+ (when (file-directory-p markdir)
+ (dolist (prefix (funcall ls markdir nil "\\`[^.]" 'nosort))
+ (let ((article (nnmaildir--flist-art flist prefix)))
+ (when article
+ (push (nnmaildir--art-num article) article-list))))))
+ (setq ranges (gnus-add-to-range ranges (sort article-list '<)))))
+ (if (eq mark 'read) (setq read ranges)
+ (if ranges (setq marks (cons (cons mark ranges) marks)))))
(gnus-info-set-read info (gnus-range-add read missing))
(gnus-info-set-marks info marks 'extend)
(setf (nnmaildir--grp-mmth group) new-mmth)
@@ -1525,39 +1642,63 @@ by nnmaildir-request-article.")
didnt)))
(defun nnmaildir-request-set-mark (gname actions &optional server)
- (let ((group (nnmaildir--prepare server gname))
- (coding-system-for-write nnheader-file-coding-system)
- (buffer-file-coding-system nil)
- (file-coding-system-alist nil)
- del-mark del-action add-action set-action marksdir nlist
- ranges begin end article all-marks todo-marks mdir mfile
- pgname ls permarkfile deactivate-mark)
+ (let* ((group (nnmaildir--prepare server gname))
+ (curdir (nnmaildir--cur
+ (nnmaildir--srvgrp-dir
+ (nnmaildir--srv-dir nnmaildir--cur-server)
+ gname)))
+ (coding-system-for-write nnheader-file-coding-system)
+ (buffer-file-coding-system nil)
+ (file-coding-system-alist nil)
+ del-mark del-action add-action set-action marksdir nlist
+ ranges begin end article all-marks todo-marks mdir mfile
+ pgname ls permarkfile deactivate-mark)
(setq del-mark
(lambda (mark)
- (setq mfile (nnmaildir--subdir marksdir (symbol-name mark))
- mfile (concat mfile (nnmaildir--art-prefix article)))
- (nnmaildir--unlink mfile))
+ (let ((prefix (nnmaildir--art-prefix article))
+ (suffix (nnmaildir--art-suffix article))
+ (flag (nnmaildir--mark-to-flag mark)))
+ (when flag
+ ;; If this mark corresponds to a flag, remove the flag from
+ ;; the file name.
+ (nnmaildir--article-set-flags
+ article (nnmaildir--remove-flag flag suffix) curdir))
+ ;; We still want to delete the hardlink in the marks dir if
+ ;; present, regardless of whether this mark has a maildir flag or
+ ;; not, to avoid getting out of sync.
+ (setq mfile (nnmaildir--subdir marksdir (symbol-name mark))
+ mfile (concat mfile prefix))
+ (nnmaildir--unlink mfile)))
del-action (lambda (article) (mapcar del-mark todo-marks))
add-action
(lambda (article)
(mapcar
(lambda (mark)
- (setq mdir (nnmaildir--subdir marksdir (symbol-name mark))
- permarkfile (concat mdir ":")
- mfile (concat mdir (nnmaildir--art-prefix article)))
- (nnmaildir--condcase err (add-name-to-file permarkfile mfile)
- (cond
- ((nnmaildir--eexist-p err))
- ((nnmaildir--enoent-p err)
- (nnmaildir--mkdir mdir)
- (nnmaildir--mkfile permarkfile)
- (add-name-to-file permarkfile mfile))
- ((nnmaildir--emlink-p err)
- (let ((permarkfilenew (concat permarkfile "{new}")))
- (nnmaildir--mkfile permarkfilenew)
- (rename-file permarkfilenew permarkfile 'replace)
- (add-name-to-file permarkfile mfile)))
- (t (signal (car err) (cdr err))))))
+ (let ((prefix (nnmaildir--art-prefix article))
+ (suffix (nnmaildir--art-suffix article))
+ (flag (nnmaildir--mark-to-flag mark)))
+ (if flag
+ ;; If there is a corresponding maildir flag, just rename
+ ;; the file.
+ (nnmaildir--article-set-flags
+ article (nnmaildir--add-flag flag suffix) curdir)
+ ;; Otherwise, use nnmaildir-specific marks dir.
+ (setq mdir (nnmaildir--subdir marksdir (symbol-name mark))
+ permarkfile (concat mdir ":")
+ mfile (concat mdir prefix))
+ (nnmaildir--condcase err (add-name-to-file permarkfile mfile)
+ (cond
+ ((nnmaildir--eexist-p err))
+ ((nnmaildir--enoent-p err)
+ (nnmaildir--mkdir mdir)
+ (nnmaildir--mkfile permarkfile)
+ (add-name-to-file permarkfile mfile))
+ ((nnmaildir--emlink-p err)
+ (let ((permarkfilenew (concat permarkfile "{new}")))
+ (nnmaildir--mkfile permarkfilenew)
+ (rename-file permarkfilenew permarkfile 'replace)
+ (add-name-to-file permarkfile mfile)))
+ (t (signal (car err) (cdr err))))))))
todo-marks))
set-action (lambda (article)
(funcall add-action article)
@@ -1581,7 +1722,12 @@ by nnmaildir-request-article.")
pgname (nnmaildir--pgname nnmaildir--cur-server gname)
ls (nnmaildir--group-ls nnmaildir--cur-server pgname)
all-marks (funcall ls marksdir nil "\\`[^.]" 'nosort)
- all-marks (mapcar 'intern all-marks))
+ all-marks (gnus-delete-duplicates
+ ;; get mark names from mark dirs and from flag
+ ;; mappings
+ (append
+ (mapcar 'cdr nnmaildir-flag-mark-mapping)
+ (mapcar 'intern all-marks))))
(dolist (action actions)
(setq ranges (car action)
todo-marks (caddr action))
diff --git a/lisp/gnus/qp.el b/lisp/gnus/qp.el
index 87252684a4..c4487c68b5 100644
--- a/lisp/gnus/qp.el
+++ b/lisp/gnus/qp.el
@@ -53,10 +53,7 @@ them into characters should be done separately."
;; or both of which are lowercase letters in "abcdef", is
;; formally illegal. A robust implementation might choose to
;; recognize them as the corresponding uppercase letters.''
- (let ((case-fold-search t)
- (decode-hex #'(lambda (n1 n2)
- (+ (* (if (<= n1 ?9) (- n1 ?0) (+ (- n1 ?A) 10)) 16)
- (if (<= n2 ?9) (- n2 ?0) (+ (- n2 ?A) 10))))))
+ (let ((case-fold-search t))
(narrow-to-region from to)
;; Do this in case we're called from Gnus, say, in a buffer
;; which already contains non-ASCII characters which would
@@ -74,8 +71,15 @@ them into characters should be done separately."
(let* ((n (/ (- (match-end 0) (point)) 3))
(str (make-string n 0)))
(dotimes (i n)
- (aset str i (funcall decode-hex (char-after (1+ (point)))
- (char-after (+ 2 (point)))))
+ (let ((n1 (char-after (1+ (point))))
+ (n2 (char-after (+ 2 (point)))))
+ (aset str i
+ (+ (* 16 (- n1 (if (<= n1 ?9) ?0
+ (if (<= n1 ?F) (- ?A 10)
+ (- ?a 10)))))
+ (- n2 (if (<= n2 ?9) ?0
+ (if (<= n2 ?F) (- ?A 10)
+ (- ?a 10)))))))
(forward-char 3))
(delete-region (match-beginning 0) (match-end 0))
(insert str)))
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 5791f1225c..fa0484ff4e 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -936,7 +936,7 @@ file-local variable.\n")
(princ " This variable is safe as a file local variable ")
(princ "if its value\n satisfies the predicate ")
(princ (if (byte-code-function-p safe-var)
- "which is byte-compiled expression.\n"
+ "which is a byte-compiled expression.\n"
(format "`%s'.\n" safe-var))))
(if extra-line (terpri))
diff --git a/lisp/help.el b/lisp/help.el
index 19db7c255d..da11389d87 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -39,9 +39,10 @@
;; `help-window-point-marker' is a marker you can move to a valid
;; position of the buffer shown in the help window in order to override
;; the standard positioning mechanism (`point-min') chosen by
-;; `with-output-to-temp-buffer'. `with-help-window' has this point
-;; nowhere before exiting. Currently used by `view-lossage' to assert
-;; that the last keystrokes are always visible.
+;; `with-output-to-temp-buffer' and `with-temp-buffer-window'.
+;; `with-help-window' has this point nowhere before exiting. Currently
+;; used by `view-lossage' to assert that the last keystrokes are always
+;; visible.
(defvar help-window-point-marker (make-marker)
"Marker to override default `window-point' in help windows.")
@@ -584,6 +585,8 @@ temporarily enables it to allow getting help on disabled items and buttons."
(setq saved-yank-menu (copy-sequence yank-menu))
(menu-bar-update-yank-menu "(any string)" nil))
(setq key (read-key-sequence "Describe key (or click or menu item): "))
+ ;; Clear the echo area message (Bug#7014).
+ (message nil)
;; If KEY is a down-event, read and discard the
;; corresponding up-event. Note that there are also
;; down-events on scroll bars and mode lines: the actual
@@ -961,7 +964,11 @@ is currently activated with completion."
result))
;;; Automatic resizing of temporary buffers.
-(defcustom temp-buffer-max-height (lambda (buffer) (/ (- (frame-height) 2) 2))
+(defcustom temp-buffer-max-height
+ (lambda (buffer)
+ (if (eq (selected-window) (frame-root-window))
+ (/ (x-display-pixel-height) (frame-char-height) 2)
+ (/ (- (frame-height) 2) 2)))
"Maximum height of a window displaying a temporary buffer.
This is effective only when Temp Buffer Resize mode is enabled.
The value is the maximum height (in lines) which
@@ -972,16 +979,25 @@ buffer, and should return a positive integer. At the time the
function is called, the window to be resized is selected."
:type '(choice integer function)
:group 'help
- :version "20.4")
+ :version "24.2")
+
+(defcustom temp-buffer-resize-frames nil
+ "Non-nil means `temp-buffer-resize-mode' can resize frames.
+A frame can be resized if and only if its root window is a live
+window. The height of the root window is subject to the values of
+`temp-buffer-max-height' and `window-min-height'."
+ :type 'boolean
+ :version "24.2"
+ :group 'help)
(define-minor-mode temp-buffer-resize-mode
- "Toggle auto-shrinking temp buffer windows (Temp Buffer Resize mode).
+ "Toggle auto-resizing temporary buffer windows (Temp Buffer Resize Mode).
With a prefix argument ARG, enable Temp Buffer Resize mode if ARG
is positive, and disable it otherwise. If called from Lisp,
enable the mode if ARG is omitted or nil.
When Temp Buffer Resize mode is enabled, the windows in which we
-show a temporary buffer are automatically reduced in height to
+show a temporary buffer are automatically resized in height to
fit the buffer's contents, but never more than
`temp-buffer-max-height' nor less than `window-min-height'.
@@ -994,19 +1010,34 @@ and some others."
(add-hook 'temp-buffer-show-hook 'resize-temp-buffer-window 'append)
(remove-hook 'temp-buffer-show-hook 'resize-temp-buffer-window)))
-(defun resize-temp-buffer-window ()
- "Resize the selected window to fit its contents.
-Will not make it higher than `temp-buffer-max-height' nor smaller
-than `window-min-height'. Do nothing if the selected window is
-not vertically combined or some of its contents are scrolled out
-of view."
- (when (and (pos-visible-in-window-p (point-min))
- (window-combined-p))
- (fit-window-to-buffer
- nil
- (if (functionp temp-buffer-max-height)
- (funcall temp-buffer-max-height (window-buffer))
- temp-buffer-max-height))))
+(defun resize-temp-buffer-window (&optional window)
+ "Resize WINDOW to fit its contents.
+WINDOW can be any live window and defaults to the selected one.
+
+Do not make WINDOW higher than `temp-buffer-max-height' nor
+smaller than `window-min-height'. Do nothing if WINDOW is not
+vertically combined or some of its contents are scrolled out of
+view."
+ (setq window (window-normalize-window window t))
+ (let ((height (if (functionp temp-buffer-max-height)
+ (with-selected-window window
+ (funcall temp-buffer-max-height (window-buffer)))
+ temp-buffer-max-height)))
+ (cond
+ ((and (pos-visible-in-window-p (point-min) window)
+ (window-combined-p window))
+ (fit-window-to-buffer window height))
+ ((and temp-buffer-resize-frames
+ (eq window (frame-root-window window))
+ (memq (car (window-parameter window 'quit-restore))
+ ;; If 'same is too strong, we might additionally check
+ ;; whether the second element is 'frame.
+ '(same frame)))
+ (let ((frame (window-frame window)))
+ (fit-frame-to-buffer
+ frame (+ (frame-height frame)
+ (- (window-total-size window))
+ height)))))))
;;; Help windows.
(defcustom help-window-select 'other
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 644024a4b8..f92e2ab0af 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -52,14 +52,14 @@
;;
;; Setup:
;;
-;; Put the following code in your .emacs file. This turns on
+;; Put the following code in your init file. This turns on
;; hi-lock mode and adds a "Regexp Highlighting" entry
;; to the edit menu.
;;
;; (global-hi-lock-mode 1)
;;
;; To enable the use of patterns found in files (presumably placed
-;; there by hi-lock) include the following in your .emacs file:
+;; there by hi-lock) include the following in your init file:
;;
;; (setq hi-lock-file-patterns-policy 'ask)
;;
@@ -356,7 +356,7 @@ Hi-lock: end is found. A mode is excluded if it's in the list
"Possible archaic use of (hi-lock-mode).
Use (global-hi-lock-mode 1) in .emacs to enable hi-lock for all buffers,
use (hi-lock-mode 1) for individual buffers. For compatibility with Emacs
-versions before 22 use the following in your .emacs file:
+versions before 22 use the following in your init file:
(if (functionp 'global-hi-lock-mode)
(global-hi-lock-mode 1)
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index c6e799252a..7746146904 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -123,13 +123,13 @@ own!):
no upper limit on its size. The size will also be aligned to the
right.
-Thus, if you wanted to use these two formats, add
+Thus, if you wanted to use these two formats, the appropriate
+value for this variable would be
- (setq ibuffer-formats '((mark \" \" name)
- (mark modified read-only
- (name 16 16 :left) (size 6 -1 :right))))
-
-to your ~/.emacs file.
+ '((mark \" \" name)
+ (mark modified read-only
+ (name 16 16 :left)
+ (size 6 -1 :right)))
Using \\[ibuffer-switch-format], you can rotate the display between
the specified formats in the list."
diff --git a/lisp/ielm.el b/lisp/ielm.el
index c93f235d81..ba05bbcfc0 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -59,7 +59,7 @@ override the read-only-ness of IELM prompts is to call
`comint-kill-whole-line' or `comint-kill-region' with no
narrowing in effect. This way you will be certain that none of
the remaining prompts will be accidentally messed up. You may
-wish to put something like the following in your `.emacs' file:
+wish to put something like the following in your init file:
\(add-hook 'ielm-mode-hook
(lambda ()
diff --git a/lisp/image.el b/lisp/image.el
index 7801923c3f..99c0a74a51 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -645,8 +645,8 @@ number, play until that number of seconds has elapsed."
(while tail
(setq timer (car tail)
tail (cdr tail))
- (if (and (eq (aref timer 5) 'image-animate-timeout)
- (eq (car-safe (aref timer 6)) image))
+ (if (and (eq (timer--function timer) 'image-animate-timeout)
+ (eq (car-safe (timer--args timer)) image))
(setq tail nil)
(setq timer nil)))
timer))
diff --git a/lisp/info.el b/lisp/info.el
index fe4afd7216..5862e5e850 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1882,9 +1882,7 @@ If DIRECTION is `backward', search in the reverse direction."
(while (and (not give-up)
(or (null found)
(not (funcall isearch-filter-predicate beg-found found))))
- (let ((search-spaces-regexp
- (if (or (not isearch-mode) isearch-regexp)
- Info-search-whitespace-regexp)))
+ (let ((search-spaces-regexp Info-search-whitespace-regexp))
(if (if backward
(re-search-backward regexp bound t)
(re-search-forward regexp bound t))
@@ -1904,9 +1902,7 @@ If DIRECTION is `backward', search in the reverse direction."
(if (null Info-current-subfile)
(if isearch-mode
(signal 'search-failed (list regexp "end of manual"))
- (let ((search-spaces-regexp
- (if (or (not isearch-mode) isearch-regexp)
- Info-search-whitespace-regexp)))
+ (let ((search-spaces-regexp Info-search-whitespace-regexp))
(if backward
(re-search-backward regexp)
(re-search-forward regexp))))
@@ -1964,9 +1960,7 @@ If DIRECTION is `backward', search in the reverse direction."
(while (and (not give-up)
(or (null found)
(not (funcall isearch-filter-predicate beg-found found))))
- (let ((search-spaces-regexp
- (if (or (not isearch-mode) isearch-regexp)
- Info-search-whitespace-regexp)))
+ (let ((search-spaces-regexp Info-search-whitespace-regexp))
(if (if backward
(re-search-backward regexp nil t)
(re-search-forward regexp nil t))
@@ -2034,21 +2028,26 @@ If DIRECTION is `backward', search in the reverse direction."
(defun Info-isearch-search ()
(if Info-isearch-search
(lambda (string &optional bound noerror count)
- (Info-search
- (cond
- (isearch-word
- ;; Lax version of word search
- (let ((lax (not (or isearch-nonincremental
- (eq (length string)
- (length (isearch--state-string
- (car isearch-cmds))))))))
- (if (functionp isearch-word)
- (funcall isearch-word string lax)
- (word-search-regexp string lax))))
- (isearch-regexp string)
- (t (regexp-quote string)))
- bound noerror count
- (unless isearch-forward 'backward))
+ (let ((Info-search-whitespace-regexp
+ (if (if isearch-regexp
+ isearch-regexp-lax-whitespace
+ isearch-lax-whitespace)
+ search-whitespace-regexp)))
+ (Info-search
+ (cond
+ (isearch-word
+ ;; Lax version of word search
+ (let ((lax (not (or isearch-nonincremental
+ (eq (length string)
+ (length (isearch--state-string
+ (car isearch-cmds))))))))
+ (if (functionp isearch-word)
+ (funcall isearch-word string lax)
+ (word-search-regexp string lax))))
+ (isearch-regexp string)
+ (t (regexp-quote string)))
+ bound noerror count
+ (unless isearch-forward 'backward)))
(point))
(isearch-search-fun-default)))
@@ -4157,8 +4156,6 @@ Advanced commands:
'Info-isearch-push-state)
(set (make-local-variable 'isearch-filter-predicate)
'Info-isearch-filter)
- (set (make-local-variable 'search-whitespace-regexp)
- Info-search-whitespace-regexp)
(set (make-local-variable 'revert-buffer-function)
'Info-revert-buffer-function)
(Info-set-mode-line)
diff --git a/lisp/international/ogonek.el b/lisp/international/ogonek.el
index 39a8800111..3c34e5d9a2 100644
--- a/lisp/international/ogonek.el
+++ b/lisp/international/ogonek.el
@@ -224,13 +224,14 @@ The functions come in the following groups.
ogonek-prefix-to-encoding iso8859-2
The above default values can be changed by placing appropriate settings
- in the '~/.emacs' file:
+ in your init file:
(setq ogonek-prefix-char ?/)
(setq ogonek-prefix-to-encoding \"iso8859-2\")
- Instead of loading the whole library `ogonek' it may be better to
- autoload the needed functions, for example by placing in `~/.emacs':
+ Instead of loading the whole library `ogonek' it may be better
+ to autoload the needed functions, for example by adding the
+ following lines to your init file:
(autoload 'ogonek-how \"ogonek\")
(autoload 'ogonek-recode-region \"ogonek\")
diff --git a/lisp/isearch.el b/lisp/isearch.el
index e6e0a01566..04f5a7acc2 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1405,6 +1405,7 @@ Use `isearch-exit' to quit without signaling."
(interactive)
(setq isearch-word (unless (eq isearch-word 'isearch-symbol-regexp)
'isearch-symbol-regexp))
+ (if isearch-word (setq isearch-regexp nil))
(setq isearch-success t isearch-adjusted t)
(isearch-update))
@@ -1579,14 +1580,10 @@ way to run word replacements from Isearch is `M-s w ... M-%'."
;; set `search-upper-case' to nil to not call
;; `isearch-no-upper-case-p' in `perform-replace'
(search-upper-case nil)
- (replace-search-function
- (if (and isearch-lax-whitespace (not regexp-flag))
- #'search-forward-lax-whitespace
- replace-search-function))
- (replace-re-search-function
- (if (and isearch-regexp-lax-whitespace regexp-flag)
- #'re-search-forward-lax-whitespace
- replace-re-search-function))
+ (replace-lax-whitespace
+ isearch-lax-whitespace)
+ (replace-regexp-lax-whitespace
+ isearch-regexp-lax-whitespace)
;; Set `isearch-recursive-edit' to nil to prevent calling
;; `exit-recursive-edit' in `isearch-done' that terminates
;; the execution of this command when it is non-nil.
@@ -2956,10 +2953,14 @@ Attempt to do the search exactly the way the pending Isearch would."
(let ((case-fold-search isearch-lazy-highlight-case-fold-search)
(isearch-regexp isearch-lazy-highlight-regexp)
(isearch-word isearch-lazy-highlight-word)
+ (isearch-lax-whitespace
+ isearch-lazy-highlight-lax-whitespace)
+ (isearch-regexp-lax-whitespace
+ isearch-lazy-highlight-regexp-lax-whitespace)
+ (isearch-forward isearch-lazy-highlight-forward)
(search-invisible nil) ; don't match invisible text
(retry t)
(success nil)
- (isearch-forward isearch-lazy-highlight-forward)
(bound (if isearch-lazy-highlight-forward
(min (or isearch-lazy-highlight-end-limit (point-max))
(if isearch-lazy-highlight-wrapped
diff --git a/lisp/language/chinese.el b/lisp/language/chinese.el
index ac2afa373c..782b5a363a 100644
--- a/lisp/language/chinese.el
+++ b/lisp/language/chinese.el
@@ -110,7 +110,8 @@
(use-cjk-char-width-table 'zh_CN)))
(exit-function . use-default-char-width-table)
(coding-system chinese-iso-8bit iso-2022-cn chinese-hz)
- (coding-priority chinese-iso-8bit chinese-big5 iso-2022-cn)
+ (coding-priority chinese-iso-8bit chinese-gbk chinese-big5
+ iso-2022-cn)
(input-method . "chinese-py-punct")
(features china-util)
(sample-text . "Chinese ($AVPND(B,$AFUM(;0(B,$A::So(B) $ADc:C(B")
@@ -140,7 +141,8 @@
(use-cjk-char-width-table 'zh_HK)))
(exit-function . use-default-char-width-table)
(coding-system chinese-big5 chinese-iso-7bit)
- (coding-priority chinese-big5 iso-2022-cn chinese-iso-8bit)
+ (coding-priority chinese-big5 iso-2022-cn chinese-iso-8bit
+ chinese-gbk)
(input-method . "chinese-py-punct-b5")
(ctext-non-standard-encodings "big5-0")
(features china-util)
@@ -196,7 +198,7 @@
(exit-function . use-default-char-width-table)
(coding-system iso-2022-cn euc-tw)
(coding-priority iso-2022-cn euc-tw chinese-big5
- chinese-iso-8bit)
+ chinese-iso-8bit chinese-gbk)
(features china-util)
(input-method . "chinese-cns-quick")
;; Fixme: presumably it won't accept big5 now.
@@ -216,7 +218,7 @@ accepts Big5 for input also (which is then converted to CNS)."))
(exit-function . use-default-char-width-table)
(coding-system euc-tw iso-2022-cn)
(coding-priority euc-tw chinese-big5 iso-2022-cn
- chinese-iso-8bit)
+ chinese-iso-8bit chinese-gbk)
(features china-util)
(input-method . "chinese-cns-quick")
(documentation . "\
diff --git a/lisp/loadup.el b/lisp/loadup.el
index c70b417822..e0f5c6265b 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -102,6 +102,19 @@
(setq load-source-file-function 'load-with-code-conversion)
(load "files")
+;; Load-time macro-expansion can only take effect after setting
+;; load-source-file-function because of where it is called in lread.c.
+(load "emacs-lisp/macroexp")
+(if (byte-code-function-p (symbol-function 'macroexpand-all))
+ nil
+ ;; Since loaddefs is not yet loaded, macroexp's uses of pcase will simply
+ ;; fail until pcase is explicitly loaded. This also means that we have to
+ ;; disable eager macro-expansion while loading pcase.
+ (let ((macroexp--pending-eager-loads '(skip)))
+ (load "emacs-lisp/pcase"))
+ ;; Re-load macroexp so as to eagerly macro-expand its uses of pcase.
+ (load "emacs-lisp/macroexp"))
+
(load "cus-face")
(load "faces") ; after here, `defface' may be used.
@@ -269,21 +282,6 @@
;For other systems, you must edit ../src/Makefile.in.
(load "site-load" t)
-;; ¡¡¡ Big Ugly Hack !!!
-;; src/bootstrap-emacs is mostly used to compile .el files, so it needs
-;; macroexp, bytecomp, cconv, and byte-opt to be fast. Generally this is done
-;; by compiling those files first, but this only makes a difference if those
-;; files are not preloaded. As it so happens, macroexp.el tends to be
-;; accidentally preloaded in src/bootstrap-emacs because cl.el and cl-macs.el
-;; require it. So let's unload it here, if needed, to make sure the
-;; byte-compiled version is used.
-(if (or (not (fboundp 'macroexpand-all))
- (byte-code-function-p (symbol-function 'macroexpand-all)))
- nil
- (fmakunbound 'macroexpand-all)
- (setq features (delq 'macroexp features))
- (autoload 'macroexpand-all "macroexp"))
-
;; Determine which last version number to use
;; based on the executables that now exist.
(if (and (or (equal (nth 3 command-line-args) "dump")
diff --git a/lisp/locate.el b/lisp/locate.el
index 29d7c75cbb..d172ce3d6c 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -34,7 +34,7 @@
;;
;; SHELLPROGRAM Name-to-find
;;
-;; set the variable `locate-command' in your .emacs file.
+;; set the variable `locate-command' in your init file.
;;
;; To use a more complicated expression, create a function which
;; takes a string (the name to find) as input and returns a list.
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index 520271940f..4305094611 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -139,9 +139,8 @@
;; feedmail-send-it. Hers's the best way to use the stuff in this
;; file:
;;
-;; Save this file as feedmail.el somewhere on your elisp
-;; loadpath; byte-compile it. Put the following lines somewhere in
-;; your ~/.emacs stuff:
+;; Save this file as feedmail.el somewhere on your elisp loadpath;
+;; byte-compile it. Put the following lines in your init file:
;;
;; (setq send-mail-function 'feedmail-send-it)
;; (autoload 'feedmail-send-it "feedmail")
diff --git a/lisp/mail/mail-hist.el b/lisp/mail/mail-hist.el
index dd489e3c6a..40d67b4e90 100644
--- a/lisp/mail/mail-hist.el
+++ b/lisp/mail/mail-hist.el
@@ -28,7 +28,7 @@
;; time.
;;
;; To use this package, put it in a directory in your load-path, and
-;; put this in your .emacs file:
+;; put this in your init file:
;;
;; (load "mail-hist" nil t)
;;
diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el
index 290c57c1c5..2e4ffec138 100644
--- a/lisp/mail/mailabbrev.el
+++ b/lisp/mail/mailabbrev.el
@@ -391,35 +391,24 @@ double-quotes."
(defun mail-abbrev-expand-hook ()
"For use as the fourth arg to `define-abbrev'.
After expanding a mail-abbrev, if Auto Fill mode is on and we're past the
-fill-column, break the line at the previous comma, and indent the next line."
- ;; Disable abbrev mode to avoid recursion in indent-relative expanding
- ;; part of the abbrev expansion as an abbrev itself.
- (let ((abbrev-mode nil))
- (save-excursion
- (let ((p (point))
- bol comma fp)
- (beginning-of-line)
- (setq bol (point))
- (goto-char p)
- (while (and auto-fill-function
- (>= (current-column) fill-column)
- (search-backward "," bol t))
- (setq comma (point))
- (forward-char 1) ; Now we are just past the comma.
- (insert "\n")
- (delete-horizontal-space)
- (setq p (point))
- (indent-relative)
- (setq fp (buffer-substring p (point)))
- ;; Go to the end of the new line.
- (end-of-line)
- (if (> (current-column) fill-column)
- ;; It's still too long; do normal auto-fill.
- (let ((fill-prefix (or fp "\t")))
- (do-auto-fill)))
- ;; Resume the search.
- (goto-char comma)
- )))))
+fill-column, break the line at the previous comma, and indent the next line
+with a space."
+ (when auto-fill-function
+ (let (p)
+ (save-excursion
+ (while (>= (current-column) fill-column)
+ (while (and (search-backward "," (point-at-bol) 'move)
+ (>= (current-column) (1- fill-column))
+ (setq p (point))))
+ (when (or (not (bolp))
+ (and p (goto-char p)))
+ (setq p nil)
+ (forward-char 1)
+ (insert "\n")
+ (when (looking-at "[\t ]+")
+ (delete-region (point) (match-end 0)))
+ (insert " ")
+ (end-of-line)))))))
;;; Syntax tables and abbrev-expansion
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 804fe7a879..69a405436a 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -200,10 +200,10 @@ The list is in preference order.")
;; local binding in the mail buffer will take effect.
(smtpmail-mail-address
(or (and mail-specify-envelope-from (mail-envelope-from))
- (smtpmail-user-mail-address)
- (let ((from (mail-fetch-field "from")))
+ (let ((from (mail-fetch-field "from")))
(and from
- (cadr (mail-extract-address-components from))))))
+ (cadr (mail-extract-address-components from))))
+ (smtpmail-user-mail-address)))
(smtpmail-code-conv-from
(if enable-multibyte-characters
(let ((sendmail-coding-system smtpmail-code-conv-from))
@@ -653,12 +653,10 @@ Returns an error if the server cannot be contacted."
(or smtpmail-mail-address
(and mail-specify-envelope-from
(mail-envelope-from))
- (smtpmail-user-mail-address)
- ;; Fall back on the From: header as the envelope From
- ;; address.
(let ((from (mail-fetch-field "from")))
(and from
- (cadr (mail-extract-address-components from))))))
+ (cadr (mail-extract-address-components from))))
+ (smtpmail-user-mail-address)))
response-code
process-buffer
result
diff --git a/lisp/mail/uce.el b/lisp/mail/uce.el
index fdfe17a1a0..3d7495ffd1 100644
--- a/lisp/mail/uce.el
+++ b/lisp/mail/uce.el
@@ -63,7 +63,7 @@
;; Usage:
;; Place uce.el in your load-path (and optionally byte-compile it).
-;; Add the following line to your ~/.emacs:
+;; Add the following line to your init file:
;; (autoload 'uce-reply-to-uce "uce" "Reply to UCEs" t nil)
;; If you want to use it with Gnus rather than Rmail:
;; (setq uce-mail-reader 'gnus)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a696fff7dc..27c53744d5 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -211,7 +211,7 @@ case sensitive instead."
(complete-with-action action table string pred))))
(defun completion-table-subvert (table s1 s2)
- "Completion table that replaces the prefix S1 with S2 in STRING.
+ "Return a completion table from TABLE with S1 replaced by S2.
The result is a completion table which completes strings of the
form (concat S1 S) in the same way as TABLE completes strings of
the form (concat S2 S)."
diff --git a/lisp/mouse-copy.el b/lisp/mouse-copy.el
index 8d043b4495..a8e32bec1a 100644
--- a/lisp/mouse-copy.el
+++ b/lisp/mouse-copy.el
@@ -35,7 +35,7 @@
;; If you like mouse-copy, you should also check out mouse-drag
;; for ``one-click scrolling''.
;;
-;; To use mouse-copy, place the following in your .emacs file:
+;; To use mouse-copy, place the following in your init file:
;; (require 'mouse-copy)
;; (global-set-key [M-down-mouse-1] 'mouse-drag-secondary-pasting)
;; (global-set-key [M-S-down-mouse-1] 'mouse-drag-secondary-moving)
diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el
index 7fb1050535..acdad9a42c 100644
--- a/lisp/mouse-drag.el
+++ b/lisp/mouse-drag.el
@@ -46,7 +46,7 @@
;; If you like mouse-drag, you should also check out mouse-copy
;; for ``one-click text copy and move''.
;;
-;; To use mouse-drag, place the following in your .emacs file:
+;; To use mouse-drag, place the following in your init file:
;; -either-
;; (global-set-key [down-mouse-2] 'mouse-drag-throw)
;; -or-
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 1501fa41ba..265a855b84 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -79,7 +79,7 @@
;; that this change will take effect for the current GNU Emacs session only.
;; See below for a discussion of non-UNIX hosts. If a large number of
;; machines with similar hostnames have this problem then it is easier to set
-;; the value of ange-ftp-dumb-unix-host-regexp in your .emacs file. ange-ftp
+;; the value of ange-ftp-dumb-unix-host-regexp in your init file. ange-ftp
;; is unable to automatically recognize dumb unix hosts.
;; File name completion:
@@ -275,10 +275,10 @@
;; VMS support:
;;
-;; Ange-ftp has full support for VMS hosts. It
-;; should be able to automatically recognize any VMS machine. However, if it
-;; fails to do this, you can use the command ange-ftp-add-vms-host. As well,
-;; you can set the variable ange-ftp-vms-host-regexp in your .emacs file. We
+;; Ange-ftp has full support for VMS hosts. It should be able to
+;; automatically recognize any VMS machine. However, if it fails to do
+;; this, you can use the command ange-ftp-add-vms-host. Also, you can
+;; set the variable ange-ftp-vms-host-regexp in your init file. We
;; would be grateful if you would report any failures to automatically
;; recognize a VMS host as a bug.
;;
@@ -332,7 +332,7 @@
;; the Michigan terminal system. It should be able to automatically
;; recognize any MTS machine. However, if it fails to do this, you can use
;; the command ange-ftp-add-mts-host. As well, you can set the variable
-;; ange-ftp-mts-host-regexp in your .emacs file. We would be grateful if you
+;; ange-ftp-mts-host-regexp in your init file. We would be grateful if you
;; would report any failures to automatically recognize a MTS host as a bug.
;;
;; Filename syntax:
@@ -358,7 +358,7 @@
;; CMS. It should be able to automatically recognize any CMS machine.
;; However, if it fails to do this, you can use the command
;; ange-ftp-add-cms-host. As well, you can set the variable
-;; ange-ftp-cms-host-regexp in your .emacs file. We would be grateful if you
+;; ange-ftp-cms-host-regexp in your init file. We would be grateful if you
;; would report any failures to automatically recognize a CMS host as a bug.
;;
;; Filename syntax:
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 20d7121592..c1c83d2245 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -122,8 +122,7 @@
;; the buffer, use:
;; M-x browse-url
-;; To display a URL by shift-clicking on it, put this in your ~/.emacs
-;; file:
+;; To display a URL by shift-clicking on it, put this in your init file:
;; (global-set-key [S-mouse-2] 'browse-url-at-mouse)
;; (Note that using Shift-mouse-1 is not desirable because
;; that event has a standard meaning in Emacs.)
@@ -743,7 +742,7 @@ narrowed."
(and buffer (set-buffer buffer))
(let ((file-name
;; Ignore real name if restricted
- (and (= (- (point-max) (point-min)) (buffer-size))
+ (and (not (buffer-narrowed-p))
(or buffer-file-name
(and (boundp 'dired-directory) dired-directory)))))
(or file-name
diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el
index 6a9d80f967..f9e3178852 100644
--- a/lisp/net/goto-addr.el
+++ b/lisp/net/goto-addr.el
@@ -33,7 +33,7 @@
;; INSTALLATION
;;
;; To use goto-address in a particular mode (for example, while
-;; reading mail in mh-e), add something like this in your .emacs file:
+;; reading mail in mh-e), add this to your init file:
;;
;; (add-hook 'mh-show-mode-hook 'goto-address)
;;
diff --git a/lisp/net/newsticker.el b/lisp/net/newsticker.el
index 5d673faf0d..91eca84ce5 100644
--- a/lisp/net/newsticker.el
+++ b/lisp/net/newsticker.el
@@ -87,7 +87,7 @@
;; If you are using Newsticker as part of GNU Emacs there is no need to
;; perform any installation steps in order to use Newsticker. Otherwise
;; place Newsticker in a directory where Emacs can find it. Add the
-;; following line to your Emacs startup file (`~/.emacs').
+;; following line to your init file:
;; (add-to-list 'load-path "/path/to/newsticker/")
;; (autoload 'newsticker-start "newsticker" "Emacs Newsticker" t)
;; (autoload 'newsticker-show-news "newsticker" "Emacs Newsticker" t)
diff --git a/lisp/net/quickurl.el b/lisp/net/quickurl.el
index f3b0e372de..f7d41fcd97 100644
--- a/lisp/net/quickurl.el
+++ b/lisp/net/quickurl.el
@@ -164,7 +164,7 @@ To make use of this do something like:
(setq quickurl-postfix quickurl-reread-hook-postfix)
-in your ~/.emacs (after loading/requiring quickurl).")
+in your init file (after loading/requiring quickurl).")
;; Non-customize variables.
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 06aae1f6af..abca6b3ea0 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -204,7 +204,7 @@ useful thing to do is to put
(setq tramp-verbose 9)
-in the ~/.emacs file and to repeat the bug. Then, include the
+in your init file and to repeat the bug. Then, include the
contents of the *tramp/foo* buffer and the *debug tramp/foo*
buffer in your bug report.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index a17bbfa0d1..019ab1eef0 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3293,7 +3293,9 @@ for process communication also."
;; Under Windows XP, accept-process-output doesn't return
;; sometimes. So we add an additional timeout.
(with-timeout ((or timeout 1))
- (accept-process-output proc timeout timeout-msecs (and proc t))))
+ (if (featurep 'xemacs)
+ (accept-process-output proc timeout timeout-msecs)
+ (accept-process-output proc timeout timeout-msecs (and proc t)))))
(tramp-message proc 10 "\n%s" (buffer-string))))
(defun tramp-check-for-regexp (proc regexp)
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 499af73078..2d0a8e3d23 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -31,7 +31,7 @@
;; should be changed only there.
;;;###tramp-autoload
-(defconst tramp-version "2.2.6-pre"
+(defconst tramp-version "2.2.6"
"This version of Tramp.")
;;;###tramp-autoload
@@ -44,7 +44,7 @@
(= emacs-major-version 21)
(>= emacs-minor-version 4)))
"ok"
- (format "Tramp 2.2.6-pre is not fit for %s"
+ (format "Tramp 2.2.6 is not fit for %s"
(when (string-match "^.*$" (emacs-version))
(match-string 0 (emacs-version)))))))
(unless (string-match "\\`ok\\'" x) (error "%s" x)))
diff --git a/lisp/net/webjump.el b/lisp/net/webjump.el
index 232e5ca581..d5de2f410c 100644
--- a/lisp/net/webjump.el
+++ b/lisp/net/webjump.el
@@ -38,7 +38,7 @@
;; example sites. You'll probably want to override it with your own favorite
;; sites. The documentation for the variable describes the syntax.
-;; You may wish to add something like the following to your `.emacs' file:
+;; You may wish to add something like the following to your init file:
;;
;; (require 'webjump)
;; (global-set-key "\C-cj" 'webjump)
diff --git a/lisp/novice.el b/lisp/novice.el
index bcc94c86c9..c621ac4b69 100644
--- a/lisp/novice.el
+++ b/lisp/novice.el
@@ -159,8 +159,8 @@ to future sessions."
(defun disable-command (command)
"Require special confirmation to execute COMMAND from now on.
COMMAND must be a symbol.
-This command alters the user's .emacs file so that this will apply
-to future sessions."
+This command alters your init file so that this choice applies to
+future sessions."
(interactive "CDisable command: ")
(en/disable-command command t))
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index d357da685e..97d8b4652a 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -28,7 +28,7 @@
;; argument position.
;;
;; To use pcomplete with shell-mode, for example, you will need the
-;; following in your .emacs file:
+;; following in your init file:
;;
;; (add-hook 'shell-mode-hook 'pcomplete-shell-setup)
;;
diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el
index db2e18188e..1618960015 100644
--- a/lisp/play/blackbox.el
+++ b/lisp/play/blackbox.el
@@ -97,7 +97,9 @@
(let ((map (make-keymap)))
(suppress-keymap map t)
(blackbox-redefine-key map 'backward-char 'bb-left)
+ (blackbox-redefine-key map 'left-char 'bb-left)
(blackbox-redefine-key map 'forward-char 'bb-right)
+ (blackbox-redefine-key map 'right-char 'bb-right)
(blackbox-redefine-key map 'previous-line 'bb-up)
(blackbox-redefine-key map 'next-line 'bb-down)
(blackbox-redefine-key map 'move-end-of-line 'bb-eol)
diff --git a/lisp/play/bubbles.el b/lisp/play/bubbles.el
index 1f04099a6a..3b6035473f 100644
--- a/lisp/play/bubbles.el
+++ b/lisp/play/bubbles.el
@@ -33,7 +33,7 @@
;; Installation
;; ------------
-;; Add the following lines to your Emacs startup file (`~/.emacs').
+;; Add the following lines to your init file:
;; (add-to-list 'load-path "/path/to/bubbles/")
;; (autoload 'bubbles "bubbles" "Play Bubbles" t)
diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el
index 8d9506a161..ade0d15006 100644
--- a/lisp/play/decipher.el
+++ b/lisp/play/decipher.el
@@ -138,19 +138,7 @@ the tail of the list."
("^)\\([A-Z ]+\\)\\([a-z ]+\\)"
(1 font-lock-keyword-face)
(2 font-lock-string-face)))
- "Expressions to fontify in Decipher mode.
-
-Ciphertext uses `font-lock-keyword-face', plaintext uses
-`font-lock-string-face', comments use `font-lock-comment-face', and
-checkpoints use `font-lock-constant-face'. You can customize the
-display by changing these variables. For best results, I recommend
-that all faces use the same background color.
-
-For example, to display ciphertext in the `bold' face, use
- (add-hook 'decipher-mode-hook
- (lambda () (set (make-local-variable 'font-lock-keyword-face)
- 'bold)))
-in your `.emacs' file.")
+ "Font Lock keywords for Decipher mode.")
(defvar decipher-mode-map
(let ((map (make-keymap)))
diff --git a/lisp/play/handwrite.el b/lisp/play/handwrite.el
index d2e307c014..85c128b08e 100644
--- a/lisp/play/handwrite.el
+++ b/lisp/play/handwrite.el
@@ -45,7 +45,7 @@
;; Installation
;;
;; type at your prompt "emacs -l handwrite.el" or put this file on your
-;; Emacs-Lisp load path, add the following into your ~/.emacs startup file
+;; Emacs-Lisp load path, add the following into your init file:
;;
;; (require 'handwrite)
;;
diff --git a/lisp/printing.el b/lisp/printing.el
index 0152ed63db..02b2fb0139 100644
--- a/lisp/printing.el
+++ b/lisp/printing.el
@@ -139,10 +139,9 @@ Please send all bug fixes and enhancements to
;;
;; One way to set variables is by calling `pr-customize', customize all
;; variables and save the customization by future sessions (see Options
-;; section). Other way is by coding your settings on Emacs init file (that is,
-;; ~/.emacs file), see below for a first setting template that it should be
-;; inserted on your ~/.emacs file (or c:/_emacs, if you're using Windows 9x/NT
-;; or MS-DOS):
+;; section). Other way is by adding code to your init file; see below
+;; for a first setting template that it should be inserted on your
+;; init file:
;;
;; * Example of setting for Windows system:
;;
@@ -297,8 +296,7 @@ Please send all bug fixes and enhancements to
;; Using `printing'
;; ----------------
;;
-;; To use `printing' insert in your ~/.emacs file (or c:/_emacs, if you're
-;; using Windows 9x/NT or MS-DOS):
+;; To use `printing' insert in your init file:
;;
;; (require 'printing)
;; ;; ...some user settings...
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el
index 4062646c96..5a054af988 100644
--- a/lisp/progmodes/antlr-mode.el
+++ b/lisp/progmodes/antlr-mode.el
@@ -69,7 +69,7 @@
;; This file requires Emacs-20.3, XEmacs-20.4 or higher and package cc-mode.
;; If antlr-mode is not part of your distribution, put this file into your
-;; load-path and the following into your ~/.emacs:
+;; load-path and the following into your init file:
;; (autoload 'antlr-mode "antlr-mode" nil t)
;; (setq auto-mode-alist (cons '("\\.g\\'" . antlr-mode) auto-mode-alist))
;; (add-hook 'speedbar-load-hook ; would be too late in antlr-mode.el
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 7cd0a0b0ae..eec6873dc1 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -493,13 +493,16 @@ inside a literal or a macro, nothing special happens."
(insert-char ?\n 1)
;; In AWK (etc.) or in a macro, make sure this CR hasn't changed
;; the syntax. (There might already be an escaped NL there.)
- (when (or (c-at-vsemi-p (1- (point)))
- (let ((pt (point)))
- (save-excursion
- (backward-char)
- (and (c-beginning-of-macro)
- (progn (c-end-of-macro)
- (< (point) pt))))))
+ (when (or
+ (save-excursion
+ (c-skip-ws-backward (c-point 'bopl))
+ (c-at-vsemi-p))
+ (let ((pt (point)))
+ (save-excursion
+ (backward-char)
+ (and (c-beginning-of-macro)
+ (progn (c-end-of-macro)
+ (< (point) pt))))))
(backward-char)
(insert-char ?\\ 1)
(forward-char))
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 8bccb44f30..0dc596a472 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -1829,7 +1829,7 @@ itself is evaluated."
(eval form))
;; Only used at compile time - suppress "might not be defined at runtime".
-(declare-function cl-macroexpand-all "cl-extra" (form &optional env))
+(declare-function cl-macroexpand-all "cl" (form &optional env))
(defmacro c-lang-defconst (name &rest args)
"Set the language specific values of the language constant NAME.
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 142ec4cdd6..2aa04cb2b0 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -3091,6 +3091,8 @@ comment at the start of cc-engine.el for more info."
c-state-cache-good-pos 1
c-state-nonlit-pos-cache nil
c-state-nonlit-pos-cache-limit 1
+ c-state-semi-nonlit-pos-cache nil
+ c-state-semi-nonlit-pos-cache-limit 1
c-state-brace-pair-desert nil
c-state-point-min 1
c-state-point-min-lit-type nil
@@ -3350,6 +3352,8 @@ comment at the start of cc-engine.el for more info."
c-state-cache-good-pos
c-state-nonlit-pos-cache
c-state-nonlit-pos-cache-limit
+ c-state-semi-nonlit-pos-cache
+ c-state-semi-nonlit-pos-cache-limit
c-state-brace-pair-desert
c-state-point-min
c-state-point-min-lit-type
@@ -9579,12 +9583,12 @@ comment at the start of cc-engine.el for more info."
(setq tmpsymbol nil)
(while (and (> (point) placeholder)
(zerop (c-backward-token-2 1 t))
- (/= (char-after) ?=))
+ (not (looking-at "=\\([^=]\\|$\\)")))
(and c-opt-inexpr-brace-list-key
(not tmpsymbol)
(looking-at c-opt-inexpr-brace-list-key)
(setq tmpsymbol 'topmost-intro-cont)))
- (eq (char-after) ?=))
+ (looking-at "=\\([^=]\\|$\\)"))
(looking-at c-brace-list-key))
(save-excursion
(while (and (< (point) indent-point)
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 78be8ac2cc..d5a1be572b 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -208,9 +208,10 @@ the evaluated constant value at compile time."
;; Suppress "might not be defined at runtime" warning.
;; This file is only used when compiling other cc files.
-(declare-function delete-duplicates "cl-seq" (cl-seq &rest cl-keys))
-(declare-function mapcan "cl-extra" (cl-func cl-seq &rest cl-rest))
-(declare-function cl-macroexpand-all "cl-extra" (form &optional env))
+;; These are defined in cl as aliases to the cl- versions.
+(declare-function delete-duplicates "cl-seq" (cl-seq &rest cl-keys) t)
+(declare-function mapcan "cl-extra" (cl-func cl-seq &rest cl-rest) t)
+(declare-function cl-macroexpand-all "cl" (form &optional env))
(eval-and-compile
;; Some helper functions used when building the language constants.
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index cf628e44de..20aa2bc277 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -352,8 +352,8 @@ might get set too.
If DONT-OVERRIDE is neither nil nor t, style variables whose default values
have been set (more precisely, whose default values are not the symbol
`set-from-style') will not be changed. This avoids overriding global settings
-done in ~/.emacs. It is useful to call c-set-style from a mode hook in this
-way.
+done in your init file. It is useful to call c-set-style from a mode hook
+in this way.
If DONT-OVERRIDE is t, style variables that already have values (i.e., whose
values are not the symbol `set-from-style') will not be overridden. CC Mode
diff --git a/lisp/progmodes/cmacexp.el b/lisp/progmodes/cmacexp.el
index 943b5c6a06..525b1c9671 100644
--- a/lisp/progmodes/cmacexp.el
+++ b/lisp/progmodes/cmacexp.el
@@ -49,7 +49,7 @@
;; INSTALLATION ======================================================
-;; Put the following in your ~/.emacs file.
+;; Put the following in your init file.
;; If you want the *Macroexpansion* window to be not higher than
;; necessary:
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index fbb0c9e204..f5dedf0cd5 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -488,9 +488,12 @@ What matched the HYPERLINK'th subexpression has `mouse-face' and
`compilation-message-face' applied. If this is nil, the text
matched by the whole REGEXP becomes the hyperlink.
-Additional HIGHLIGHTs take the shape (SUBMATCH FACE), where SUBMATCH is
-the number of a submatch that should be highlighted when it matches,
-and FACE is an expression returning the face to use for that submatch.."
+Additional HIGHLIGHTs take the shape (SUBMATCH FACE), where
+SUBMATCH is the number of a submatch and FACE is an expression
+which evaluates to a face name (a symbol or string).
+Alternatively, FACE can evaluate to a property list of the
+form (face FACE PROP1 VAL1 PROP2 VAL2 ...), in which case all the
+listed text properties PROP# are given values VAL# as well."
:type '(repeat (choice (symbol :tag "Predefined symbol")
(sexp :tag "Error specification")))
:link `(file-link :tag "example file"
@@ -1328,16 +1331,27 @@ to `compilation-error-regexp-alist' if RULES is nil."
(compilation--put-prop
end-col 'font-lock-face compilation-column-face)
+ ;; Obey HIGHLIGHT.
(dolist (extra-item (nthcdr 6 item))
(let ((mn (pop extra-item)))
(when (match-beginning mn)
(let ((face (eval (car extra-item))))
(cond
((null face))
- ((symbolp face)
+ ((or (symbolp face) (stringp face))
(put-text-property
(match-beginning mn) (match-end mn)
'font-lock-face face))
+ ((and (listp face)
+ (eq (car face) 'face)
+ (or (symbolp (cadr face))
+ (stringp (cadr face))))
+ (put-text-property
+ (match-beginning mn) (match-end mn)
+ 'font-lock-face (cadr face))
+ (add-text-properties
+ (match-beginning mn) (match-end mn)
+ (nthcdr 2 face)))
(t
(error "Don't know how to handle face %S"
face)))))))
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index cdbaf4708a..0f18cffc3d 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -43,7 +43,7 @@ Please send all bug fixes and enhancements to
;;
;; This package translates an EBNF to a syntactic chart on PostScript.
;;
-;; To use ebnf2ps, insert in your ~/.emacs:
+;; To use ebnf2ps, insert in your init file:
;;
;; (require 'ebnf2ps)
;;
@@ -772,7 +772,7 @@ Please send all bug fixes and enhancements to
;;
;; To set the above options you may:
;;
-;; a) insert the code in your ~/.emacs, like:
+;; a) insert the code in your init file, like:
;;
;; (setq ebnf-terminal-shape 'bevel)
;;
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index 1d29011762..8ac54d6524 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -4210,7 +4210,7 @@ NUMBER-OF-STATIC-VARIABLES:"
;; this will select the buffer from which the buffer menu was
;; invoked. But this buffer is not displayed in the buffer list if
;; it isn't a tree buffer. I therefore let the buffer menu command
-;; loop read the command `p' via `unread-command-char'. This command
+;; loop read the command `p' via `unread-command-events'. This command
;; has no effect since we are on the first line of the buffer.
(defvar electric-buffer-menu-mode-hook nil)
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index cc1251f6a7..f42952685d 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -102,10 +102,9 @@
;; (abbrev-mode 1) ; turn on abbreviation mode
;; (f90-add-imenu-menu) ; extra menu with functions etc.
;; (if f90-auto-keyword-case ; change case of all keywords on startup
-;; (f90-change-keywords f90-auto-keyword-case))
-;; ))
+;; (f90-change-keywords f90-auto-keyword-case))))
;;
-;; in your .emacs file. You can also customize the lists
+;; in your init file. You can also customize the lists
;; f90-font-lock-keywords, etc.
;;
;; The auto-fill and abbreviation minor modes are accessible from the F90 menu,
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index ad28527492..10d5fdf9c6 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -977,6 +977,9 @@ from compile.el")
;; :type '(repeat (string number number number))
;;)
+(defvar flymake-warning-re "^[wW]arning"
+ "Regexp matching against err-text to detect a warning.")
+
(defun flymake-parse-line (line)
"Parse LINE to see if it is an error or warning.
Return its components if so, nil otherwise."
@@ -997,7 +1000,7 @@ Return its components if so, nil otherwise."
(match-string (nth 4 (car patterns)) line)
(flymake-patch-err-text (substring line (match-end 0)))))
(or err-text (setq err-text "<no error text>"))
- (if (and err-text (string-match "^[wW]arning" err-text))
+ (if (and err-text (string-match flymake-warning-re err-text))
(setq err-type "w")
)
(flymake-log 3 "parse line: file-idx=%s line-idx=%s file=%s line=%s text=%s" file-idx line-idx
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index 233b9a5212..2a77ad013c 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -52,7 +52,7 @@
;;
;; First make sure hideshow.el is in a directory in your `load-path'.
;; You can optionally byte-compile it using `M-x byte-compile-file'.
-;; Then, add the following to your ~/.emacs:
+;; Then, add the following to your init file:
;;
;; (load-library "hideshow")
;; (add-hook 'X-mode-hook ; other modes similarly
diff --git a/lisp/progmodes/idlw-complete-structtag.el b/lisp/progmodes/idlw-complete-structtag.el
index 246ba8f29c..24613d1463 100644
--- a/lisp/progmodes/idlw-complete-structtag.el
+++ b/lisp/progmodes/idlw-complete-structtag.el
@@ -53,8 +53,8 @@
;;
;; INSTALLATION
;; ============
-;; Put this file on the emacs load path and load it with the following
-;; line in your .emacs file:
+;; Put this file on the emacs load path and load it with the following
+;; line in your init file:
;;
;; (add-hook 'idlwave-load-hook
;; (lambda () (require 'idlw-complete-structtag)))
diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el
index 4f9109284a..08d1461c00 100644
--- a/lisp/progmodes/idlw-shell.el
+++ b/lisp/progmodes/idlw-shell.el
@@ -48,7 +48,7 @@
;;
;; Follow the instructions in the INSTALL file of the distribution.
;; In short, put this file on your load path and add the following
-;; lines to your .emacs file:
+;; lines to your init file:
;;
;; (autoload 'idlwave-shell "idlw-shell" "IDLWAVE Shell" t)
;;
@@ -111,9 +111,7 @@ For example, \"^\r?IDL> \" or \"^\r?WAVE> \".
The \"^\r?\" is needed, to indicate the beginning of the line, with
optional return character (which IDL seems to output randomly).
This variable is used to initialize `comint-prompt-regexp' in the
-process buffer.
-
-This is a fine thing to set in your `.emacs' file."
+process buffer."
:group 'idlwave-shell-general-setup
:type 'regexp)
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index a35ffd3e45..9b634328fa 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -51,7 +51,7 @@
;;
;; Follow the instructions in the INSTALL file of the distribution.
;; In short, put this file on your load path and add the following
-;; lines to your .emacs file:
+;; lines to your init file:
;;
;; (autoload 'idlwave-mode "idlwave" "IDLWAVE Mode" t)
;; (autoload 'idlwave-shell "idlw-shell" "IDLWAVE Shell" t)
@@ -746,7 +746,7 @@ or even '?'. '.' is not a good choice because it can make structure
field names act like abbrevs in certain circumstances.
Changes to this in `idlwave-mode-hook' will have no effect. Instead a user
-must set it directly using `setq' in the .emacs file before idlwave.el
+must set it directly using `setq' in the init file before idlwave.el
is loaded."
:group 'idlwave-abbrev-and-indent-action
:type 'string)
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el
index cd6c8869d9..401970b2ce 100644
--- a/lisp/progmodes/inf-lisp.el
+++ b/lisp/progmodes/inf-lisp.el
@@ -168,9 +168,7 @@ This variable is only used if the variable
More precise choices:
Lucid Common Lisp: \"^\\\\(>\\\\|\\\\(->\\\\)+\\\\) *\"
franz: \"^\\\\(->\\\\|<[0-9]*>:\\\\) *\"
-kcl: \"^>+ *\"
-
-This is a fine thing to set in your .emacs file or through Custom."
+kcl: \"^>+ *\""
:type 'regexp
:group 'inferior-lisp)
diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el
index 54d857dd4b..a59176a5aa 100644
--- a/lisp/progmodes/mixal-mode.el
+++ b/lisp/progmodes/mixal-mode.el
@@ -32,7 +32,7 @@
;; GNU MDK from `https://savannah.gnu.org/projects/mdk/' and
;; `ftp://ftp.gnu.org/pub/gnu/mdk'.
;;
-;; To use this mode, place the following in your .emacs file:
+;; To use this mode, place the following in your init file:
;; `(load-file "/PATH-TO-FILE/mixal-mode.el")'.
;; When you load a file with the extension .mixal the mode will be started
;; automatic. If you want to start the mode manual, use `M-x mixal-mode'.
diff --git a/lisp/progmodes/octave-mod.el b/lisp/progmodes/octave-mod.el
index 79b3fcee72..ab5a19f8a2 100644
--- a/lisp/progmodes/octave-mod.el
+++ b/lisp/progmodes/octave-mod.el
@@ -585,12 +585,12 @@ Variables you can use to customize Octave mode
Turning on Octave mode runs the hook `octave-mode-hook'.
To begin using this mode for all `.m' files that you edit, add the
-following lines to your `.emacs' file:
+following lines to your init file:
(add-to-list 'auto-mode-alist '(\"\\\\.m\\\\'\" . octave-mode))
To automatically turn on the abbrev and auto-fill features,
-add the following lines to your `.emacs' file as well:
+add the following lines to your init file as well:
(add-hook 'octave-mode-hook
(lambda ()
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index e13b67e596..3dd9a48bb3 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -28,14 +28,14 @@
;;; Commentary:
;; To enter perl-mode automatically, add (autoload 'perl-mode "perl-mode")
-;; to your .emacs file and change the first line of your perl script to:
+;; to your init file and change the first line of your perl script to:
;; #!/usr/bin/perl -- # -*-Perl-*-
;; With arguments to perl:
;; #!/usr/bin/perl -P- # -*-Perl-*-
;; To handle files included with do 'filename.pl';, add something like
;; (setq auto-mode-alist (append (list (cons "\\.pl\\'" 'perl-mode))
;; auto-mode-alist))
-;; to your .emacs file; otherwise the .pl suffix defaults to prolog-mode.
+;; to your init file; otherwise the .pl suffix defaults to prolog-mode.
;; This code is based on the 18.53 version c-mode.el, with extensive
;; rewriting. Most of the features of c-mode survived intact.
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index 16d85cb2d7..33d43cb3d5 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -60,9 +60,7 @@
;;; Installation:
;;
-;; Insert the following lines in your init file--typically ~/.emacs
-;; (GNU Emacs and XEmacs <21.4), or ~/.xemacs/init.el (XEmacs
-;; 21.4)--to use this mode when editing Prolog files under Emacs:
+;; Insert the following lines in your init file:
;;
;; (setq load-path (cons "/usr/lib/xemacs/site-lisp" load-path))
;; (autoload 'run-prolog "prolog" "Start a Prolog sub-process." t)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 601850ed0f..ffc6c1ac88 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1824,7 +1824,11 @@ When MSG is non-nil messages the first line of STRING."
(lines (split-string string "\n" t)))
(and msg (message "Sent: %s..." (nth 0 lines)))
(if (> (length lines) 1)
- (let* ((temp-file-name (make-temp-file "py"))
+ (let* ((temporary-file-directory
+ (if (file-remote-p default-directory)
+ (concat (file-remote-p default-directory) "/tmp")
+ temporary-file-directory))
+ (temp-file-name (make-temp-file "py"))
(file-name (or (buffer-file-name) temp-file-name)))
(with-temp-file temp-file-name
(insert string)
@@ -1931,8 +1935,14 @@ FILE-NAME."
(interactive "fFile to send: ")
(let* ((process (or process (python-shell-get-or-create-process)))
(temp-file-name (when temp-file-name
- (expand-file-name temp-file-name)))
- (file-name (or (expand-file-name file-name) temp-file-name)))
+ (expand-file-name
+ (or (file-remote-p temp-file-name 'localname)
+ temp-file-name))))
+ (file-name (or (when file-name
+ (expand-file-name
+ (or (file-remote-p file-name 'localname)
+ file-name)))
+ temp-file-name)))
(when (not file-name)
(error "If FILE-NAME is nil then TEMP-FILE-NAME must be non-nil"))
(python-shell-send-string
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 457c7fee36..77ec8084ea 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -64,8 +64,8 @@
"Regexp to match keywords that nest without blocks.")
(defconst ruby-indent-beg-re
- (concat "\\(\\s *" (regexp-opt '("class" "module" "def") t) "\\)\\|"
- (regexp-opt '("if" "unless" "case" "while" "until" "for" "begin")))
+ (concat "^\\s *" (regexp-opt '("class" "module" "def" "if" "unless" "case"
+ "while" "until" "for" "begin")) "\\_>")
"Regexp to match where the indentation gets deeper.")
(defconst ruby-modifier-beg-keywords
@@ -98,6 +98,10 @@
(defconst ruby-block-end-re "\\_<end\\_>")
+(defconst ruby-defun-beg-re
+ '"\\(def\\|class\\|module\\)"
+ "Regexp to match the beginning of a defun, in the general sense.")
+
(eval-and-compile
(defconst ruby-here-doc-beg-re
"\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)"
@@ -138,18 +142,11 @@ This should only be called after matching against `ruby-here-doc-beg-re'."
(defvar ruby-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "{" 'ruby-electric-brace)
- (define-key map "}" 'ruby-electric-brace)
- (define-key map (kbd "M-C-a") 'ruby-beginning-of-defun)
- (define-key map (kbd "M-C-e") 'ruby-end-of-defun)
(define-key map (kbd "M-C-b") 'ruby-backward-sexp)
(define-key map (kbd "M-C-f") 'ruby-forward-sexp)
(define-key map (kbd "M-C-p") 'ruby-beginning-of-block)
(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 "C-M-h") 'backward-kill-word)
- (define-key map (kbd "C-j") 'reindent-then-newline-and-indent)
(define-key map (kbd "C-c {") 'ruby-toggle-block)
map)
"Keymap used in Ruby mode.")
@@ -840,20 +837,13 @@ and `\\' when preceded by `?'."
(+ indent ruby-indent-level)
indent))))
-(defun ruby-electric-brace (arg)
- "Insert a brace and re-indent the current line."
- (interactive "P")
- (self-insert-command (prefix-numeric-value arg))
- (ruby-indent-line t))
-
-;; TODO: Why isn't one ruby-*-of-defun written in terms of the other?
(defun ruby-beginning-of-defun (&optional arg)
"Move backward to the beginning of the current top-level defun.
With ARG, move backward multiple defuns. Negative ARG means
move forward."
(interactive "p")
- (and (re-search-backward (concat "^\\(" ruby-block-beg-re "\\)\\b")
- nil 'move (or arg 1))
+ (and (re-search-backward (concat "^\\s *" ruby-defun-beg-re "\\_>")
+ nil t (or arg 1))
(beginning-of-line)))
(defun ruby-end-of-defun (&optional arg)
@@ -861,19 +851,18 @@ move forward."
With ARG, move forward multiple defuns. Negative ARG means
move backward."
(interactive "p")
- (and (re-search-forward (concat "^\\(" ruby-block-end-re "\\)\\($\\|\\b[^_]\\)")
- nil 'move (or arg 1))
- (beginning-of-line))
- (forward-line 1))
+ (ruby-forward-sexp)
+ (when (looking-back (concat "^\\s *" ruby-block-end-re))
+ (forward-line 1)))
(defun ruby-beginning-of-indent ()
- "TODO: document"
- ;; I don't understand this function.
- ;; It seems like it should move to the line where indentation should deepen,
- ;; but ruby-indent-beg-re only accounts for whitespace before class, module and def,
- ;; so this will only match other block beginners at the beginning of the line.
- (and (re-search-backward (concat "^\\(" ruby-indent-beg-re "\\)\\_>") nil 'move)
- (beginning-of-line)))
+ "Backtrack to a line which can be used as a reference for
+calculating indentation on the lines after it."
+ (while (and (re-search-backward ruby-indent-beg-re nil 'move)
+ (if (ruby-in-ppss-context-p 'anything)
+ t
+ ;; We can stop, then.
+ (beginning-of-line)))))
(defun ruby-move-to-block (n)
"Move to the beginning (N < 0) or the end (N > 0) of the current block
@@ -1024,15 +1013,6 @@ With ARG, do it many times. Negative ARG means move forward."
((error)))
i)))
-(defun ruby-mark-defun ()
- "Put mark at end of this Ruby function, point at beginning."
- (interactive)
- (push-mark (point))
- (ruby-end-of-defun)
- (push-mark (point) nil t)
- (ruby-beginning-of-defun)
- (re-search-backward "^\n" (- (point) 1) t))
-
(defun ruby-indent-exp (&optional ignored)
"Indent each line in the balanced expression following the point."
(interactive "*P")
@@ -1073,7 +1053,7 @@ See `add-log-current-defun-function'."
(let (mname mlist (indent 0))
;; get current method (or class/module)
(if (re-search-backward
- (concat "^[ \t]*\\(def\\|class\\|module\\)[ \t]+"
+ (concat "^[ \t]*" ruby-defun-beg-re "[ \t]+"
"\\("
;; \\. and :: for class method
"\\([A-Za-z_]" ruby-symbol-re "*\\|\\.\\|::" "\\)"
@@ -1127,46 +1107,65 @@ See `add-log-current-defun-function'."
(if mlist (concat mlist mname) mname)
mlist)))))
-(defun ruby-brace-to-do-end ()
- (when (looking-at "{")
- (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
- (when (eq (char-before) ?\})
- (delete-char -1)
- (if (eq (char-syntax (char-before)) ?w)
- (insert " "))
- (insert "end")
- (if (eq (char-syntax (char-after)) ?w)
- (insert " "))
- (goto-char orig)
- (delete-char 1)
- (if (eq (char-syntax (char-before)) ?w)
- (insert " "))
- (insert "do")
- (when (looking-at "\\sw\\||")
- (insert " ")
- (backward-char))
- t))))
-
-(defun ruby-do-end-to-brace ()
- (when (and (or (bolp)
- (not (memq (char-syntax (char-before)) '(?w ?_))))
- (looking-at "\\<do\\(\\s \\|$\\)"))
- (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
- (backward-char 3)
- (when (looking-at ruby-block-end-re)
- (delete-char 3)
- (insert "}")
- (goto-char orig)
- (delete-char 2)
- (insert "{")
- (if (looking-at "\\s +|")
- (delete-char (- (match-end 0) (match-beginning 0) 1)))
- t))))
+(defun ruby-brace-to-do-end (orig end)
+ (let (beg-marker end-marker)
+ (goto-char end)
+ (when (eq (char-before) ?\})
+ (delete-char -1)
+ (skip-chars-backward " \t")
+ (when (not (bolp))
+ (insert "\n"))
+ (insert "end")
+ (setq end-marker (point-marker))
+ (when (and (not (eobp)) (eq (char-syntax (char-after)) ?w))
+ (insert " "))
+ (goto-char orig)
+ (delete-char 1)
+ (when (eq (char-syntax (char-before)) ?w)
+ (insert " "))
+ (insert "do")
+ (setq beg-marker (point-marker))
+ (when (looking-at "\\(\\s \\)*|")
+ (unless (match-beginning 1)
+ (insert " "))
+ (goto-char (1+ (match-end 0)))
+ (search-forward "|"))
+ (unless (looking-at "\\s *$")
+ (insert "\n"))
+ (indent-region beg-marker end-marker)
+ (goto-char beg-marker)
+ t)))
+
+(defun ruby-do-end-to-brace (orig end)
+ (goto-char (- end 3))
+ (when (looking-at ruby-block-end-re)
+ (delete-char 3)
+ (insert "}")
+ (goto-char orig)
+ (delete-char 2)
+ (insert "{")
+ (if (looking-at "\\s +|")
+ (delete-char (- (match-end 0) (match-beginning 0) 1)))
+ t))
(defun ruby-toggle-block ()
+ "Toggle block type from do-end to braces or back.
+The block must begin on the current line or above it and end after the point.
+If the result is do-end block, it will always be multiline."
(interactive)
- (or (ruby-brace-to-do-end)
- (ruby-do-end-to-brace)))
+ (let ((start (point)) beg end)
+ (end-of-line)
+ (unless
+ (if (and (re-search-backward "\\({\\)\\|\\_<do\\(\\s \\|$\\||\\)")
+ (progn
+ (setq beg (point))
+ (save-match-data (ruby-forward-sexp))
+ (setq end (point))
+ (> end start)))
+ (if (match-beginning 1)
+ (ruby-brace-to-do-end beg end)
+ (ruby-do-end-to-brace beg end)))
+ (goto-char start))))
(declare-function ruby-syntax-propertize-heredoc "ruby-mode" (limit))
(declare-function ruby-syntax-enclosing-percent-literal "ruby-mode" (limit))
@@ -1193,8 +1192,6 @@ It will be properly highlighted even when the call omits parens."))
(ruby-syntax-enclosing-percent-literal end)
(funcall
(syntax-propertize-rules
- ;; #{ }, #$hoge, #@foo are not comments.
- ("\\(#\\)[{$@]" (1 "."))
;; $' $" $` .... are variables.
;; ?' ?" ?` are ascii codes.
("\\([?$]\\)[#\"'`]"
@@ -1326,8 +1323,7 @@ This should only be called after matching against `ruby-here-doc-end-re'."
(concat "-?\\([\"']\\|\\)" contents "\\1"))))))
(defconst ruby-font-lock-syntactic-keywords
- `( ;; #{ }, #$hoge, #@foo are not comments
- ("\\(#\\)[{$@]" 1 (1 . nil))
+ `(
;; the last $', $", $` in the respective string is not variable
;; the last ?', ?", ?` in the respective string is not ascii code
("\\(^\\|[\[ \t\n<+\(,=]\\)\\(['\"`]\\)\\(\\\\.\\|\\2\\|[^'\"`\n\\\\]\\)*?\\\\?[?$]\\(\\2\\)"
@@ -1549,6 +1545,9 @@ See `font-lock-syntax-table'.")
;; variables
'("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\>"
2 font-lock-variable-name-face)
+ ;; symbols
+ '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|@?\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
+ 2 font-lock-reference-face)
;; variables
'("\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W"
1 font-lock-variable-name-face)
@@ -1557,12 +1556,9 @@ See `font-lock-syntax-table'.")
;; constants
'("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
2 font-lock-type-face)
- ;; symbols
- '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
- 2 font-lock-reference-face)
'("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-reference-face)
;; expression expansion
- '("#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)"
+ '(ruby-match-expression-expansion
0 font-lock-variable-name-face t)
;; warn lower camel case
;'("\\<[a-z]+[a-z0-9]*[A-Z][A-Za-z0-9]*\\([!?]?\\|\\>\\)"
@@ -1570,6 +1566,11 @@ See `font-lock-syntax-table'.")
)
"Additional expressions to highlight in Ruby mode.")
+(defun ruby-match-expression-expansion (limit)
+ (when (re-search-forward "[^\\]\\(\\\\\\\\\\)*\\(#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)\\)" limit 'move)
+ (or (ruby-in-ppss-context-p 'string)
+ (ruby-match-expression-expansion limit))))
+
;;;###autoload
(define-derived-mode ruby-mode prog-mode "Ruby"
"Major mode for editing Ruby scripts.
@@ -1586,6 +1587,10 @@ The variable `ruby-indent-level' controls the amount of indentation.
'ruby-imenu-create-index)
(set (make-local-variable 'add-log-current-defun-function)
'ruby-add-log-current-method)
+ (set (make-local-variable 'beginning-of-defun-function)
+ 'ruby-beginning-of-defun)
+ (set (make-local-variable 'end-of-defun-function)
+ 'ruby-end-of-defun)
(add-hook
(cond ((boundp 'before-save-hook) 'before-save-hook)
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index a422462775..b4d550bcee 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1062,21 +1062,22 @@ subshells can nest."
(backward-char 1))
(when (eq (char-before) ?|)
(backward-char 1) t)))
- (when (progn (backward-char 2)
- (if (> start (line-end-position))
- (put-text-property (point) (1+ start)
- 'syntax-multiline t))
- ;; FIXME: The `in' may just be a random argument to
- ;; a normal command rather than the real `in' keyword.
- ;; I.e. we should look back to try and find the
- ;; corresponding `case'.
- (and (looking-at ";[;&]\\|\\_<in")
- ;; ";; esac )" is a case that looks like a case-pattern
- ;; but it's really just a close paren after a case
- ;; statement. I.e. if we skipped over `esac' just now,
- ;; we're not looking at a case-pattern.
- (not (looking-at "..[ \t\n]+esac[^[:word:]_]"))))
- sh-st-punc))))
+ (and (> (point) (1+ (point-min)))
+ (progn (backward-char 2)
+ (if (> start (line-end-position))
+ (put-text-property (point) (1+ start)
+ 'syntax-multiline t))
+ ;; FIXME: The `in' may just be a random argument to
+ ;; a normal command rather than the real `in' keyword.
+ ;; I.e. we should look back to try and find the
+ ;; corresponding `case'.
+ (and (looking-at ";[;&]\\|\\_<in")
+ ;; ";; esac )" is a case that looks like a case-pattern
+ ;; but it's really just a close paren after a case
+ ;; statement. I.e. if we skipped over `esac' just now,
+ ;; we're not looking at a case-pattern.
+ (not (looking-at "..[ \t\n]+esac[^[:word:]_]"))))
+ sh-st-punc))))
(defun sh-font-lock-backslash-quote ()
(if (eq (save-excursion (nth 3 (syntax-ppss (match-beginning 0)))) ?\')
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 030cc02f3f..3d5abc4df6 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -4,7 +4,7 @@
;; Author: Alex Schroeder <[email protected]>
;; Maintainer: Michael Mauger <[email protected]>
-;; Version: 3.0
+;; Version: 3.1
;; Keywords: comm languages processes
;; URL: http://savannah.gnu.org/projects/emacs/
@@ -218,9 +218,12 @@
;; Michael Mauger <[email protected]> -- improved product support
;; Drew Adams <[email protected]> -- Emacs 20 support
;; Harald Maier <[email protected]> -- sql-send-string
-;; Stefan Monnier <[email protected]> -- font-lock corrections; code polish
+;; Stefan Monnier <[email protected]> -- font-lock corrections;
+;; code polish
;; Paul Sleigh <[email protected]> -- MySQL keyword enhancement
;; Andrew Schein <[email protected]> -- sql-port bug
+;; Ian Bjorhovde <[email protected]> -- db2 escape newlines
+;; incorrectly enabled by default
@@ -265,9 +268,8 @@
(defcustom sql-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."
+If you customize this, the value will be stored in your init
+file. Since that is a plaintext file, this could be dangerous."
:type 'string
:group 'SQL
:risky t)
@@ -879,6 +881,16 @@ In older versions of SQL*Plus, this was the SET SCAN OFF command."
:type 'boolean
:group 'SQL)
+(defcustom sql-db2-escape-newlines nil
+ "Non-nil if newlines should be escaped by a backslash in DB2 SQLi.
+
+When non-nil, Emacs will automatically insert a space and
+backslash prior to every newline in multi-line SQL statements as
+they are submitted to an interactive DB2 session."
+ :version "24.3"
+ :type 'boolean
+ :group 'SQL)
+
;; Customization for SQLite
(defcustom sql-sqlite-program (or (executable-find "sqlite3")
@@ -1272,8 +1284,8 @@ Based on `comint-mode-map'.")
["List all objects" sql-list-all (sql-get-product-feature sql-product :list-all)]
["List table details" sql-list-table (sql-get-product-feature sql-product :list-table)]))
-;; Abbreviations -- if you want more of them, define them in your
-;; ~/.emacs file. Abbrevs have to be enabled in your ~/.emacs, too.
+;; Abbreviations -- if you want more of them, define them in your init
+;; file. Abbrevs have to be enabled in your init file, too.
(defvar sql-mode-abbrev-table nil
"Abbrev table used in `sql-mode' and `sql-interactive-mode'.")
@@ -3188,20 +3200,23 @@ Placeholders are words starting with an ampersand like &this."
;; Using DB2 interactively, newlines must be escaped with " \".
;; The space before the backslash is relevant.
+
(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)
- 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))))
+ (if (not sql-db2-escape-newlines)
+ string
+ (let ((result "") (start 0) mb me)
+ (while (string-match "\n" string start)
+ (setq mb (match-beginning 0)
+ 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)))))
@@ -3699,8 +3714,8 @@ For information on how to create multiple SQLi buffers, see
`sql-interactive-mode'.
Note that SQL doesn't have an escape character unless you specify
-one. If you specify backslash as escape character in SQL,
-you must tell Emacs. Here's how to do that in your `~/.emacs' file:
+one. If you specify backslash as escape character in SQL, you
+must tell Emacs. Here's how to do that in your init file:
\(add-hook 'sql-mode-hook
(lambda ()
@@ -3790,7 +3805,7 @@ cause the window to scroll to the end of the buffer.
If you want to make SQL buffers limited in length, add the function
`comint-truncate-buffer' to `comint-output-filter-functions'.
-Here is an example for your .emacs file. It keeps the SQLi buffer a
+Here is an example for your init file. It keeps the SQLi buffer a
certain length.
\(add-hook 'sql-interactive-mode-hook
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index c072754e66..835d548c19 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -8790,7 +8790,7 @@ Note these are only read when the file is first visited, you must use
\\[find-alternate-file] RET to have these take effect after editing them!
If you want to disable the \"Process `eval' or hook local variables\"
-warning message, you need to add to your .emacs file:
+warning message, you need to add to your init file:
(setq enable-local-eval t)"
(let ((origbuf (current-buffer)))
@@ -11756,7 +11756,7 @@ An example:
// For this example we declare the function in the
// module's file itself. Often you'd define it instead
- // in a site-start.el or .emacs file.
+ // in a site-start.el or init file.
/*
Local Variables:
eval:
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 607ccd8b7e..0ca3439dd6 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -4138,10 +4138,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
(set (make-local-variable 'imenu-generic-expression)
vhdl-imenu-generic-expression)
(when (and vhdl-index-menu (fboundp 'imenu))
- (if (or (not (boundp 'font-lock-maximum-size))
- (> font-lock-maximum-size (buffer-size)))
- (imenu-add-to-menubar "Index")
- (message "Scanning buffer for index...buffer too big"))))
+ (imenu-add-to-menubar "Index")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Source file menu (using `easy-menu.el')
@@ -14385,10 +14382,10 @@ if required."
(define-key vhdl-speedbar-key-map (int-to-string key)
`(lambda () (interactive) (vhdl-speedbar-set-depth ,key)))
(setq key (1+ key)))))
- (define-key speedbar-key-map "h"
+ (define-key speedbar-mode-map "h"
(lambda () (interactive)
(speedbar-change-initial-expansion-list "vhdl directory")))
- (define-key speedbar-key-map "H"
+ (define-key speedbar-mode-map "H"
(lambda () (interactive)
(speedbar-change-initial-expansion-list "vhdl project")))
;; menu
@@ -17400,7 +17397,8 @@ to visually support naming conventions.")
"Display VARIABLE's documentation in *Help* buffer."
(interactive)
(unless (featurep 'xemacs)
- (help-setup-xref (list #'vhdl-doc-variable variable) (interactive-p)))
+ (help-setup-xref (list #'vhdl-doc-variable variable)
+ (called-interactively-p 'interactive)))
(with-output-to-temp-buffer
(if (fboundp 'help-buffer) (help-buffer) "*Help*")
(princ (documentation-property variable 'variable-documentation))
@@ -17412,7 +17410,8 @@ to visually support naming conventions.")
"Display VHDL Mode documentation in *Help* buffer."
(interactive)
(unless (featurep 'xemacs)
- (help-setup-xref (list #'vhdl-doc-mode) (interactive-p)))
+ (help-setup-xref (list #'vhdl-doc-mode)
+ (called-interactively-p 'interactive)))
(with-output-to-temp-buffer
(if (fboundp 'help-buffer) (help-buffer) "*Help*")
(princ mode-name)
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index addf2975c5..930e750ab2 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -1042,7 +1042,7 @@ Please send all bug fixes and enhancements to
;; variables `ps-bold-faces', `ps-italic-faces' and `ps-underlined-faces'.
;; These variables contain lists of faces that ps-print should consider bold,
;; italic or underline; to set them, put code like the following into your
-;; .emacs file:
+;; init file:
;;
;; (setq ps-bold-faces '(my-blue-face))
;; (setq ps-italic-faces '(my-red-face))
diff --git a/lisp/register.el b/lisp/register.el
index 2816c9831d..fb35a26a65 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -76,6 +76,22 @@ A list of the form (WINDOW-CONFIGURATION POSITION)
A list of the form (FRAME-CONFIGURATION POSITION)
represents a saved frame configuration plus a saved value of point.")
+(defgroup register nil
+ "Register commands."
+ :group 'convenience
+ :version "24.3")
+
+(defcustom register-separator nil
+ "Register containing the text to put between collected texts, or nil if none.
+
+When collecting text with
+`append-to-register' (resp. `prepend-to-register') contents of
+this register is added to the beginning (resp. end) of the marked
+text."
+ :group 'register
+ :type '(choice (const :tag "None" nil)
+ (character :tag "Use register" :value ?+)))
+
(defun get-register (register)
"Return contents of Emacs register named REGISTER, or nil if none."
(cdr (assq register register-alist)))
@@ -192,13 +208,24 @@ Interactively, NUMBER is the prefix arg (none means nil)."
(string-to-number (match-string 0)))
0))))
-(defun increment-register (number register)
- "Add NUMBER to the contents of register REGISTER.
-Interactively, NUMBER is the prefix arg."
- (interactive "p\ncIncrement register: ")
- (or (numberp (get-register register))
- (error "Register does not contain a number"))
- (set-register register (+ number (get-register register))))
+(defun increment-register (prefix register)
+ "Augment contents of REGISTER.
+Interactively, PREFIX is in raw form.
+
+If REGISTER contains a number, add `prefix-numeric-value' of
+PREFIX to it.
+
+If REGISTER is empty or if it contains text, call
+`append-to-register' with `delete-flag' set to PREFIX."
+ (interactive "P\ncIncrement register: ")
+ (let ((register-val (get-register register)))
+ (cond
+ ((numberp register-val)
+ (let ((number (prefix-numeric-value prefix)))
+ (set-register register (+ number register-val))))
+ ((or (not register-val) (stringp register-val))
+ (append-to-register register (region-beginning) (region-end) prefix))
+ (t (error "Register does not contain a number or text")))))
(defun view-register (register)
"Display what is contained in register named REGISTER.
@@ -349,10 +376,11 @@ Called from program, takes four args: REGISTER, START, END and DELETE-FLAG.
START and END are buffer positions indicating what to append."
(interactive "cAppend to register: \nr\nP")
(let ((reg (get-register register))
- (text (filter-buffer-substring start end)))
+ (text (filter-buffer-substring start end))
+ (separator (and register-separator (get-register register-separator))))
(set-register
register (cond ((not reg) text)
- ((stringp reg) (concat reg text))
+ ((stringp reg) (concat reg separator text))
(t (error "Register does not contain text")))))
(cond (delete-flag
(delete-region start end))
@@ -366,10 +394,11 @@ Called from program, takes four args: REGISTER, START, END and DELETE-FLAG.
START and END are buffer positions indicating what to prepend."
(interactive "cPrepend to register: \nr\nP")
(let ((reg (get-register register))
- (text (filter-buffer-substring start end)))
+ (text (filter-buffer-substring start end))
+ (separator (and register-separator (get-register register-separator))))
(set-register
register (cond ((not reg) text)
- ((stringp reg) (concat text reg))
+ ((stringp reg) (concat text separator reg))
(t (error "Register does not contain text")))))
(cond (delete-flag
(delete-region start end))
diff --git a/lisp/replace.el b/lisp/replace.el
index 3373ee8e51..001f7d1a78 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -33,6 +33,22 @@
:type 'boolean
:group 'matching)
+(defcustom replace-lax-whitespace nil
+ "Non-nil means `query-replace' matches a sequence of whitespace chars.
+When you enter a space or spaces in the strings to be replaced,
+it will match any sequence matched by the regexp `search-whitespace-regexp'."
+ :type 'boolean
+ :group 'matching
+ :version "24.3")
+
+(defcustom replace-regexp-lax-whitespace nil
+ "Non-nil means `query-replace-regexp' matches a sequence of whitespace chars.
+When you enter a space or spaces in the regexps to be replaced,
+it will match any sequence matched by the regexp `search-whitespace-regexp'."
+ :type 'boolean
+ :group 'matching
+ :version "24.3")
+
(defvar query-replace-history nil
"Default history list for query-replace commands.
See `query-replace-from-history-variable' and
@@ -226,6 +242,10 @@ letters. \(Transferring the case pattern means that if the old text
matched is all caps, or capitalized, then its replacement is upcased
or capitalized.)
+If `replace-lax-whitespace' is non-nil, a space or spaces in the string
+to be replaced will match a sequence of whitespace chars defined by the
+regexp in `search-whitespace-regexp'.
+
Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
only matches surrounded by word boundaries.
Fourth and fifth arg START and END specify the region to operate on.
@@ -270,6 +290,10 @@ pattern of the old text to the new text, if `case-replace' and
all caps, or capitalized, then its replacement is upcased or
capitalized.)
+If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp
+to be replaced will match a sequence of whitespace chars defined by the
+regexp in `search-whitespace-regexp'.
+
Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
only matches surrounded by word boundaries.
Fourth and fifth arg START and END specify the region to operate on.
@@ -346,6 +370,10 @@ minibuffer.
Preserves case in each replacement if `case-replace' and `case-fold-search'
are non-nil and REGEXP has no uppercase letters.
+If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp
+to be replaced will match a sequence of whitespace chars defined by the
+regexp in `search-whitespace-regexp'.
+
Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
only matches that are surrounded by word boundaries.
Fourth and fifth arg START and END specify the region to operate on."
@@ -437,6 +465,10 @@ are non-nil and FROM-STRING has no uppercase letters.
\(Preserving case means that if the string matched is all caps, or capitalized,
then its replacement is upcased or capitalized.)
+If `replace-lax-whitespace' is non-nil, a space or spaces in the string
+to be replaced will match a sequence of whitespace chars defined by the
+regexp in `search-whitespace-regexp'.
+
In Transient Mark mode, if the mark is active, operate on the contents
of the region. Otherwise, operate from point to the end of the buffer.
@@ -475,6 +507,10 @@ and TO-STRING is also null.)"
Preserve case in each match if `case-replace' and `case-fold-search'
are non-nil and REGEXP has no uppercase letters.
+If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp
+to be replaced will match a sequence of whitespace chars defined by the
+regexp in `search-whitespace-regexp'.
+
In Transient Mark mode, if the mark is active, operate on the contents
of the region. Otherwise, operate from point to the end of the buffer.
@@ -1589,14 +1625,28 @@ E to edit the replacement string"
(define-key map "?" 'help)
(define-key map "\C-g" 'quit)
(define-key map "\C-]" 'quit)
- (define-key map "\e" 'exit-prefix)
+ (define-key map "\C-v" 'scroll-up)
+ (define-key map "\M-v" 'scroll-down)
+ (define-key map [next] 'scroll-up)
+ (define-key map [prior] 'scroll-down)
+ (define-key map [?\C-\M-v] 'scroll-other-window)
+ (define-key map [M-next] 'scroll-other-window)
+ (define-key map [?\C-\M-\S-v] 'scroll-other-window-down)
+ (define-key map [M-prior] 'scroll-other-window-down)
+ ;; Binding ESC would prohibit the M-v binding. Instead, callers
+ ;; should check for ESC specially.
+ ;; (define-key map "\e" 'exit-prefix)
(define-key map [escape] 'exit-prefix)
map)
- "Keymap that defines the responses to questions in `query-replace'.
+ "Keymap of responses to questions posed by commands like `query-replace'.
The \"bindings\" in this map are not commands; they are answers.
The valid answers include `act', `skip', `act-and-show',
-`exit', `act-and-exit', `edit', `edit-replacement', `delete-and-edit',
-`recenter', `automatic', `backup', `exit-prefix', `quit', and `help'.")
+`act-and-exit', `exit', `exit-prefix', `recenter', `scroll-up',
+`scroll-down', `scroll-other-window', `scroll-other-window-down',
+`edit', `edit-replacement', `delete-and-edit', `automatic',
+`backup', `quit', and `help'.
+
+This keymap is used by `y-or-n-p' as well as `query-replace'.")
(defvar multi-query-replace-map
(let ((map (make-sparse-keymap)))
@@ -1717,12 +1767,12 @@ passed in. If LITERAL is set, no checking is done, anyway."
(replace-match newtext fixedcase literal)
noedit)
-(defvar replace-search-function 'search-forward
+(defvar replace-search-function nil
"Function to use when searching for strings to replace.
It is used by `query-replace' and `replace-string', and is called
with three arguments, as if it were `search-forward'.")
-(defvar replace-re-search-function 're-search-forward
+(defvar replace-re-search-function nil
"Function to use when searching for regexps to replace.
It is used by `query-replace-regexp', `replace-regexp',
`query-replace-regexp-eval', and `map-query-replace-regexp'.
@@ -1755,9 +1805,18 @@ make, or the user didn't cancel the call."
(nocasify (not (and case-replace case-fold-search)))
(literal (or (not regexp-flag) (eq regexp-flag 'literal)))
(search-function
- (if regexp-flag
- replace-re-search-function
- replace-search-function))
+ (or (if regexp-flag
+ replace-re-search-function
+ replace-search-function)
+ (let ((isearch-regexp regexp-flag)
+ (isearch-word delimited-flag)
+ (isearch-lax-whitespace
+ replace-lax-whitespace)
+ (isearch-regexp-lax-whitespace
+ replace-regexp-lax-whitespace)
+ (isearch-case-fold-search case-fold-search)
+ (isearch-forward t))
+ (isearch-search-fun))))
(search-string from-string)
(real-match-data nil) ; The match data for the current match.
(next-replacement nil)
@@ -1811,12 +1870,6 @@ make, or the user didn't cancel the call."
(vector repeat-count repeat-count
replacements replacements)))))
- (if delimited-flag
- (setq search-function 're-search-forward
- search-string (concat "\\b"
- (if regexp-flag from-string
- (regexp-quote from-string))
- "\\b")))
(when query-replace-lazy-highlight
(setq isearch-lazy-highlight-last-string nil))
@@ -1898,7 +1951,7 @@ make, or the user didn't cancel the call."
(replace-highlight
(nth 0 real-match-data) (nth 1 real-match-data)
start end search-string
- (or delimited-flag regexp-flag) case-fold-search))
+ regexp-flag delimited-flag case-fold-search))
(setq noedit
(replace-match-maybe-edit
next-replacement nocasify literal
@@ -1917,7 +1970,7 @@ make, or the user didn't cancel the call."
(replace-highlight
(match-beginning 0) (match-end 0)
start end search-string
- (or delimited-flag regexp-flag) case-fold-search)
+ regexp-flag delimited-flag case-fold-search)
;; Bind message-log-max so we don't fill up the message log
;; with a bunch of identical messages.
(let ((message-log-max nil)
@@ -2099,15 +2152,11 @@ make, or the user didn't cancel the call."
(if (= replace-count 1) "" "s")))
(or (and keep-going stack) multi-buffer)))
-(defvar isearch-error)
-(defvar isearch-forward)
-(defvar isearch-case-fold-search)
-(defvar isearch-string)
-
(defvar replace-overlay nil)
(defun replace-highlight (match-beg match-end range-beg range-end
- string regexp case-fold)
+ search-string regexp-flag delimited-flag
+ case-fold-search)
(if query-replace-highlight
(if replace-overlay
(move-overlay replace-overlay match-beg match-end (current-buffer))
@@ -2115,13 +2164,14 @@ make, or the user didn't cancel the call."
(overlay-put replace-overlay 'priority 1001) ;higher than lazy overlays
(overlay-put replace-overlay 'face 'query-replace)))
(if query-replace-lazy-highlight
- (let ((isearch-string string)
- (isearch-regexp regexp)
- ;; Set isearch-word to nil because word-replace is regexp-based,
- ;; so `isearch-search-fun' should not use `word-search-forward'.
- (isearch-word nil)
- (search-whitespace-regexp nil)
- (isearch-case-fold-search case-fold)
+ (let ((isearch-string search-string)
+ (isearch-regexp regexp-flag)
+ (isearch-word delimited-flag)
+ (isearch-lax-whitespace
+ replace-lax-whitespace)
+ (isearch-regexp-lax-whitespace
+ replace-regexp-lax-whitespace)
+ (isearch-case-fold-search case-fold-search)
(isearch-forward t)
(isearch-error nil))
(isearch-lazy-highlight-new-loop range-beg range-end))))
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index 43dad63a14..0c08216946 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -56,13 +56,12 @@ This means when you visit a file, point goes to the last place
where it was when you previously visited the same file.
This variable is automatically buffer-local.
-If you wish your place in any file to always be automatically saved,
-simply put this in your `~/.emacs' file:
+If you wish your place in any file to always be automatically
+saved, set this to t using the Customize facility, or put the
+following code in your init file:
\(setq-default save-place t)
-\(require 'saveplace)
-
-or else use the Custom facility to set this option."
+\(require 'saveplace)"
:type 'boolean
:require 'saveplace
:group 'save-place)
@@ -148,7 +147,8 @@ even in a later Emacs session.
If called with a prefix arg, the mode is enabled if and only if
the argument is positive.
-To save places automatically in all files, put this in your `.emacs' file:
+To save places automatically in all files, put this in your init
+file:
\(setq-default save-place t\)"
(interactive "P")
diff --git a/lisp/ses.el b/lisp/ses.el
index 8add16a699..7cdac74e31 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -1270,11 +1270,9 @@ when the width of cell (ROW,COL) has changed."
;; The data area
;;----------------------------------------------------------------------------
-(defun ses-narrowed-p () (/= (- (point-max) (point-min)) (buffer-size)))
-
(defun ses-widen ()
"Turn off narrowing, to be reenabled at end of command loop."
- (if (ses-narrowed-p)
+ (if (buffer-narrowed-p)
(setq ses--deferred-narrow t))
(widen))
diff --git a/lisp/shell.el b/lisp/shell.el
index b98efceefb..77a4238978 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -46,7 +46,7 @@
;; YOUR .EMACS FILE
;;=============================================================================
-;; Some suggestions for your .emacs file.
+;; Some suggestions for your init file.
;;
;; ;; Define M-# to run some strange command:
;; (eval-after-load "shell"
@@ -136,9 +136,7 @@ how Shell mode treats paragraphs.
The pattern should probably not match more than one line. If it does,
Shell mode may become confused trying to distinguish prompt from input
-on lines which don't start with a prompt.
-
-This is a fine thing to set in your `.emacs' file."
+on lines which don't start with a prompt."
:type 'regexp
:group 'shell)
@@ -146,9 +144,7 @@ This is a fine thing to set in your `.emacs' file."
"List of suffixes to be disregarded during file/command completion.
This variable is used to initialize `comint-completion-fignore' in the shell
buffer. The default is nil, for compatibility with most shells.
-Some people like (\"~\" \"#\" \"%\").
-
-This is a fine thing to set in your `.emacs' file."
+Some people like (\"~\" \"#\" \"%\")."
:type '(repeat (string :tag "Suffix"))
:group 'shell)
@@ -158,31 +154,29 @@ This variable is used to initialize `comint-delimiter-argument-list' in the
shell buffer. The value may depend on the operating system or shell."
:type '(choice (const nil)
(repeat :tag "List of characters" character))
- ;; Reverted.
-;; :version "24.1" ; changed to nil (bug#8027)
:group 'shell)
-(defvar shell-file-name-chars
+(defcustom shell-file-name-chars
(if (memq system-type '(ms-dos windows-nt cygwin))
"~/A-Za-z0-9_^$!#%&{}@`'.,:()-"
"[]~/A-Za-z0-9+@:_.$#%,={}-")
"String of characters valid in a file name.
This variable is used to initialize `comint-file-name-chars' in the
-shell buffer. The value may depend on the operating system or shell.
-
-This is a fine thing to set in your `.emacs' file.")
+shell buffer. The value may depend on the operating system or shell."
+ :type 'string
+ :group 'shell)
-(defvar shell-file-name-quote-list
+(defcustom shell-file-name-quote-list
(if (memq system-type '(ms-dos windows-nt))
nil
(append shell-delimiter-argument-list '(?\s ?$ ?\* ?\! ?\" ?\' ?\` ?\# ?\\)))
"List of characters to quote when in a file name.
This variable is used to initialize `comint-file-name-quote-list' in the
-shell buffer. The value may depend on the operating system or shell.
-
-This is a fine thing to set in your `.emacs' file.")
+shell buffer. The value may depend on the operating system or shell."
+ :type '(repeat character)
+ :group 'shell)
-(defvar shell-dynamic-complete-functions
+(defcustom shell-dynamic-complete-functions
'(comint-c-a-p-replace-by-expanded-history
shell-environment-variable-completion
shell-command-completion
@@ -192,9 +186,9 @@ This is a fine thing to set in your `.emacs' file.")
comint-filename-completion)
"List of functions called to perform completion.
This variable is used to initialize `comint-dynamic-complete-functions' in the
-shell buffer.
-
-This is a fine thing to set in your `.emacs' file.")
+shell buffer."
+ :type '(repeat function)
+ :group 'shell)
(defcustom shell-command-regexp "[^;&|\n]+"
"Regexp to match a single command within a pipeline.
diff --git a/lisp/simple.el b/lisp/simple.el
index b81e0d7ee8..6e37700b91 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -974,7 +974,9 @@ rather than the region.
If called from Lisp, return the number of words between positions
START and END."
- (interactive "r\nP")
+ (interactive (if current-prefix-arg
+ (list nil nil current-prefix-arg)
+ (list (region-beginning) (region-end) nil)))
(cond ((not (called-interactively-p 'any))
(count-words start end))
(arg
@@ -1008,9 +1010,7 @@ END, without printing any message."
(defun count-words--buffer-message ()
(count-words--message
- (if (= (point-max) (1+ (buffer-size)))
- "Buffer"
- "Narrowed part of buffer")
+ (if (buffer-narrowed-p) "Narrowed part of buffer" "Buffer")
(point-min) (point-max)))
(defun count-words--message (str start end)
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 16993ce189..25a6fbfd99 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -706,7 +706,7 @@ will be stripped by a simplified optimizer when compiled into a
singular expression. This variable will be turned into
`speedbar-file-regexp' for use with speedbar. You should use the
function `speedbar-add-supported-extension' to add a new extension at
-runtime, or use the configuration dialog to set it in your .emacs file.
+runtime, or use the configuration dialog to set it in your init file.
If you add an extension to this list, and it does not appear, you may
need to also modify `completion-ignored-extension' which will also help
file completion."
@@ -763,7 +763,7 @@ DIRECTORY-EXPRESSION to `speedbar-ignored-directory-expressions'."
"Non-nil means to automatically update the display.
When this is nil then speedbar will not follow the attached frame's directory.
If you want to change this while speedbar is active, either use
-\\[customize] or call \\<speedbar-key-map> `\\[speedbar-toggle-updates]'."
+\\[customize] or call \\<speedbar-mode-map> `\\[speedbar-toggle-updates]'."
:group 'speedbar
:initialize 'custom-initialize-default
:set (lambda (sym val)
@@ -1083,7 +1083,7 @@ Return nil if it doesn't exist."
(define-derived-mode speedbar-mode fundamental-mode "Speedbar"
"Major mode for managing a display of directories and tags.
-\\<speedbar-key-map>
+\\<speedbar-mode-map>
The first line represents the default directory of the speedbar frame.
Each directory segment is a button which jumps speedbar's default
directory to that directory. Buttons are activated by clicking `\\[speedbar-click]'.
@@ -1120,7 +1120,7 @@ category of tags. Click the {+} to expand the category. Jump-able
tags start with >. Click the name of the tag to go to that position
in the selected file.
-\\{speedbar-key-map}"
+\\{speedbar-mode-map}"
(save-excursion
(setq font-lock-keywords nil) ;; no font-locking please
(setq truncate-lines t)
diff --git a/lisp/startup.el b/lisp/startup.el
index dd21663890..a0122c7455 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -71,12 +71,13 @@ once you are familiar with the contents of the startup screen."
"Non-nil inhibits the initial startup echo area message.
Setting this variable takes effect
only if you do it with the customization buffer
-or if your `.emacs' file contains a line of this form:
+or if your init file contains a line of this form:
(setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\")
-If your `.emacs' file is byte-compiled, use the following form instead:
+If your init file is byte-compiled, use the following form
+instead:
(eval '(setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\"))
-Thus, someone else using a copy of your `.emacs' file will see
-the startup message unless he personally acts to inhibit it."
+Thus, someone else using a copy of your init file will see the
+startup message unless he personally acts to inhibit it."
:type '(choice (const :tag "Don't inhibit")
(string :tag "Enter your user name, to inhibit"))
:group 'initialization)
@@ -261,10 +262,14 @@ and VALUE is the value which is given to that frame parameter
"Normal hook run after handling urgent options but before loading init files.")
(defvar after-init-hook nil
- "Normal hook run after loading the init files, `~/.emacs' and `default.el'.
-There is no `condition-case' around the running of these functions;
-therefore, if you set `debug-on-error' non-nil in `.emacs',
-an error in one of these functions will invoke the debugger.")
+ "Normal hook run after initializing the Emacs session.
+It is run after Emacs loads the init file, `default' library, the
+abbrevs file, and additional Lisp packages (if any), and setting
+the value of `after-init-time'.
+
+There is no `condition-case' around the running of this hook;
+therefore, if `debug-on-error' is non-nil, an error in one of
+these functions will invoke the debugger.")
(defvar emacs-startup-hook nil
"Normal hook run after loading init files and handling the command line.")
@@ -296,7 +301,7 @@ the user's init file.")
:group 'initialization)
(defvar init-file-user nil
- "Identity of user whose `.emacs' file is or was read.
+ "Identity of user whose init file is or was read.
The value is nil if `-q' or `--no-init-file' was specified,
meaning do not load any init file.
@@ -306,7 +311,7 @@ or it may be a string containing a user's name meaning
use that person's init file.
In either of the latter cases, `(concat \"~\" init-file-user \"/\")'
-evaluates to the name of the directory where the `.emacs' file was
+evaluates to the name of the directory where the init file was
looked for.
Setting `init-file-user' does not prevent Emacs from loading
@@ -365,7 +370,7 @@ init file is read, in case it sets `mail-host-address'."
(t
(concat user-emacs-directory "auto-save-list/.saves-")))
"Prefix for generating `auto-save-list-file-name'.
-This is used after reading your `.emacs' file to initialize
+This is used after reading your init file to initialize
`auto-save-list-file-name', by appending Emacs's pid and the system name,
if you have not already set `auto-save-list-file-name' yourself.
Directories in the prefix will be created if necessary.
diff --git a/lisp/strokes.el b/lisp/strokes.el
index dfd0e95f61..62a8528f25 100644
--- a/lisp/strokes.el
+++ b/lisp/strokes.el
@@ -933,14 +933,7 @@ and then safely save them for later use, send letters to friends
extracting the strokes for editing use once again, so the editing
cycle can continue.
-Strokes are easy to program and fun to use. To start strokes going,
-you'll want to put the following line in your .emacs file as mentioned
-in the commentary to strokes.el.
-
-This will load strokes when and only when you start Emacs on a window
-system, with a mouse or other pointer device defined.
-
-To toggle strokes-mode, you just do
+To toggle strokes-mode, invoke the command
> M-x strokes-mode
diff --git a/lisp/subr.el b/lisp/subr.el
index 74afd59f8d..e9b85ff1f3 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -80,6 +80,7 @@ For more information, see Info node `(elisp)Declaring Functions'."
(defmacro noreturn (form)
"Evaluate FORM, expecting it not to return.
If FORM does return, signal an error."
+ (declare (debug t))
`(prog1 ,form
(error "Form marked with `noreturn' did return")))
@@ -87,6 +88,7 @@ If FORM does return, signal an error."
"Evaluate FORM, expecting a constant return value.
This is the global do-nothing version. There is also `testcover-1value'
that complains if FORM ever does return differing values."
+ (declare (debug t))
form)
(defmacro def-edebug-spec (symbol spec)
@@ -1250,11 +1252,6 @@ is converted into a string by expressing it in decimal."
'mode-line-inverse-video
"use the appropriate faces instead."
"21.1")
-(make-obsolete-variable
- 'unread-command-char
- "use `unread-command-events' instead. That variable is a list of events
-to reread, so it now uses nil to mean `no event', instead of -1."
- "before 19.15")
;; Lisp manual only updated in 22.1.
(define-obsolete-variable-alias 'executing-macro 'executing-kbd-macro
@@ -1548,7 +1545,7 @@ if it is empty or a duplicate."
(or keep-all
(not (equal (car history) newelt))))
(if history-delete-duplicates
- (delete newelt history))
+ (setq history (delete newelt history)))
(setq history (cons newelt history))
(when (integerp maxelt)
(if (= 0 maxelt)
@@ -2237,7 +2234,8 @@ keyboard-quit events while waiting for a valid input."
(error "Called `read-char-choice' without valid char choices"))
(let (char done show-help (helpbuf " *Char Help*"))
(let ((cursor-in-echo-area t)
- (executing-kbd-macro executing-kbd-macro))
+ (executing-kbd-macro executing-kbd-macro)
+ (esc-flag nil))
(save-window-excursion ; in case we call help-form-show
(while (not done)
(unless (get-text-property 0 'face prompt)
@@ -2261,8 +2259,12 @@ keyboard-quit events while waiting for a valid input."
;; there are no more events in the macro. Attempt to
;; get an event interactively.
(setq executing-kbd-macro nil))
- ((and (not inhibit-keyboard-quit) (eq char ?\C-g))
- (keyboard-quit))))))
+ ((not inhibit-keyboard-quit)
+ (cond
+ ((and (null esc-flag) (eq char ?\e))
+ (setq esc-flag t))
+ ((memq char '(?\C-g ?\e))
+ (keyboard-quit))))))))
;; Display the question with the answer. But without cursor-in-echo-area.
(message "%s%s" prompt (char-to-string char))
char))
@@ -2314,11 +2316,19 @@ floating point support."
PROMPT is the string to display to ask the question. It should
end in a space; `y-or-n-p' adds \"(y or n) \" to it.
-No confirmation of the answer is requested; a single character is enough.
-Also accepts Space to mean yes, or Delete to mean no. \(Actually, it uses
-the bindings in `query-replace-map'; see the documentation of that variable
-for more information. In this case, the useful bindings are `act', `skip',
-`recenter', and `quit'.\)
+No confirmation of the answer is requested; a single character is
+enough. SPC also means yes, and DEL means no.
+
+To be precise, this function translates user input into responses
+by consulting the bindings in `query-replace-map'; see the
+documentation of that variable for more information. In this
+case, the useful bindings are `act', `skip', `recenter',
+`scroll-up', `scroll-down', and `quit'.
+An `act' response means yes, and a `skip' response means no.
+A `quit' response means to invoke `keyboard-quit'.
+If the user enters `recenter', `scroll-up', or `scroll-down'
+responses, perform the requested window recentering or scrolling
+and ask again.
Under a windowing system a dialog box will be used if `last-nonmenu-event'
is nil and `use-dialog-box' is non-nil."
@@ -2350,21 +2360,33 @@ is nil and `use-dialog-box' is non-nil."
"" " ")
"(y or n) "))
(while
- (let* ((key
+ (let* ((scroll-actions '(recenter scroll-up scroll-down
+ scroll-other-window scroll-other-window-down))
+ (key
(let ((cursor-in-echo-area t))
(when minibuffer-auto-raise
(raise-frame (window-frame (minibuffer-window))))
- (read-key (propertize (if (eq answer 'recenter)
+ (read-key (propertize (if (memq answer scroll-actions)
prompt
(concat "Please answer y or n. "
prompt))
'face 'minibuffer-prompt)))))
(setq answer (lookup-key query-replace-map (vector key) t))
(cond
- ((memq answer '(skip act)) nil)
- ((eq answer 'recenter) (recenter) t)
- ((memq answer '(exit-prefix quit)) (signal 'quit nil) t)
- (t t)))
+ ((memq answer '(skip act)) nil)
+ ((eq answer 'recenter)
+ (recenter) t)
+ ((eq answer 'scroll-up)
+ (ignore-errors (scroll-up-command)) t)
+ ((eq answer 'scroll-down)
+ (ignore-errors (scroll-down-command)) t)
+ ((eq answer 'scroll-other-window)
+ (ignore-errors (scroll-other-window)) t)
+ ((eq answer 'scroll-other-window-down)
+ (ignore-errors (scroll-other-window-down)) t)
+ ((or (memq answer '(exit-prefix quit)) (eq key ?\e))
+ (signal 'quit nil) t)
+ (t t)))
(ding)
(discard-input))))
(let ((ret (eq answer 'act)))
@@ -2647,6 +2669,10 @@ directory if it does not exist."
;;;; Misc. useful functions.
+(defsubst buffer-narrowed-p ()
+ "Return non-nil if the current buffer is narrowed."
+ (/= (- (point-max) (point-min)) (buffer-size)))
+
(defun find-tag-default ()
"Determine default tag to search for, based on text at point.
If there is no plausible default, return nil."
@@ -3728,7 +3754,7 @@ from `standard-syntax-table' otherwise."
table))
(defun syntax-after (pos)
- "Return the raw syntax of the char after POS.
+ "Return the raw syntax descriptor for the char after POS.
If POS is outside the buffer's accessible portion, return nil."
(unless (or (< pos (point-min)) (>= pos (point-max)))
(let ((st (if parse-sexp-lookup-properties
@@ -3737,7 +3763,12 @@ If POS is outside the buffer's accessible portion, return nil."
(aref (or st (syntax-table)) (char-after pos))))))
(defun syntax-class (syntax)
- "Return the syntax class part of the syntax descriptor SYNTAX.
+ "Return the code for the syntax class described by SYNTAX.
+
+SYNTAX should be a raw syntax descriptor; the return value is a
+integer which encodes the corresponding syntax class. See Info
+node `(elisp)Syntax Table Internals' for a list of codes.
+
If SYNTAX is nil, return nil."
(and syntax (logand (car syntax) 65535)))
@@ -3877,6 +3908,11 @@ The properties used on SYMBOL are `composefunc', `sendfunc',
(put symbol 'hookvar (or hookvar 'mail-send-hook)))
(defun set-temporary-overlay-map (map &optional keep-pred)
+ "Set MAP as a temporary overlay map.
+When KEEP-PRED is `t', using a key from the temporary keymap
+leaves this keymap activated. KEEP-PRED can also be a function,
+which will have the same effect when it returns `t'.
+When KEEP-PRED is nil, the temporary keymap is used only once."
(let* ((clearfunsym (make-symbol "clear-temporary-overlay-map"))
(overlaysym (make-symbol "t"))
(alist (list (cons overlaysym map)))
@@ -3889,6 +3925,7 @@ The properties used on SYMBOL are `composefunc', `sendfunc',
(lookup-key ',map
(this-command-keys-vector))))
(t `(funcall ',keep-pred)))
+ (set ',overlaysym nil) ;Just in case.
(remove-hook 'pre-command-hook ',clearfunsym)
(setq emulation-mode-map-alists
(delq ',alist emulation-mode-map-alists))))))
diff --git a/lisp/term/iris-ansi.el b/lisp/term/iris-ansi.el
index 9a9a31f425..aea2e8c109 100644
--- a/lisp/term/iris-ansi.el
+++ b/lisp/term/iris-ansi.el
@@ -322,7 +322,7 @@
"Terminal initialization function for iris-ansi."
;; Use inheritance to let the main keymap override these defaults.
;; This way we don't override terminfo-derived settings or settings
- ;; made in the .emacs file.
+ ;; made in the init file.
(let ((m (copy-keymap iris-function-map)))
(set-keymap-parent m (keymap-parent input-decode-map))
(set-keymap-parent input-decode-map m)))
diff --git a/lisp/term/lk201.el b/lisp/term/lk201.el
index 76a3a31ced..6b9e130100 100644
--- a/lisp/term/lk201.el
+++ b/lisp/term/lk201.el
@@ -75,7 +75,7 @@
(defun terminal-init-lk201 ()
;; Use inheritance to let the main keymap override these defaults.
;; This way we don't override terminfo-derived settings or settings
- ;; made in the .emacs file.
+ ;; made in the init file.
(let ((m (copy-keymap lk201-function-map)))
(set-keymap-parent m (keymap-parent input-decode-map))
(set-keymap-parent input-decode-map m)))
diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index 481d6b498c..9814156300 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -166,7 +166,7 @@
;; Use inheritance to let the main keymap override those defaults.
;; This way we don't override terminfo-derived settings or settings
- ;; made in the .emacs file.
+ ;; made in the init file.
(let ((m (copy-keymap rxvt-function-map)))
(set-keymap-parent m (keymap-parent input-decode-map))
(set-keymap-parent input-decode-map m))
diff --git a/lisp/term/tvi970.el b/lisp/term/tvi970.el
index b02d39c1e0..f1b6eea887 100644
--- a/lisp/term/tvi970.el
+++ b/lisp/term/tvi970.el
@@ -93,7 +93,7 @@
"Terminal initialization function for tvi970."
;; Use inheritance to let the main keymap override these defaults.
;; This way we don't override terminfo-derived settings or settings
- ;; made in the .emacs file.
+ ;; made in the init file.
(let ((m (copy-keymap tvi970-terminal-map)))
(set-keymap-parent m (keymap-parent input-decode-map))
(set-keymap-parent input-decode-map m))
diff --git a/lisp/term/wyse50.el b/lisp/term/wyse50.el
index d037962af1..ce148b62db 100644
--- a/lisp/term/wyse50.el
+++ b/lisp/term/wyse50.el
@@ -109,7 +109,7 @@
"Terminal initialization function for wyse50."
;; Use inheritance to let the main keymap override these defaults.
;; This way we don't override terminfo-derived settings or settings
- ;; made in the .emacs file.
+ ;; made in the init file.
(let ((m (copy-keymap wyse50-terminal-map)))
(set-keymap-parent m (keymap-parent input-decode-map))
(set-keymap-parent input-decode-map m))
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 28fb9da0b9..e4871658b9 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -480,7 +480,7 @@ The relevant features are:
;; Use inheritance to let the main keymap override those defaults.
;; This way we don't override terminfo-derived settings or settings
- ;; made in the .emacs file.
+ ;; made in the init file.
(set-keymap-parent map (keymap-parent input-decode-map))
(set-keymap-parent input-decode-map map)))
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index a9320d945e..42f0418b69 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -290,9 +290,9 @@ If this variable is nil, all regions are treated as small."
;;* Mode specific options enable users to disable flyspell on */
;;* certain word depending of the emacs mode. For instance, when */
;;* using flyspell with mail-mode add the following expression */
-;;* in your .emacs file: */
+;;* in your init file: */
;;* (add-hook 'mail-mode */
-;;* (lambda () (setq flyspell-generic-check-word-predicate */
+;;* (lambda () (setq flyspell-generic-check-word-predicate */
;;* 'mail-mode-flyspell-verify))) */
;;*---------------------------------------------------------------------*/
(defvar flyspell-generic-check-word-predicate nil
@@ -488,7 +488,7 @@ invoking `ispell-change-dictionary'.
Consider using the `ispell-parser' to check your text. For instance
consider adding:
\(add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex))))
-in your .emacs file.
+in your init file.
\\[flyspell-region] checks all words inside a region.
\\[flyspell-buffer] checks the whole buffer."
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 0c7966f22d..51a4800de5 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1127,7 +1127,8 @@ aspell is used along with Emacs).")
;; If Emacs flavor supports [:alpha:] use it for global dicts. If
;; spellchecker also supports UTF-8 via command-line option use it
- ;; in communication. This does not affect definitions in ~/.emacs.
+ ;; in communication. This does not affect definitions in your
+ ;; init file.
(if ispell-emacs-alpha-regexp
(let (tmp-dicts-alist)
(dolist (adict ispell-dictionary-alist)
@@ -3680,7 +3681,7 @@ use the `x' command. (Any subsequent regions will be checked.)
The `X' command aborts sending the message so that you can edit the buffer.
To spell-check whenever a message is sent, include the appropriate lines
-in your .emacs file:
+in your init file:
(add-hook 'message-send-hook 'ispell-message) ;; GNUS 5
(add-hook 'news-inews-hook 'ispell-message) ;; GNUS 4
(add-hook 'mail-send-hook 'ispell-message)
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index 24a4ac1b03..e663c1b45f 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -612,13 +612,15 @@ Leaves the region surrounding the rectangle."
(define-key map [remap self-insert-command] 'picture-self-insert)
(define-key map [remap self-insert-command] 'picture-self-insert)
(define-key map [remap completion-separator-self-insert-command]
- 'picture-self-insert)
+ 'picture-self-insert)
(define-key map [remap completion-separator-self-insert-autofilling]
- 'picture-self-insert)
+ 'picture-self-insert)
(define-key map [remap forward-char] 'picture-forward-column)
+ (define-key map [remap right-char] 'picture-forward-column)
(define-key map [remap backward-char] 'picture-backward-column)
+ (define-key map [remap left-char] 'picture-backward-column)
(define-key map [remap delete-char] 'picture-clear-column)
- ;; There are two possibilities for what is normally on DEL.
+ ;; There are two possibilities for what is normally on DEL.
(define-key map [remap backward-delete-char-untabify]
'picture-backward-clear-column)
(define-key map [remap delete-backward-char] 'picture-backward-clear-column)
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index d8afb3e554..8584c496a9 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -47,7 +47,7 @@
;; To turn RefTeX Mode on and off in a buffer, use `M-x reftex-mode'.
;;
;; To turn on RefTeX Mode for all LaTeX files, add the following lines
-;; to your .emacs file:
+;; to your init file:
;;
;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; AUCTeX LaTeX mode
;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; Emacs latex mode
@@ -99,7 +99,7 @@
;;
;; To turn RefTeX Mode on and off in a particular buffer, use `M-x
;; reftex-mode'. To turn on RefTeX Mode for all LaTeX files, add the
-;; following lines to your `.emacs' file:
+;; following lines to your init file:
;;
;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index 767f8f360b..e2647a9877 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -81,7 +81,7 @@
;;; INSTALLATION
-;; Add the following lines to your `.emacs' file:
+;; Add the following lines to your init file:
;;
;; (require 'rst)
;;
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 5bcd87ede6..67d7f8c01f 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -451,7 +451,7 @@ the next N words. In Transient Mark mode, when the mark is active,
N defaults to -1, which means to wrap it around the current region.
If you like upcased tags, put (setq sgml-transformation-function 'upcase)
-in your `.emacs' file.
+in your init file.
Use \\[sgml-validate] to validate your document with an SGML parser.
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 2664a89855..459e884d45 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -126,7 +126,7 @@
;; again.
;;
;; To use the package regularly place this file in the site library
-;; directory and add the next expression in your .emacs file. Make
+;; directory and add the next expression in your init file. Make
;; sure that directory is included in the `load-path'.
;;
;; (require 'table)
@@ -342,10 +342,10 @@
;; (function (lambda ()
;; (local-set-key [<key sequence>] '<function>))))
;;
-;; Above code is well known ~/.emacs idiom for customizing a mode
-;; specific keymap however it does not work for this package. This is
-;; because there is no table mode in effect. This package does not
-;; use a local map therefore you must modify `table-cell-map'
+;; Adding the above to your init file is a common way to customize a
+;; mode specific keymap. However it does not work for this package.
+;; This is because there is no table mode in effect. This package
+;; does not use a local map therefore you must modify `table-cell-map'
;; explicitly. The correct way of achieving above task is:
;;
;; (add-hook 'table-cell-map-hook
diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el
index 8a4fe4f87f..b21e72639f 100644
--- a/lisp/textmodes/two-column.el
+++ b/lisp/textmodes/two-column.el
@@ -276,8 +276,9 @@ You have the following commands at your disposal:
\\[2C-merge] Merge both buffers
\\[2C-dissociate] Dissociate the two buffers
-These keybindings can be customized in your ~/.emacs by `2C-mode-map',
-`2C-minor-mode-map' and by binding `2C-command' to some prefix.
+These keybindings can be customized in your init file by
+`2C-mode-map', `2C-minor-mode-map' and by binding `2C-command' to
+some prefix.
The appearance of the screen can be customized by the variables
`2C-window-width', `2C-beyond-fill-column', `2C-mode-line-format' and
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el
index 13963121e2..c2ac1035df 100644
--- a/lisp/time-stamp.el
+++ b/lisp/time-stamp.el
@@ -29,7 +29,7 @@
;; static char *ts = "sdmain.c Time-stamp: <2001-08-13 10:20:51 gildea>";
;; See the top of `time-stamp.el' for another example.
-;; To use time-stamping, add this line to your .emacs file:
+;; To use time-stamping, add this line to your init file:
;; (add-hook 'before-save-hook 'time-stamp)
;; Now any time-stamp templates in your files will be updated automatically.
@@ -254,7 +254,7 @@ time-stamped file itself.")
(defun time-stamp ()
"Update the time stamp string(s) in the buffer.
A template in a file can be automatically updated with a new time stamp
-every time you save the file. Add this line to your .emacs file:
+every time you save the file. Add this line to your init file:
(add-hook 'before-save-hook 'time-stamp)
or customize `before-save-hook' through Custom.
Normally the template must appear in the first 8 lines of a file and
diff --git a/lisp/time.el b/lisp/time.el
index 8d43b56541..fe3cdbb57b 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -575,7 +575,8 @@ To turn off the world time display, go to that window and type `q'."
(let ((list timer-list))
(while list
(let ((elt (pop list)))
- (when (equal (symbol-name (aref elt 5)) "display-time-world-timer")
+ (when (equal (symbol-name (timer--function elt))
+ "display-time-world-timer")
(cancel-timer elt)))))))
;;;###autoload
diff --git a/lisp/url/url-methods.el b/lisp/url/url-methods.el
index bd7d8e3392..26fe72014f 100644
--- a/lisp/url/url-methods.el
+++ b/lisp/url/url-methods.el
@@ -79,7 +79,7 @@
;; Store any proxying information - this will not overwrite an old
;; entry, so that people can still set this information in their
- ;; .emacs file
+ ;; init file
(cond
(cur-proxy nil) ; Keep their old settings
((null env-proxy) nil) ; No proxy setup
diff --git a/lisp/userlock.el b/lisp/userlock.el
index 705d958824..4c003e423a 100644
--- a/lisp/userlock.el
+++ b/lisp/userlock.el
@@ -108,37 +108,27 @@ You can rewrite this to use any criterion you like to choose which one to do.
The buffer in question is current when this function is called."
(discard-input)
(save-window-excursion
- (let (answer)
+ (let ((prompt
+ (format "%s changed on disk; \
+really edit the buffer? (y, n, r or C-h) "
+ (file-name-nondirectory fn)))
+ (choices '(?y ?n ?r ?? ?\C-h))
+ answer)
(while (null answer)
- (message "%s changed on disk; really edit the buffer? (y, n, r or C-h) "
- (file-name-nondirectory fn))
- (let ((tem (downcase (let ((cursor-in-echo-area t))
- (read-char-exclusive)))))
- (setq answer
- (if (= tem help-char)
- 'help
- (cdr (assoc tem '((?n . yield)
- (?\C-g . yield)
- (?y . proceed)
- (?r . revert)
- (?? . help))))))
- (cond ((null answer)
- (beep)
- (message "Please type y, n or r; or ? for help")
- (sit-for 3))
- ((eq answer 'help)
- (ask-user-about-supersession-help)
- (setq answer nil))
- ((eq answer 'revert)
- (revert-buffer nil (not (buffer-modified-p)))
- ; ask confirmation if buffer modified
- (signal 'file-supersession
- (list "File reverted" fn)))
- ((eq answer 'yield)
- (signal 'file-supersession
- (list "File changed on disk" fn))))))
+ (setq answer (read-char-choice prompt choices))
+ (cond ((memq answer '(?? ?\C-h))
+ (ask-user-about-supersession-help)
+ (setq answer nil))
+ ((eq answer ?r)
+ ;; Ask for confirmation if buffer modified
+ (revert-buffer nil (not (buffer-modified-p)))
+ (signal 'file-supersession
+ (list "File reverted" fn)))
+ ((eq answer ?n)
+ (signal 'file-supersession
+ (list "File changed on disk" fn)))))
(message
- "File on disk now will become a backup file if you save these changes.")
+ "File on disk now will become a backup file if you save these changes.")
(setq buffer-backed-up nil))))
(defun ask-user-about-supersession-help ()
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index c6a9371ea9..11ec785b64 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -178,6 +178,8 @@ when editing big diffs)."
["Unified -> Context" diff-unified->context
:help "Convert unified diffs to context diffs"]
;;["Fixup Headers" diff-fixup-modifs (not buffer-read-only)]
+ ["Remove trailing whitespace" diff-remove-trailing-whitespace
+ :help "Remove trailing whitespace problems introduced by the diff"]
["Show trailing whitespace" whitespace-mode
:style toggle :selected (bound-and-true-p whitespace-mode)
:help "Show trailing whitespace in modified lines"]
diff --git a/lisp/vc/pcvs-defs.el b/lisp/vc/pcvs-defs.el
index 0f71b7b82e..fc65d62c67 100644
--- a/lisp/vc/pcvs-defs.el
+++ b/lisp/vc/pcvs-defs.el
@@ -57,11 +57,7 @@ versions, such as the one in SunOS-4.")
;;;; END OF THINGS TO CHECK WHEN INSTALLING
;;;; --------------------------------------------------------
-;;;;
;;;; User configuration variables:
-;;;;
-;;;; NOTE: these should be set in your ~/.emacs (or site-lisp/default.el) file.
-;;;;
(defgroup pcl-cvs nil
"Special support for the CVS versioning system."
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index c0dafda57b..1eb33776f6 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -534,7 +534,9 @@ in the branch repository (or whose status not be determined)."
;; FIXME: maybe it's overkill to check if both these
;; files exist.
(and (file-exists-p branch-format-file)
- (file-exists-p lastrev-file)))))
+ (file-exists-p lastrev-file)
+ (equal (emacs-bzr-version-dirstate l-c-parent-dir)
+ (emacs-bzr-version-dirstate rootdir))))))
t)))
(with-temp-buffer
(insert-file-contents branch-format-file)
@@ -553,13 +555,17 @@ in the branch repository (or whose status not be determined)."
(insert-file-contents lastrev-file)
(when (re-search-forward "[0-9]+" nil t)
(buffer-substring (match-beginning 0) (match-end 0))))))
- ;; fallback to calling "bzr revno"
+ ;; Fallback to calling "bzr revno --tree".
+ ;; The "--tree" matters for lightweight checkouts not on the same
+ ;; revision as the parent.
(let* ((result (vc-bzr-command-discarding-stderr
- vc-bzr-program "revno" (file-relative-name file)))
+ vc-bzr-program "revno" "--tree"
+ (file-relative-name file)))
(exitcode (car result))
(output (cdr result)))
(cond
- ((eq exitcode 0) (substring output 0 -1))
+ ((and (eq exitcode 0) (not (zerop (length output))))
+ (substring output 0 -1))
(t nil))))))
(defun vc-bzr-create-repo ()
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index b48ea1afd9..ea9ce949cc 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -31,7 +31,7 @@
;; To install: put this file on the load-path and add Git to the list
;; of supported backends in `vc-handled-backends'; the following line,
-;; placed in your ~/.emacs, will accomplish this:
+;; placed in your init file, will accomplish this:
;;
;; (add-to-list 'vc-handled-backends 'Git)
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 1ef4faaa00..47800bd4aa 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -653,7 +653,6 @@
(require 'vc-hooks)
(require 'vc-dispatcher)
-(require 'ediff)
(declare-function diff-setup-whitespace "diff-mode" ())
@@ -1698,7 +1697,9 @@ saving the buffer."
(vc-diff-internal t (vc-deduce-fileset t) nil nil
(called-interactively-p 'interactive))))
-(declare-function ediff-vc-internal (rev1 rev2 &optional startup-hooks))
+(declare-function ediff-load-version-control "ediff" (&optional silent))
+(declare-function ediff-vc-internal "ediff-vers"
+ (rev1 rev2 &optional startup-hooks))
;;;###autoload
(defun vc-version-ediff (files rev1 rev2)
@@ -1719,7 +1720,8 @@ repository history using ediff."
;; FIXME We only support running ediff on one file for now.
;; We could spin off an ediff session per file in the file set.
((= (length files) 1)
- (ediff-load-version-control)
+ (require 'ediff)
+ (ediff-load-version-control) ; loads ediff-vers
(find-file (car files)) ;FIXME: find-file from Elisp is bad.
(ediff-vc-internal rev1 rev2 nil))
(t
diff --git a/lisp/version.el b/lisp/version.el
index e63c51d0d2..1fb3828e15 100644
--- a/lisp/version.el
+++ b/lisp/version.el
@@ -87,40 +87,91 @@ to the system configuration; look at `system-configuration' instead."
;; Set during dumping, this is a defvar so that it can be setq'd.
(defvar emacs-bzr-version nil
"String giving the bzr revision from which this Emacs was built.
-Value is the bzr revision number and a revision ID separated by a blank.
+The format is: [revno] revision_id, where revno may be absent.
Value is nil if Emacs was not built from a bzr checkout, or if we could
not determine the revision.")
-(defun emacs-bzr-get-version (&optional dir)
- "Try to return as a string the bzr revision number of the Emacs sources.
-Value is the bzr revision number and a revision ID separated by a blank.
+(defun emacs-bzr-version-dirstate (dir)
+ "Try to return as a string the bzr revision ID of directory DIR.
+This uses the dirstate file's parent revision entry.
+Returns nil if unable to find this information."
+ (let ((file (expand-file-name ".bzr/checkout/dirstate" dir)))
+ (when (file-readable-p file)
+ (with-temp-buffer
+ (insert-file-contents file)
+ (and (looking-at "#bazaar dirstate flat format 3")
+ (forward-line 3)
+ (looking-at "[0-9]+\0\\([^\0\n]+\\)\0")
+ (match-string 1))))))
+
+(defun emacs-bzr-version-bzr (dir)
+ "Ask bzr itself for the version information for directory DIR."
+ ;; Comments on `bzr version-info':
+ ;; i) Unknown files also cause clean != 1.
+ ;; ii) It can be slow, contacting the upstream repo to get the
+ ;; branch nick if one is not set locally, even with a custom
+ ;; template that is not asking for the nick (as used here). You'd
+ ;; think the latter part would be trivial to fix:
+ ;; https://bugs.launchpad.net/bzr/+bug/882541/comments/3
+ ;; https://bugs.launchpad.net/bzr/+bug/629150
+ ;; You can set the nick locally with `bzr nick ...', which speeds
+ ;; things up enormously. `bzr revno' does not have this issue, but
+ ;; has no way to print the revision_id AFAICS.
+ (message "Waiting for bzr...")
+ (with-temp-buffer
+ (if (zerop
+ (call-process "bzr" nil '(t nil) nil "version-info"
+ "--custom"
+ "--template={revno} {revision_id} (clean = {clean})"
+ "dir"))
+ (buffer-string))))
+
+(defun emacs-bzr-get-version (&optional dir external)
+ "Try to return as a string the bzr revision of the Emacs sources.
+The format is: [revno] revision_id, where revno may be absent.
Value is nil if the sources do not seem to be under bzr, or if we could
not determine the revision. Note that this reports on the current state
of the sources, which may not correspond to the running Emacs.
-Optional argument DIR is a directory to use instead of `source-directory'."
+Optional argument DIR is a directory to use instead of `source-directory'.
+Optional argument EXTERNAL non-nil means to maybe ask `bzr' itself,
+if the sources appear to be under bzr. If `force', always ask bzr.
+Otherwise only ask bzr if we cannot find any information ourselves."
(or dir (setq dir source-directory))
- (when (file-directory-p (setq dir (expand-file-name ".bzr/branch" dir)))
- (let (file loc)
- (cond ((file-readable-p
- (setq file (expand-file-name "last-revision" dir)))
- (with-temp-buffer
- (insert-file-contents file)
- (goto-char (point-max))
- (if (looking-back "\n")
- (delete-char -1))
- (buffer-string)))
- ;; OK, no last-revision. Is it a lightweight checkout?
- ((file-readable-p
- (setq file (expand-file-name "location" dir)))
- ;; If the parent branch is local, try looking there for the revid.
- (if (setq loc (with-temp-buffer
- (insert-file-contents file)
- (if (looking-at "file://\\(.*\\)")
- (match-string 1))))
- (emacs-bzr-get-version loc)))
- ;; Could fall back to eg `bzr testament' at this point.
- ))))
+ (when (file-directory-p (expand-file-name ".bzr/branch" dir))
+ (if (eq external 'force)
+ (emacs-bzr-version-bzr dir)
+ (let (file loc rev)
+ (cond ((file-readable-p
+ (setq file (expand-file-name ".bzr/branch/last-revision" dir)))
+ (with-temp-buffer
+ (insert-file-contents file)
+ (goto-char (point-max))
+ (if (looking-back "\n")
+ (delete-char -1))
+ (buffer-string)))
+ ;; OK, no last-revision. Is it a lightweight checkout?
+ ((file-readable-p
+ (setq file (expand-file-name ".bzr/branch/location" dir)))
+ (setq rev (emacs-bzr-version-dirstate dir))
+ ;; If the parent branch is local, try looking there for the rev.
+ ;; Note: there is no guarantee that the parent branch's rev
+ ;; corresponds to this branch. This branch could have
+ ;; been made with a specific -r revno argument, or the
+ ;; parent could have been updated since this branch was created.
+ ;; To try and detect this, we check the dirstate revids
+ ;; to see if they match.
+ (if (and (setq loc (with-temp-buffer
+ (insert-file-contents file)
+ (if (looking-at "file://\\(.*\\)")
+ (match-string 1))))
+ (equal rev (emacs-bzr-version-dirstate loc)))
+ (emacs-bzr-get-version loc)
+ ;; If parent does not match, the best we can do without
+ ;; calling external commands is to use the dirstate rev.
+ rev))
+ (external
+ (emacs-bzr-version-bzr dir)))))))
;; We put version info into the executable in the form that `ident' uses.
(purecopy (concat "\n$Id: " (subst-char-in-string ?\n ?\s (emacs-version))
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 3a1afec38e..1181e409df 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -94,7 +94,7 @@
;; Installation:
;;
-;; Put the following line in your `.emacs' file:
+;; Put the following line in your init file:
;;
;; (windmove-default-keybindings) ; shifted arrow keys
;;
diff --git a/lisp/window.el b/lisp/window.el
index 2fce874e98..fccb68bd94 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -73,6 +73,108 @@ are not altered by this macro (unless they are altered in BODY)."
(when (window-live-p save-selected-window-window)
(select-window save-selected-window-window 'norecord))))))
+(defvar temp-buffer-window-setup-hook nil
+ "Normal hook run by `with-temp-buffer-window' before buffer display.
+This hook is run by `with-temp-buffer-window' with the buffer to be
+displayed current.")
+
+(defvar temp-buffer-window-show-hook nil
+ "Normal hook run by `with-temp-buffer-window' after buffer display.
+This hook is run by `with-temp-buffer-window' with the buffer
+displayed and current and its window selected.")
+
+(defun temp-buffer-window-setup (buffer-or-name)
+ "Set up temporary buffer specified by BUFFER-OR-NAME
+Return the buffer."
+ (let ((old-dir default-directory)
+ (buffer (get-buffer-create buffer-or-name)))
+ (with-current-buffer buffer
+ (kill-all-local-variables)
+ (setq default-directory old-dir)
+ (delete-all-overlays)
+ (setq buffer-read-only nil)
+ (setq buffer-file-name nil)
+ (setq buffer-undo-list t)
+ (let ((inhibit-read-only t)
+ (inhibit-modification-hooks t))
+ (erase-buffer)
+ (run-hooks 'temp-buffer-window-setup-hook))
+ ;; Return the buffer.
+ buffer)))
+
+(defun temp-buffer-window-show (&optional buffer action)
+ "Show temporary buffer BUFFER in a window.
+Return the window showing BUFFER. Pass ACTION as action argument
+to `display-buffer'."
+ (let (window frame)
+ (with-current-buffer buffer
+ (set-buffer-modified-p nil)
+ (setq buffer-read-only t)
+ (goto-char (point-min))
+ (when (setq window (display-buffer buffer action))
+ (setq frame (window-frame window))
+ (unless (eq frame (selected-frame))
+ (raise-frame frame))
+ (setq minibuffer-scroll-window window)
+ (set-window-hscroll window 0)
+ (with-selected-window window
+ (run-hooks 'temp-buffer-window-show-hook)
+ (when temp-buffer-resize-mode
+ (resize-temp-buffer-window window)))
+ ;; Return the window.
+ window))))
+
+(defmacro with-temp-buffer-window (buffer-or-name action quit-function &rest body)
+ "Evaluate BODY and display buffer specified by BUFFER-OR-NAME.
+BUFFER-OR-NAME must specify either a live buffer or the name of a
+buffer. If no buffer with such a name exists, create one.
+
+Make sure the specified buffer is empty before evaluating BODY.
+Do not make that buffer current for BODY. Instead, bind
+`standard-output' to that buffer, so that output generated with
+`prin1' and similar functions in BODY goes into that buffer.
+
+After evaluating BODY, mark the specified buffer unmodified and
+read-only, and display it in a window via `display-buffer'. Pass
+ACTION as action argument to `display-buffer'. Automatically
+shrink the window used if `temp-buffer-resize-mode' is enabled.
+
+Return the value returned by BODY unless QUIT-FUNCTION specifies
+a function. In that case, run the function with two arguments -
+the window showing the specified buffer and the value returned by
+BODY - and return the value returned by that function.
+
+If the buffer is displayed on a new frame, the window manager may
+decide to select that frame. In that case, it's usually a good
+strategy if the function specified by QUIT-FUNCTION selects the
+window showing the buffer before reading a value from the
+minibuffer, for example, when asking a `yes-or-no-p' question.
+
+This construct is similar to `with-output-to-temp-buffer' but
+does neither put the buffer in help mode nor does it call
+`temp-buffer-show-function'. It also runs different hooks,
+namely `temp-buffer-window-setup-hook' (with the specified buffer
+current) and `temp-buffer-window-show-hook' (with the specified
+buffer current and the window showing it selected).
+
+Since this macro calls `display-buffer', the window displaying
+the buffer is usually not selected and the specified buffer
+usually not made current. QUIT-FUNCTION can override that."
+ (declare (debug t))
+ (let ((buffer (make-symbol "buffer"))
+ (window (make-symbol "window"))
+ (value (make-symbol "value")))
+ `(let* ((,buffer (temp-buffer-window-setup ,buffer-or-name))
+ (standard-output ,buffer)
+ ,window ,value)
+ (with-current-buffer ,buffer
+ (setq ,value (progn ,@body))
+ (setq ,window (temp-buffer-window-show ,buffer ,action)))
+
+ (if (functionp ,quit-function)
+ (funcall ,quit-function ,window ,value)
+ ,value))))
+
;; The following two functions are like `window-next-sibling' and
;; `window-prev-sibling' but the WINDOW argument is _not_ optional (so
;; they don't substitute the selected window for nil), and they return
@@ -4449,6 +4551,9 @@ of the window used."
(function :tag "function"))
:group 'windows)
+(make-obsolete-variable 'display-buffer-function
+ 'display-buffer-alist "24.3")
+
;; Eventually, we want to turn this into a defvar; instead of
;; customizing this, the user should use a `pop-up-frame-parameters'
;; alist entry in `display-buffer-base-action'.
@@ -4666,8 +4771,8 @@ the selected window. If they contain (same-frame . t), display
BUFFER in a window of the selected frame.
If ARGS is a list whose car is a symbol, use (car ARGS) as a
-function to do the work. Pass it BUFFER as first argument,
-and (cdr ARGS) as second."
+function to do the work. Pass it BUFFER as first argument, and
+pass the elements of (cdr ARGS) as the remaining arguments."
(if (and args (symbolp (car args)))
(apply (car args) buffer (cdr args))
(let ((window (get-buffer-window buffer 0)))
@@ -4696,6 +4801,9 @@ and (cdr ARGS) as second."
(make-frame (append args special-display-frame-alist))))
(window (frame-selected-window frame)))
(display-buffer-record-window 'frame window buffer)
+ (unless (eq buffer (window-buffer window))
+ (set-window-buffer window buffer)
+ (set-window-prev-buffers window nil))
(set-window-dedicated-p window t)
window)))))
@@ -5416,6 +5524,62 @@ the selected one."
(window--display-buffer
buffer window 'reuse display-buffer-mark-dedicated)))))
+(defun display-buffer-in-previous-window (buffer alist)
+ "Display BUFFER in a window previously showing it.
+If ALIST has a non-nil `inhibit-same-window' entry, the selected
+window is not eligible for reuse.
+
+If ALIST contains a `reusable-frames' entry, its value determines
+which frames to search for a reusable window:
+ nil -- the selected frame (actually the last non-minibuffer frame)
+ A frame -- just that frame
+ `visible' -- all visible frames
+ 0 -- all frames on the current terminal
+ t -- all frames.
+
+If ALIST contains no `reusable-frames' entry, search just the
+selected frame if `display-buffer-reuse-frames' and
+`pop-up-frames' are both nil; search all frames on the current
+terminal if either of those variables is non-nil.
+
+If ALIST has a `previous-window' entry, the window specified by
+that entry will override any other window found by the methods
+above, even if that window never showed BUFFER before."
+ (let* ((alist-entry (assq 'reusable-frames alist))
+ (inhibit-same-window
+ (cdr (assq 'inhibit-same-window alist)))
+ (frames (cond
+ (alist-entry (cdr alist-entry))
+ ((if (eq pop-up-frames 'graphic-only)
+ (display-graphic-p)
+ pop-up-frames)
+ 0)
+ (display-buffer-reuse-frames 0)
+ (t (last-nonminibuffer-frame))))
+ entry best-window second-best-window window)
+ ;; Scan windows whether they have shown the buffer recently.
+ (catch 'best
+ (dolist (window (window-list-1 (frame-first-window) 'nomini frames))
+ (when (and (assq buffer (window-prev-buffers window))
+ (not (window-dedicated-p window)))
+ (if (eq window (selected-window))
+ (unless inhibit-same-window
+ (setq second-best-window window))
+ (setq best-window window)
+ (throw 'best t)))))
+ ;; When ALIST has a `previous-window' entry, that entry may override
+ ;; anything we found so far.
+ (when (and (setq window (cdr (assq 'previous-window alist)))
+ (window-live-p window)
+ (not (window-dedicated-p window)))
+ (if (eq window (selected-window))
+ (unless inhibit-same-window
+ (setq second-best-window window))
+ (setq best-window window)))
+ ;; Return best or second best window found.
+ (when (setq window (or best-window second-best-window))
+ (window--display-buffer buffer window 'reuse))))
+
(defun display-buffer-use-some-window (buffer alist)
"Display BUFFER in an existing window.
Search for a usable window, set that window to the buffer, and
@@ -5537,26 +5701,28 @@ buffer with the name BUFFER-OR-NAME and return that buffer."
(defun switch-to-buffer (buffer-or-name &optional norecord force-same-window)
"Switch to buffer BUFFER-OR-NAME in the selected window.
-If called interactively, prompt for the buffer name using the
+If the selected window cannot display the specified
+buffer (e.g. if it is a minibuffer window or strongly dedicated
+to another buffer), call `pop-to-buffer' to select the buffer in
+another window.
+
+If called interactively, read the buffer name using the
minibuffer. The variable `confirm-nonexistent-file-or-buffer'
determines whether to request confirmation before creating a new
buffer.
-BUFFER-OR-NAME may be a buffer, a string (a buffer name), or
-nil. If BUFFER-OR-NAME is a string that does not identify an
-existing buffer, create a buffer with that name. If
-BUFFER-OR-NAME is nil, switch to the buffer returned by
-`other-buffer'.
+BUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.
+If BUFFER-OR-NAME is a string that does not identify an existing
+buffer, create a buffer with that name. If BUFFER-OR-NAME is
+nil, switch to the buffer returned by `other-buffer'.
-Optional argument NORECORD non-nil means do not put the buffer
-specified by BUFFER-OR-NAME at the front of the buffer list and
-do not make the window displaying it the most recently selected
-one.
+If optional argument NORECORD is non-nil, do not put the buffer
+at the front of the buffer list, and do not make the window
+displaying it the most recently selected one.
-If FORCE-SAME-WINDOW is non-nil, BUFFER-OR-NAME must be displayed
-in the selected window; signal an error if that is
-impossible (e.g. if the selected window is minibuffer-only). If
-nil, BUFFER-OR-NAME may be displayed in another window.
+If optional argument FORCE-SAME-WINDOW is non-nil, the buffer
+must be displayed in the selected window; if that is impossible,
+signal an error rather than calling `pop-to-buffer'.
Return the buffer switched to."
(interactive
@@ -5710,7 +5876,7 @@ WINDOW must be a live window and defaults to the selected one."
window))))
;;; Resizing buffers to fit their contents exactly.
-(defun fit-window-to-buffer (&optional window max-height min-height override)
+(defun fit-window-to-buffer (&optional window max-height min-height)
"Adjust height of WINDOW to display its buffer's contents exactly.
WINDOW must be a live window and defaults to the selected one.
@@ -5721,10 +5887,6 @@ defaults to `window-min-height'. Both MAX-HEIGHT and MIN-HEIGHT
are specified in lines and include the mode line and header line,
if any.
-Optional argument OVERRIDE non-nil means override restrictions
-imposed by `window-min-height' and `window-min-width' on the size
-of WINDOW.
-
Return the number of lines by which WINDOW was enlarged or
shrunk. If an error occurs during resizing, return nil but don't
signal an error.
@@ -5733,28 +5895,27 @@ Note that even if this function makes WINDOW large enough to show
_all_ lines of its buffer you might not see the first lines when
WINDOW was scrolled."
(interactive)
- ;; Do all the work in WINDOW and its buffer and restore the selected
- ;; window and the current buffer when we're done.
(setq window (window-normalize-window window t))
;; Can't resize a full height or fixed-size window.
(unless (or (window-size-fixed-p window)
(window-full-height-p window))
- ;; `with-selected-window' should orderly restore the current buffer.
(with-selected-window window
- ;; We are in WINDOW's buffer now.
- (let* (;; Adjust MIN-HEIGHT.
+ (let* ((height (window-total-size))
(min-height
- (if override
- (window-min-size window nil window)
- (max (or min-height window-min-height)
- window-safe-min-height)))
- (max-window-height
- (window-total-size (frame-root-window window)))
- ;; Adjust MAX-HEIGHT.
+ ;; Adjust MIN-HEIGHT.
+ (if (numberp min-height)
+ ;; Can't get smaller than `window-safe-min-height'.
+ (max min-height window-safe-min-height)
+ ;; Preserve header and mode line if present.
+ (window-min-size nil nil t)))
(max-height
- (if (or override (not max-height))
- max-window-height
- (min max-height max-window-height)))
+ ;; Adjust MAX-HEIGHT.
+ (if (numberp max-height)
+ ;; Can't get larger than height of frame.
+ (min max-height
+ (window-total-size (frame-root-window window)))
+ ;, Don't delete other windows.
+ (+ height (window-max-delta nil nil window))))
;; Make `desired-height' the height necessary to show
;; all of WINDOW's buffer, constrained by MIN-HEIGHT
;; and MAX-HEIGHT.
@@ -5779,7 +5940,6 @@ WINDOW was scrolled."
(window-max-delta window nil window))
(max desired-delta
(- (window-min-delta window nil window))))))
- ;; This `condition-case' shouldn't be necessary, but who knows?
(condition-case nil
(if (zerop delta)
;; Return zero if DELTA became zero in the process.
@@ -5819,6 +5979,88 @@ WINDOW was scrolled."
(error (setq delta nil)))
delta))))
+(defcustom fit-frame-to-buffer-bottom-margin 4
+ "Bottom margin for `fit-frame-to-buffer'.
+This is the number of lines `fit-frame-to-buffer' leaves free at the
+bottom of the display in order to not obscure the system task bar."
+ :type 'integer
+ :version "24.2"
+ :group 'windows)
+
+(defun fit-frame-to-buffer (&optional frame max-height min-height)
+ "Adjust height of FRAME to display its buffer's contents exactly.
+FRAME can be any live frame and defaults to the selected one.
+
+Optional argument MAX-HEIGHT specifies the maximum height of
+FRAME and defaults to the height of the display below the current
+top line of FRAME minus FIT-FRAME-TO-BUFFER-BOTTOM-MARGIN.
+Optional argument MIN-HEIGHT specifies the minimum height of
+FRAME."
+ (interactive)
+ (setq frame (window-normalize-frame frame))
+ (let* ((root (frame-root-window frame))
+ (frame-min-height
+ (+ (- (frame-height frame) (window-total-size root))
+ window-min-height))
+ (frame-top (frame-parameter frame 'top))
+ (top (if (consp frame-top)
+ (funcall (car frame-top) (cadr frame-top))
+ frame-top))
+ (frame-max-height
+ (- (/ (- (x-display-pixel-height frame) top)
+ (frame-char-height frame))
+ fit-frame-to-buffer-bottom-margin))
+ (compensate 0)
+ delta)
+ (when (and (window-live-p root) (not (window-size-fixed-p root)))
+ (with-selected-window root
+ (cond
+ ((not max-height)
+ (setq max-height frame-max-height))
+ ((numberp max-height)
+ (setq max-height (min max-height frame-max-height)))
+ (t
+ (error "%s is an invalid maximum height" max-height)))
+ (cond
+ ((not min-height)
+ (setq min-height frame-min-height))
+ ((numberp min-height)
+ (setq min-height (min min-height frame-min-height)))
+ (t
+ (error "%s is an invalid minimum height" min-height)))
+ ;; When tool-bar-mode is enabled and we have just created a new
+ ;; frame, reserve lines for toolbar resizing. This is needed
+ ;; because for reasons unknown to me Emacs (1) reserves one line
+ ;; for the toolbar when making the initial frame and toolbars
+ ;; are enabled, and (2) later adds the remaining lines needed.
+ ;; Our code runs IN BETWEEN (1) and (2). YMMV when you're on a
+ ;; system that behaves differently.
+ (let ((quit-restore (window-parameter root 'quit-restore))
+ (lines (tool-bar-lines-needed frame)))
+ (when (and quit-restore (eq (car quit-restore) 'frame)
+ (not (zerop lines)))
+ (setq compensate (1- lines))))
+ (message "%s" compensate)
+ (setq delta
+ ;; Always count a final newline - we don't do any
+ ;; post-processing, so let's play safe.
+ (+ (count-screen-lines nil nil t)
+ (- (window-body-size))
+ compensate)))
+ ;; Move away from final newline.
+ (when (and (eobp) (bolp) (not (bobp)))
+ (set-window-point root (line-beginning-position 0)))
+ (set-window-start root (point-min))
+ (set-window-vscroll root 0)
+ (condition-case nil
+ (set-frame-height
+ frame
+ (min (max (+ (frame-height frame) delta)
+ min-height)
+ max-height))
+ (error (setq delta nil))))
+ delta))
+
(defun window-safely-shrinkable-p (&optional window)
"Return t if WINDOW can be shrunk without shrinking other windows.
WINDOW defaults to the selected window."
@@ -6062,7 +6304,7 @@ This is different from `scroll-down-command' that scrolls a full screen."
(put 'scroll-down-line 'scroll-command t)
-(defun scroll-other-window-down (lines)
+(defun scroll-other-window-down (&optional lines)
"Scroll the \"other window\" down.
For more details, see the documentation for `scroll-other-window'."
(interactive "P")
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 864fc85198..2760efb3f2 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -81,95 +81,118 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
gl_manywarn_set=
for gl_manywarn_item in \
- -Wall \
-W \
- -Wformat-y2k \
- -Wformat-nonliteral \
- -Wformat-security \
- -Winit-self \
- -Wmissing-include-dirs \
- -Wswitch-default \
- -Wswitch-enum \
- -Wunused \
- -Wunknown-pragmas \
- -Wstrict-aliasing \
- -Wstrict-overflow \
- -Wsystem-headers \
- -Wfloat-equal \
- -Wtraditional \
- -Wtraditional-conversion \
- -Wdeclaration-after-statement \
- -Wundef \
- -Wshadow \
- -Wunsafe-loop-optimizations \
- -Wpointer-arith \
+ -Wabi \
+ -Waddress \
+ -Wall \
+ -Warray-bounds \
+ -Wattributes \
-Wbad-function-cast \
- -Wc++-compat \
- -Wcast-qual \
- -Wcast-align \
- -Wwrite-strings \
- -Wconversion \
- -Wsign-conversion \
- -Wlogical-op \
- -Waggregate-return \
- -Wstrict-prototypes \
- -Wold-style-definition \
- -Wmissing-prototypes \
- -Wmissing-declarations \
- -Wmissing-noreturn \
- -Wmissing-format-attribute \
- -Wpacked \
- -Wpadded \
- -Wredundant-decls \
- -Wnested-externs \
- -Wunreachable-code \
- -Winline \
- -Winvalid-pch \
- -Wlong-long \
- -Wvla \
- -Wvolatile-register-var \
- -Wdisabled-optimization \
- -Wstack-protector \
- -Woverlength-strings \
-Wbuiltin-macro-redefined \
- -Wmudflap \
- -Wpacked-bitfield-compat \
- -Wsync-nand \
- ; do
- gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
- done
- # The following are not documented in the manual but are included in
- # output from gcc --help=warnings.
- for gl_manywarn_item in \
- -Wattributes \
+ -Wcast-align \
+ -Wchar-subscripts \
+ -Wclobbered \
+ -Wcomment \
+ -Wcomments \
-Wcoverage-mismatch \
- -Wunused-macros \
- ; do
- gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
- done
- # More warnings from gcc 4.6.2 --help=warnings.
- for gl_manywarn_item in \
- -Wabi \
-Wcpp \
-Wdeprecated \
-Wdeprecated-declarations \
+ -Wdisabled-optimization \
-Wdiv-by-zero \
-Wdouble-promotion \
+ -Wempty-body \
-Wendif-labels \
+ -Wenum-compare \
-Wextra \
-Wformat-contains-nul \
-Wformat-extra-args \
+ -Wformat-nonliteral \
+ -Wformat-security \
+ -Wformat-y2k \
-Wformat-zero-length \
-Wformat=2 \
+ -Wfree-nonheap-object \
+ -Wignored-qualifiers \
+ -Wimplicit \
+ -Wimplicit-function-declaration \
+ -Wimplicit-int \
+ -Winit-self \
+ -Winline \
+ -Wint-to-pointer-cast \
+ -Winvalid-memory-model \
+ -Winvalid-pch \
+ -Wjump-misses-init \
+ -Wlogical-op \
+ -Wmain \
+ -Wmaybe-uninitialized \
+ -Wmissing-braces \
+ -Wmissing-declarations \
+ -Wmissing-field-initializers \
+ -Wmissing-format-attribute \
+ -Wmissing-include-dirs \
+ -Wmissing-noreturn \
+ -Wmissing-parameter-type \
+ -Wmissing-prototypes \
+ -Wmudflap \
-Wmultichar \
+ -Wnarrowing \
+ -Wnested-externs \
+ -Wnonnull \
-Wnormalized=nfc \
+ -Wold-style-declaration \
+ -Wold-style-definition \
-Woverflow \
+ -Woverlength-strings \
+ -Woverride-init \
+ -Wpacked \
+ -Wpacked-bitfield-compat \
+ -Wparentheses \
+ -Wpointer-arith \
+ -Wpointer-sign \
-Wpointer-to-int-cast \
-Wpragmas \
+ -Wreturn-type \
+ -Wsequence-point \
+ -Wshadow \
+ -Wsizeof-pointer-memaccess \
+ -Wstack-protector \
+ -Wstrict-aliasing \
+ -Wstrict-overflow \
+ -Wstrict-prototypes \
-Wsuggest-attribute=const \
+ -Wsuggest-attribute=format \
-Wsuggest-attribute=noreturn \
-Wsuggest-attribute=pure \
+ -Wswitch \
+ -Wswitch-default \
+ -Wsync-nand \
+ -Wsystem-headers \
-Wtrampolines \
+ -Wtrigraphs \
+ -Wtype-limits \
+ -Wuninitialized \
+ -Wunknown-pragmas \
+ -Wunreachable-code \
+ -Wunsafe-loop-optimizations \
+ -Wunused \
+ -Wunused-but-set-parameter \
+ -Wunused-but-set-variable \
+ -Wunused-function \
+ -Wunused-label \
+ -Wunused-local-typedefs \
+ -Wunused-macros \
+ -Wunused-parameter \
+ -Wunused-result \
+ -Wunused-value \
+ -Wunused-variable \
+ -Wvarargs \
+ -Wvariadic-macros \
+ -Wvector-operation-performance \
+ -Wvla \
+ -Wvolatile-register-var \
+ -Wwrite-strings \
+ \
; do
gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
done
diff --git a/make-dist b/make-dist
index b157d9a54d..3b2d79e56b 100755
--- a/make-dist
+++ b/make-dist
@@ -273,7 +273,7 @@ mkdir ${tempdir}
### README while the rest of the tar file is still unpacking. Whoopee.
echo "Making links to top-level files"
ln INSTALL README BUGS ${tempdir}
-ln ChangeLog Makefile.in configure configure.ac ${tempdir}
+ln ChangeLog Makefile.in autogen.sh configure configure.ac ${tempdir}
ln config.bat make-dist .dir-locals.el ${tempdir}
ln aclocal.m4 ${tempdir}
@@ -287,10 +287,10 @@ for subdir in site-lisp \
`find etc lisp admin -type d` \
doc doc/emacs doc/misc doc/man doc/lispref doc/lispintro \
info m4 msdos \
- nextstep nextstep/Cocoa nextstep/Cocoa/Emacs.base \
+ nextstep nextstep/templates \
+ nextstep/Cocoa nextstep/Cocoa/Emacs.base \
nextstep/Cocoa/Emacs.base/Contents \
nextstep/Cocoa/Emacs.base/Contents/Resources \
- nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj \
nextstep/GNUstep \
nextstep/GNUstep/Emacs.base \
nextstep/GNUstep/Emacs.base/Resources
@@ -404,23 +404,23 @@ echo "Making links to \`msdos'"
echo "Making links to \`nextstep'"
(cd nextstep
- ln ChangeLog README INSTALL ../${tempdir}/nextstep)
+ ln ChangeLog README INSTALL Makefile.in ../${tempdir}/nextstep)
+
+echo "Making links to \`nextstep/templates'"
+(cd nextstep/templates
+ ln Emacs.desktop.in Info-gnustep.plist.in Info.plist.in InfoPlist.strings.in../../${tempdir}/nextstep/templates)
echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents'"
(cd nextstep/Cocoa/Emacs.base/Contents
- ln Info.plist PkgInfo ../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents)
+ ln PkgInfo ../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents)
echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources'"
(cd nextstep/Cocoa/Emacs.base/Contents/Resources
ln Credits.html *.icns ../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources)
-echo "Making links to \`nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj'"
-(cd nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj
- ln InfoPlist.strings ../../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj)
-
echo "Making links to \`nextstep/GNUstep/Emacs.base/Resources'"
(cd nextstep/GNUstep/Emacs.base/Resources
- ln Emacs.desktop Info-gnustep.plist README emacs.tiff ../../../../${tempdir}/nextstep/GNUstep/Emacs.base/Resources )
+ ln README emacs.tiff ../../../../${tempdir}/nextstep/GNUstep/Emacs.base/Resources )
echo "Making links to \`oldXMenu'"
(cd oldXMenu
diff --git a/nextstep/ChangeLog b/nextstep/ChangeLog
index 6451f7a732..53f42c9771 100644
--- a/nextstep/ChangeLog
+++ b/nextstep/ChangeLog
@@ -1,3 +1,22 @@
+2012-09-17 Glenn Morris <[email protected]>
+
+ * templates/Info-gnustep.plist.in, templates/InfoPlist.strings.in:
+ * templates/Info.plist.in: Let configure set copyright.
+
+2012-09-16 Glenn Morris <[email protected]>
+
+ * Makefile.in: New file.
+ * templates: New directory.
+ * templates/Emacs.desktop.in, templates/Info-gnustep.plist.in:
+ * templates/Info.plist.in, templates/InfoPlist.strings.in:
+ Move here from various Cocoa/, GNUstep/ locations.
+ Let configure set the version number.
+ * Cocoa/Emacs.base/Contents/Info.plist:
+ * Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:
+ * GNUstep/Emacs.base/Resources/Info-gnustep.plist:
+ * GNUstep/Emacs.base/Resources/Emacs.desktop: Move to templates/.
+ * Cocoa/Emacs.base/Contents/Resources/English.lproj: Remove directory.
+
2012-04-07 Glenn Morris <[email protected]>
* Cocoa/Emacs.base/Contents/Info.plist:
diff --git a/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings b/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings
deleted file mode 100644
index 7655c0ca8e..0000000000
--- a/nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings
+++ /dev/null
@@ -1,6 +0,0 @@
-/* Localized versions of Info.plist keys */
-
-CFBundleName = "Emacs";
-CFBundleShortVersionString = "Version 24.2.50";
-CFBundleGetInfoString = "Emacs version 24.2.50, NS Windowing";
-NSHumanReadableCopyright = "Copyright (C) 2012 Free Software Foundation, Inc.";
diff --git a/nextstep/Makefile.in b/nextstep/Makefile.in
new file mode 100644
index 0000000000..27ec5d1556
--- /dev/null
+++ b/nextstep/Makefile.in
@@ -0,0 +1,67 @@
+### nextstep/Makefile for GNU Emacs
+
+## Copyright (C) 2012 Free Software Foundation, Inc.
+
+## This file is part of GNU Emacs.
+
+## GNU Emacs is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## GNU Emacs is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+### Commentary:
+
+### Code:
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+EXEEXT = @EXEEXT@
+
+@SET_MAKE@
+MKDIR_P = @MKDIR_P@
+
+ns_appdir = @ns_appdir@
+ns_appbindir = @ns_appbindir@
+ns_appsrc = @ns_appsrc@
+
+${ns_appdir}: ${srcdir}/${ns_appsrc} ${ns_appsrc}
+ rm -rf ${ns_appdir}
+ ${MKDIR_P} ${ns_appdir}
+ ( cd ${srcdir}/${ns_appsrc} ; tar cfh - . ) | \
+ ( cd ${ns_appdir} ; umask 022; tar xf - )
+ [ `cd ${srcdir} && /bin/pwd` = `/bin/pwd` ] || \
+ ( cd ${ns_appsrc} ; tar cfh - . ) | \
+ ( cd ${ns_appdir} ; umask 022; tar xf - )
+
+${ns_appbindir}/Emacs: ${ns_appdir} ../src/emacs${EXEEXT}
+ ${MKDIR_P} ${ns_appbindir}
+ cp -f ../src/emacs${EXEEXT} ${ns_appbindir}/Emacs
+
+.PHONY: all
+
+all: ${ns_appdir} ${ns_appbindir}/Emacs
+
+
+.PHONY: clean distclean maintainer-clean
+
+clean:
+ rm -rf ${ns_appdir}
+
+distclean: clean
+ rm -f Makefile
+ rm -f GNUstep/Emacs.base/Resources/Info-gnustep.plist \
+ GNUstep/Emacs.base/Resources/Emacs.desktop \
+ Cocoa/Emacs.base/Contents/Info.plist \
+ Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings
+
+maintainer-clean: distclean
+
+### Makefile.in ends here
diff --git a/nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop b/nextstep/templates/Emacs.desktop.in
index a36eafaadb..170f195f27 100644
--- a/nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop
+++ b/nextstep/templates/Emacs.desktop.in
@@ -1,7 +1,7 @@
[Desktop Entry]
Encoding=UTF-8
Type=Application
-Version=24.2.50
+Version=@version@
Categories=GNUstep
Name=Emacs
Comment=GNU Emacs for NeXT/Open/GNUstep and OS X
diff --git a/nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist b/nextstep/templates/Info-gnustep.plist.in
index 6cde01b0d0..4ac97e5cde 100644
--- a/nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist
+++ b/nextstep/templates/Info-gnustep.plist.in
@@ -2,7 +2,7 @@
ApplicationDescription = "GNU Emacs for GNUstep / OS X";
ApplicationIcon = emacs.tiff;
ApplicationName = Emacs;
- ApplicationRelease = "24.2.50";
+ ApplicationRelease = "@version@";
Authors = (
"Adrian Robert (GNUstep)",
"Christophe de Dinechin (MacOS X)",
@@ -11,9 +11,9 @@
"Carl Edman (NeXTstep)",
"..see etc/NEXTSTEP"
);
- Copyright = "Copyright (C) 2012 Free Software Foundation, Inc.";
+ Copyright = "@copyright@";
CopyrightDescription = "Released under the GNU General Public License Version 3 or later";
- FullVersionID = "Emacs 24.2.50, NS Windowing";
+ FullVersionID = "Emacs @version@, NS Windowing";
NSExecutable = Emacs;
NSIcon = emacs.tiff;
NSPrincipalClass = NSApplication;
diff --git a/nextstep/Cocoa/Emacs.base/Contents/Info.plist b/nextstep/templates/Info.plist.in
index f5490f613f..25c73916e5 100644
--- a/nextstep/Cocoa/Emacs.base/Contents/Info.plist
+++ b/nextstep/templates/Info.plist.in
@@ -553,7 +553,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
<key>CFBundleExecutable</key>
<string>Emacs</string>
<key>CFBundleGetInfoString</key>
- <string>Emacs 24.2.50 Copyright (C) 2012 Free Software Foundation, Inc.</string>
+ <string>Emacs @version@ @copyright@</string>
<key>CFBundleIconFile</key>
<string>Emacs.icns</string>
<key>CFBundleIdentifier</key>
@@ -566,7 +566,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
<string>APPL</string>
<!-- This should be the emacs version number. -->
<key>CFBundleShortVersionString</key>
- <string>24.2.50</string>
+ <string>@version@</string>
<key>CFBundleSignature</key>
<string>EMAx</string>
<!-- This SHOULD be a build number. -->
diff --git a/nextstep/templates/InfoPlist.strings.in b/nextstep/templates/InfoPlist.strings.in
new file mode 100644
index 0000000000..f38d892501
--- /dev/null
+++ b/nextstep/templates/InfoPlist.strings.in
@@ -0,0 +1,6 @@
+/* Localized versions of Info.plist keys */
+
+CFBundleName = "Emacs";
+CFBundleShortVersionString = "Version @version@";
+CFBundleGetInfoString = "Emacs version @version@, NS Windowing";
+NSHumanReadableCopyright = "@copyright@";
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 4ceb74ed0b..f2a5281d1f 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,50 @@
+2012-09-17 Glenn Morris <[email protected]>
+
+ * config.nt (COPYRIGHT): New.
+
+2012-09-15 Paul Eggert <[email protected]>
+
+ Port _setjmp fix to POSIXish hosts as well as Microsoft.
+ * config.nt: Attempt to sync with autogen/config.in.
+ (HAVE_SIGSETJMP, HAVE__SETJMP): New macros.
+ (_longjmp, _setjmp): Remove.
+
+2012-09-14 Juanma Barranquero <[email protected]>
+
+ * config.nt: Sync with autogen/config.in.
+ (BROKEN_FIONREAD, BROKEN_SIGAIO, BROKEN_SIGIO, BROKEN_SIGPOLL)
+ (BROKEN_SIGPTY, HAVE_CBRT, HAVE_LOGB, NO_TERMIO): Remove.
+ (USABLE_FIONREAD, USABLE_SIGIO): New macros.
+
+2012-09-10 Juanma Barranquero <[email protected]>
+
+ * config.nt: Sync with autogen/config.in.
+ (FLOAT_CHECK_DOMAIN, HAVE_FMOD, HAVE_FREXP)
+ (HAVE_INVERSE_HYPERBOLIC, NO_MATHERR): Remove.
+
+2012-09-08 Eli Zaretskii <[email protected]>
+
+ * configure.bat <use_extensions>: Don't leave it set in the
+ environment when the script exits.
+
+2012-09-07 Juanma Barranquero <[email protected]>
+
+ * config.nt: Sync with autogen/config.in.
+ (NO_ABORT, SIGNAL_H_AHB): Remove.
+
+2012-09-07 Eli Zaretskii <[email protected]>
+
+ * inc/ms-w32.h (struct sigaction): Declare sa_handler __cdecl.
+
+2012-09-05 Juanma Barranquero <[email protected]>
+
+ * config.nt: Sync with autogen/config.in.
+
+2012-09-04 Paul Eggert <[email protected]>
+
+ Simplify redefinition of 'abort' (Bug#12316).
+ * inc/ms-w32.h (w32_abort) [HAVE_NTGUI]: Remove.
+
2012-09-02 Juanma Barranquero <[email protected]>
* config.nt: Sync with autogen/config.in.
diff --git a/nt/config.nt b/nt/config.nt
index 7658275f2d..96217a8c58 100644
--- a/nt/config.nt
+++ b/nt/config.nt
@@ -54,9 +54,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to the number of bits in type 'wint_t'. */
#undef BITSIZEOF_WINT_T
-/* Define if FIONREAD should not be used. */
-#undef BROKEN_FIONREAD
-
/* Define if getwd should not be used. */
#undef BROKEN_GETWD
@@ -69,18 +66,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define if SA_RESTART should only be used in batch mode. */
#undef BROKEN_SA_RESTART
-/* Define if SIGAIO should not be used. */
-#undef BROKEN_SIGAIO
-
-/* Define if SIGIO should not be used. */
-#undef BROKEN_SIGIO
-
-/* Define if SIGPOLL should not be used. */
-#undef BROKEN_SIGPOLL
-
-/* Define if SIGPTY should not be used. */
-#undef BROKEN_SIGPTY
-
/* Define if the system is compatible with BSD 4.2. */
#undef BSD4_2
@@ -101,6 +86,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
his/her Emacs. */
#undef CLASH_DETECTION
+/* Short copyright string for this version of Emacs. */
+#define COPYRIGHT "Copyright (C) 2012 Free Software Foundation, Inc."
+
/* 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.
*/
@@ -161,9 +149,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
*/
#define FIRST_PTY_LETTER 'a'
-/* Define if the float library doesn't handle errors by either setting errno,
- or signaling SIGFPE/SIGILL. */
-#undef FLOAT_CHECK_DOMAIN
+/* Enable compile-time and run-time bounds-checking, and some warnings,
+ without upsetting glibc 2.15+. */
+ #if defined __OPTIMIZE__ && __OPTIMIZE__
+ # define _FORTIFY_SOURCE 2
+ #endif
+
/* Define to 1 if futimesat mishandles a NULL file name. */
#undef FUTIMESAT_NULL_BUG
@@ -249,9 +240,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if strtold conforms to C99. */
#undef HAVE_C99_STRTOLD
-/* Define to 1 if you have the `cbrt' function. */
-#undef HAVE_CBRT
-
/* Define to 1 if you have the `cfmakeraw' function. */
#undef HAVE_CFMAKERAW
@@ -370,9 +358,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
-/* Define to 1 if you have the `fmod' function. */
-#define HAVE_FMOD 1
-
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
@@ -385,9 +370,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if using the freetype and fontconfig libraries. */
#undef HAVE_FREETYPE
-/* Define to 1 if you have the `frexp' function. */
-#define HAVE_FREXP 1
-
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
@@ -542,9 +524,6 @@ 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 if you have the functions acosh, asinh, and atanh. */
-#undef HAVE_INVERSE_HYPERBOLIC
-
/* Define to 1 if you have the jpeg library (-ljpeg). */
#undef HAVE_JPEG
@@ -653,9 +632,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
-/* Define to 1 if you have the `logb' function. */
-#define HAVE_LOGB 1
-
/* Define to 1 if you support file names longer than 14 characters. */
#define HAVE_LONG_FILE_NAMES 1
@@ -827,6 +803,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if 'wint_t' is a signed integer type. */
#undef HAVE_SIGNED_WINT_T
+/* Define to 1 if sigsetjmp and siglongjmp work. The value of this symbol is
+ irrelevant if HAVE__SETJMP is defined. */
+#undef HAVE_SIGSETJMP
+
/* Define to 1 if the system has the type `sigset_t'. */
#undef HAVE_SIGSET_T
@@ -1111,6 +1091,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the `_ftime' function. */
#undef HAVE__FTIME
+/* Define to 1 if _setjmp and _longjmp work. */
+#define HAVE__SETJMP 1
+
/* Define to 1 if you have the `__builtin_unwind_init' function. */
#undef HAVE___BUILTIN_UNWIND_INIT
@@ -1182,21 +1165,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
`NO'. */
#undef NARROWPROTO
-/* Do not define abort in emacs.c. */
-#undef NO_ABORT
-
/* Define if XEditRes should not be used. */
#undef NO_EDITRES
-/* Define to 1 if you don't have struct exception in math.h. */
-#define NO_MATHERR 1
-
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
-/* Define if termio.h should not be included. */
-#undef NO_TERMIO
-
/* Minimum value of NSIG. */
#undef NSIG_MINIMUM
@@ -1306,9 +1280,6 @@ 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. */
#undef SIGNALS_VIA_CHARACTERS
-/* Define if AH_BOTTOM should include signal.h. */
-#undef SIGNAL_H_AHB
-
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
'sig_atomic_t'. */
#undef SIG_ATOMIC_T_SUFFIX
@@ -1384,6 +1355,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define if the system has Unix98 PTYs. */
#undef UNIX98_PTYS
+/* Define to 1 if FIONREAD is usable. */
+#define USABLE_FIONREAD 1
+
+/* Define to 1 if SIGIO is usable. */
+#undef USABLE_SIGIO
+
/* How to get a user's full name. */
#define USER_FULL_NAME pw->pw_gecos
@@ -1468,9 +1445,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
-/* enable compile-time and run-time bounds-checking, and some warnings */
-#undef _FORTIFY_SOURCE
-
/* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct
stat.st_size becomes 64-bit. */
#undef _GL_WINDOWS_64_BIT_ST_SIZE
@@ -1547,12 +1521,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
declarations. Define as empty for no equivalent. */
#undef __restrict_arr
-/* Some platforms redefine this. */
-#undef _longjmp
-
-/* Some platforms redefine this. */
-#undef _setjmp
-
/* Some platforms that do not use configure define this to include extra
configuration information. */
#define config_opsysfile <ms-w32.h>
diff --git a/nt/configure.bat b/nt/configure.bat
index 56793a0d1c..5890b12d02 100755
--- a/nt/configure.bat
+++ b/nt/configure.bat
@@ -949,4 +949,6 @@ set HAVE_PNG=
set HAVE_TIFF=
set HAVE_XPM=
set dbginfo=
+endlocal
+set use_extensions=
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 8945fb7be4..22255843f1 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -127,7 +127,7 @@ typedef int ssize_t;
struct sigaction {
int sa_flags;
- void (*sa_handler)(int);
+ void (_CALLBACK_ *sa_handler)(int);
sigset_t sa_mask;
};
#define SIG_BLOCK 1
@@ -334,16 +334,7 @@ extern char *get_emacs_configuration_options (void);
#include <malloc.h>
#endif
-/* stdlib.h must be included after redefining malloc & friends, but
- before redefining abort. Isn't library redefinition funny? */
#include <stdlib.h>
-
-/* Redefine abort. */
-#ifdef HAVE_NTGUI
-#define abort w32_abort
-extern _Noreturn void w32_abort (void);
-#endif
-
#include <sys/stat.h>
/* Define for those source files that do not include enough NT system files. */
diff --git a/nt/inc/unistd.h b/nt/inc/unistd.h
index fb1f1c4b3b..7db6cf08be 100644
--- a/nt/inc/unistd.h
+++ b/nt/inc/unistd.h
@@ -3,8 +3,12 @@
#ifndef _UNISTD_H
#define _UNISTD_H
+/* On Microsoft platforms, <stdlib.h> declares 'environ'; on POSIX
+ platforms, <unistd.h> does. Every file in Emacs that includes
+ <unistd.h> also includes <stdlib.h>, so there's no need to declare
+ 'environ' here. */
+
extern ssize_t readlink (const char *, char *, size_t);
extern int symlink (char const *, char const *);
#endif /* _UNISTD_H */
-
diff --git a/src/.gdbinit b/src/.gdbinit
index de980c6345..79419f66ac 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1222,14 +1222,9 @@ if ($ptr != 0)
set $tem = (struct Lisp_String *) $ptr
set $tem = (char *) $tem->data
- # Don't let abort actually run, as it will make stdio stop working and
- # therefore the `pr' command above as well.
- if $tem[0] == 'w' && $tem[1] == 'i' && $tem[2] == 'n' && $tem[3] == 'd'
- # The windows-nt build replaces abort with its own function.
- break w32_abort
- else
- break abort
- end
+ # Don't let emacs_abort actually run, as it will make stdio stop
+ # working and therefore the 'pr' command above as well.
+ break emacs_abort
end
# x_error_quitter is defined only on X. But window-system is set up
diff --git a/src/ChangeLog b/src/ChangeLog
index 2ea13df126..36df05c25a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,901 @@
+2012-09-17 Eli Zaretskii <[email protected]>
+
+ * w32term.c (w32_read_socket): Set pending_signals to 1, like
+ xterm.c does. Reported by Daniel Colascione <[email protected]>.
+
+ * ralloc.c (r_alloc_init) [!SYSTEM_MALLOC]: Initialize
+ __malloc_extra_blocks to 32 instead of 64, like alloc.c did in
+ emacs_blocked_malloc, now deleted.
+
+2012-09-17 Paul Eggert <[email protected]>
+
+ Remove no-longer-needed Solaris 2.4 vfork bug workaround.
+ The workaround was for improving performance on Solaris 2.4, but
+ is getting in the way now. Emacs will still work if someone is
+ still running Solaris 2.4 in a museum somewhere; Sun dropped
+ support for Solaris 2.4 in 2003.
+ * callproc.c (Fcall_process) [HAVE_WORKING_VFORK]:
+ * process.c (create_process) [HAVE_WORKING_VFORK]:
+ Omit now-unnecessary workaround for the Solaris 2.4 vfork bug,
+ since Emacs no longer uses vfork on that platform.
+
+2012-09-17 Glenn Morris <[email protected]>
+
+ * emacs.c: Use COPYRIGHT.
+
+2012-09-16 Paul Eggert <[email protected]>
+
+ Remove configure's --without-sync-input option (Bug#12450).
+ When auditing signal-handling in preparation for cleaning it up,
+ I found that SYNC_INPUT has race conditions and would be a real
+ pain to fix. Since it's an undocumented and deprecated
+ configure-time option, now seems like a good time to remove it.
+ Also see <http://bugs.gnu.org/11080#16>.
+ * alloc.c (_bytes_used, __malloc_extra_blocks, _malloc_internal)
+ (_free_internal) [!DOUG_LEA_MALLOC]: Remove decls.
+ (alloc_mutex) [!SYSTEM_MALLOC && !SYNC_INPUT && HAVE_PTHREAD]:
+ (malloc_hysteresis):
+ (check_depth) [XMALLOC_OVERRUN_CHECK]:
+ (MALLOC_BLOCK_INPUT, MALLOC_UNBLOCK_INPUT):
+ (__malloc_hook, __realloc_hook, __free_hook, BYTES_USED)
+ (dont_register_blocks, bytes_used_when_reconsidered)
+ (bytes_used_when_full, emacs_blocked_free, emacs_blocked_malloc)
+ (emacs_blocked_realloc, reset_malloc_hooks, uninterrupt_malloc):
+ [!SYSTEM_MALLOC && !SYNC_INPUT]:
+ Remove. All uses removed.
+ (MALLOC_BLOCK_INPUT, MALLOC_UNBLOCK_INPUT): Use a different
+ implementation, one that depends on whether the new macro
+ XMALLOC_BLOCK_INPUT_CHECK is defined, not on whether SYNC_INPUT
+ is defined.
+ * atimer.c (run_timers, handle_alarm_signal):
+ * keyboard.c (pending_signal, poll_for_input_1, poll_for_input)
+ (handle_async_input, process_pending_signals)
+ (handle_input_available_signal, init_keyboard):
+ * nsterm.m (ns_read_socket):
+ * process.c (wait_reading_process_output):
+ * regex.c (immediate_quit, IMMEDIATE_QUIT_CHECK):
+ * sysdep.c (emacs_sigaction_init) [SA_RESTART]:
+ (emacs_write):
+ * xterm.c (XTread_socket):
+ Assume SYNC_INPUT.
+ * conf_post.h (SA_RESTART) [IRIX6_5]: Do not #undef.
+ * eval.c (handling_signal): Remove. All uses removed.
+ * lisp.h (ELSE_PENDING_SIGNALS): Remove.
+ All uses replaced with the SYNC_INPUT version.
+ (reset_malloc_hooks, uninterrupt_malloc, handling_signal):
+ Remove decls.
+ * sysdep.c, syssignal.h (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
+ Now static.
+
+ * font.c (Ffont_shape_gstring): Remove unused local.
+
+2012-09-16 Glenn Morris <[email protected]>
+
+ * Makefile.in (clean): No longer run nextstep's clean.
+
+ * Makefile.in (ns_appdir, ns_appbindir, ns_appsrc): Remove variables.
+ (ns_frag): Remove.
+ (ns-app): Move here from ns.mk, and simplify.
+ (clean): Simplify nextstep entry.
+ * ns.mk: Remove file.
+
+2012-09-16 Kenichi Handa <[email protected]>
+
+ * font.c (Ffont_shape_gstring): Fix previous change; GLYPHs may
+ not covert the last few charactes.
+
+2012-09-16 Kenichi Handa <[email protected]>
+
+ * font.c (Ffont_shape_gstring): Don't adjust grapheme cluster
+ here, but just check the validity of glyphs in the glyph-string.
+
+2012-09-16 Martin Rudalics <[email protected]>
+
+ * window.c (Fwindow_parameter, Fset_window_parameter): Accept
+ any window as argument (Bug#12452).
+
+2012-09-16 Jan Djärv <[email protected]>
+
+ * nsfns.m (Fx_open_connection): Move initialization of ns_*_types
+ to ns_term_init to avoid memory leak.
+
+ * nsterm.m (ns_update_begin): Initialize bp after lcokFocus, use
+ explicit retain/release.
+ (ns_term_init): Only allow one display. Initialize outerpool and
+ ns_*_types.
+
+2012-09-15 Paul Eggert <[email protected]>
+
+ Port _setjmp fix to POSIXish hosts as well as Microsoft.
+ * image.c (_setjmp) [!HAVE__SETJMP]: Restore definition, as
+ it's needed on POSIXish hosts that lack _setjmp. Attempt to solve
+ the Microsoft problem in a different way, by altering ../nt/config.nt.
+
+2012-09-15 Eli Zaretskii <[email protected]>
+
+ * w32xfns.c:
+ * w32uniscribe.c:
+ * w32term.c:
+ * w32select.c:
+ * w32reg.c:
+ * w32proc.c:
+ * w32menu.c:
+ * w32inevt.c:
+ * w32heap.c:
+ * w32font.c:
+ * w32fns.c:
+ * w32console.c:
+ * w32.c:
+ * w16select.c: Remove inclusion of setjmp.h, as it is now included
+ by lisp.h. This completes removal of setjmp.h inclusion
+ erroneously announced in the previous commit. (Bug#12446)
+
+ * lisp.h [!HAVE__SETJMP, !HAVE_SIGSETJMP]: Make the commentary
+ more accurate.
+
+ * image.c (_setjmp) [!HAVE__SETJMP]: Define only if 'setjmp' is
+ not defined as a macro. The latter happens on MS-Windows.
+ (Bug#12446)
+
+2012-09-15 Paul Eggert <[email protected]>
+
+ Port better to POSIX hosts lacking _setjmp (Bug#12446).
+ * lisp.h: Include <setjmp.h> here, since we use its symbols here.
+ Some instances of '#include <setjmp.h>' removed, if the
+ only reason for the instance was because "lisp.h" was included.
+ (sys_jmp_buf, sys_setjmp, sys_longjmp): New symbols.
+ Unless otherwise specified, replace all uses of jmp_buf, _setjmp,
+ and _longjmp with the new symbols. Emacs already uses _setjmp if
+ available, so this change affects only POSIXish hosts that have
+ sigsetjmp but not _setjmp, such as some versions of Solaris and
+ Unixware. (Also, POSIX-2008 marks _setjmp as obsolescent.)
+ * image.c (_setjmp, _longjmp) [HAVE_PNG && !HAVE__SETJMP]: New macros.
+ (png_load_body) [HAVE_PNG]:
+ (PNG_LONGJMP) [HAVE_PNG && PNG_LIBPNG_VER < 10500]:
+ (PNG_JMPBUF) [HAVE_PNG && PNG_LIBPNG_VER >= 10500]:
+ Use _setjmp and _longjmp rather than sys_setjmp and sys_longjmp,
+ since PNG requires jmp_buf. This is the only exception to the
+ general rule that we now use sys_setjmp and sys_longjmp.
+ This exception is OK since this code does not change the signal
+ mask or longjmp out of a signal handler.
+
+2012-09-14 Paul Eggert <[email protected]>
+
+ * alloc.c [!SYSTEM_MALLOC && !SYNC_INPUT && HAVE_PTHREAD]:
+ Include "syssignal.h", for 'main_thread'.
+
+2012-09-14 Dmitry Antipov <[email protected]>
+
+ Avoid out-of-range marker position (Bug#12426).
+ * insdel.c (replace_range, replace_range_2): Adjust
+ markers before overlays, as suggested by comments.
+ (insert_1_both, insert_from_buffer_1, adjust_after_replace):
+ Remove redundant check before calling offset_intervals.
+
+2012-09-14 Martin Rudalics <[email protected]>
+
+ * xdisp.c (Fformat_mode_line): Unconditionally save/restore
+ current buffer (Bug#12387).
+
+2012-09-14 Juanma Barranquero <[email protected]>
+
+ * makefile.w32-in ($(BLD)/alloc.$(O)): Update dependencies.
+
+2012-09-13 Paul Eggert <[email protected]>
+
+ Use a more backwards-compatible timer format (Bug#12430).
+ * keyboard.c (decode_timer): Get PSECS from the 8th (origin-0)
+ vector element, not from the 4th, since PSECS is now at the end.
+ (Fcurrent_idle_time): Doc fix.
+
+2012-09-13 Dmitry Antipov <[email protected]>
+
+ Function to mark objects and remove killed buffers at once.
+ * alloc.c (discard_killed_buffers): Rename to ...
+ (mark_discard_killed buffers) ... new name. Add marking
+ of remaining objects. Fix comment. Adjust users.
+ (mark_object): Do not touch frame buffer lists here.
+ * frame.c (delete_frame): Reset frame buffer lists here.
+
+2012-09-13 Paul Eggert <[email protected]>
+
+ Better workaround for GNOME bug when --enable-gcc-warnings.
+ * emacsgtkfixed.c (G_STATIC_ASSERT): Remove, undoing last change.
+ Instead, disable -Wunused-local-typedefs. See Dmitry Antipov in
+ <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00335.html>.
+
+ Simplify SIGIO usage (Bug#12408).
+ The code that dealt with SIGIO was crufty and confusing, e.g., it
+ played tricks like "#undef SIGIO" but these tricks were not used
+ consistently. Simplify mostly by not #undeffing standard symbols,
+ e.g., use "defined USABLE_SIGIO" (our symbol, which we can define
+ or not as we please) rather than "defined SIGIO" (standard symbol
+ that we probably shouldn't #undef).
+ * conf_post.h [USG5_4]: Do not include <sys/wait.h> here.
+ Modules that need it can include it.
+ [USG5_4 && emacs]: Likewise, do not include the streams stuff here.
+ * dispextern.h (ignore_sigio): New decl.
+ * emacs.c (shut_down_emacs): Invoke unrequest_sigio
+ unconditionally, since it's now a no-op if !USABLE_SIGIO.
+ * emacs.c (shut_down_emacs):
+ * keyboard.c (kbd_buffer_store_event_hold):
+ Use ignore_sigio rather than invoking 'signal' directly.
+ * keyboard.c (USABLE_FIONREAD && USG5_4): Include <sys/filio.h>,
+ for FIONREAD.
+ (FIONREAD, SIGIO): Do not #undef.
+ (tty_read_avail_input): Use #error rather than a syntax error.
+ * process.c [USG5_4]: Include <sys/stream.h> and <sys/stropts.h>,
+ for I_PIPE, used by SETUP_SLAVE_PTY.
+ (DATAGRAM_SOCKETS): Simplify defn, based on USABLE_FIONREAD.
+ * sysdep.c (croak): Remove; no longer needed. This bit of
+ temporary code, with Fred N. Fish's comment that it's temporary,
+ has been in Emacs since at least 1992!
+ (init_sigio, reset_sigio, request_sigio, unrequest_sigio):
+ Arrange for them to be no-ops in all cases when ! USABLE_SIGIO.
+ * syssignal.h (croak): Remove decl.
+ (SIGIO, SIGPOO, SIGAIO, SIGPTY): Do not #undef; that's too fragile.
+ * systty.h [!NO_TERMIO]: Do not include <termio.h>; no longer needed
+ now that we're termios-only.
+ (FIONREAD, ASYNC) [BROKEN_FIONREAD]: Do not #undef.
+ * term.c (dissociate_if_controlling_tty): Use #error rather than
+ a run-time error.
+
+ Work around GCC and GNOME bugs when --enable-gcc-warnings.
+ * emacsgtkfixed.c (G_STATIC_ASSERT): Redefine to use 'verify',
+ to work around GNOME bug 683906.
+ * image.c (jpeg_load_body) [HAVE_JPEG && lint]: Pacify gcc -Wclobber.
+ (struct my_jpeg_error_mgr) [HAVE_JPEG && lint]: New member fp.
+ This works around GCC bug 54561.
+
+2012-09-12 Paul Eggert <[email protected]>
+
+ More fixes for 'volatile' and setjmp/longjmp.
+ * eval.c (Fdefvar, Fcondition_case): Remove unnecessary 'volatile's.
+ * image.c (struct png_load_context) [HAVE_PNG]: New type.
+ (png_load_body) [HAVE_PNG]:
+ (jpeg_load_body) [HAVE_JPEG]:
+ New function, with most of the old parent function's body.
+ (png_load) [HAVE_PNG]:
+ (jpeg_load) [HAVE_JPEG]:
+ Invoke the new function, to avoid longjmp munging our locals.
+ (struct my_jpeg_error_mgr) [HAVE_JPEG]: New members cinfo, failure_code.
+ (my_error_exit) [HAVE_JPEG]: Don't trust 'setjmp' to return 2 when
+ longjmp is passed 2, as the C standard doesn't guarantee this.
+ Instead, store the failure code into mgr->failure_code.
+
+2012-09-12 Stefan Monnier <[email protected]>
+
+ * keyboard.c (read_char, requeued_events_pending_p, Finput_pending_p)
+ (Fdiscard_input, quit_throw_to_read_char, init_keyboard)
+ (syms_of_keyboard): Remove support for unread-command-char.
+
+2012-09-12 Eli Zaretskii <[email protected]>
+
+ * w32proc.c (sys_kill): If PID is our process ID and the signal is
+ SIGABRT, call emacs_abort. Avoids silently exiting upon assertion
+ violation. (Bug#12426)
+
+2012-09-12 Paul Eggert <[email protected]>
+
+ * image.c (jpeg_memory_src): Don't assume string len fits in unsigned.
+
+2012-09-12 Stefan Monnier <[email protected]>
+
+ * eval.c: Add `inhibit-debugger'.
+ (Qinhibit_debugger): New symbol.
+ (call_debugger): Bind it instead of Qdebug_on_error.
+ (maybe_call_debugger): Test Vinhibit_debugger.
+ (syms_of_eval): Define inhibit-debugger.
+ * xdisp.c (set_message): Don't bind Qinhibit_debug_on_message.
+ (syms_of_xdisp): Remove inhibit-debug-on-message.
+
+2012-09-11 Paul Eggert <[email protected]>
+
+ Avoid _setjmp/_longjmp problems with local nonvolatile variables.
+ If a nonvolatile local variable is written before a _longjmp to
+ the frame containing the variable, and is read after the _longjmp,
+ the value read is indeterminate. Some local variables of type
+ 'struct handler' and 'struct catchtag' are used in this way, so
+ mark each of their slots as volatile if the slot can be set before
+ _longjmp and read afterwards.
+ * lisp.h (struct handler): var and chosen_clause are now volatile.
+ (struct catchtag): val, next, and pdlcount are now volatile.
+
+ * bidi.c (bidi_push_it, bidi_pop_it):
+ * fns.c (copy_hash_table):
+ * image.c (define_image_type):
+ * keyboard.c (kbd_buffer_store_event_hold):
+ * process.c (Fprocess_send_eof):
+ * xfaces.c (x_create_gc) [HAVE_NS]:
+ * xgselect.c (xg_select):
+ Prefer assignment to memcpy when either will do.
+
+ * alloc.c (discard_killed_buffers): Tune and simplify a bit.
+ Use pointer-to-a-pointer to simplify and avoid a NILP check each
+ time an item is removed. No need to mark this function 'inline';
+ the compiler knows better than we do.
+
+2012-09-11 Jan Djärv <[email protected]>
+
+ * nsterm.m (ns_judge_scroll_bars): Pass NO to updateFrameSize.
+ (updateFrameSize:): Add delay parameter to updateFrameSize, send it
+ to change_frame_size (Bug#12388).
+ (windowDidResize:): Pass YES to updateFrameSize.
+
+ * nsterm.h: Add delay parameter to updateFrameSize.
+
+2012-09-11 Dmitry Antipov <[email protected]>
+
+ Discard killed buffers from deleted window and frame objects.
+ This reduces an amount of references to killed buffers and
+ helps GC to reclaim them faster.
+ * alloc.c (discard_killed_buffers): New function.
+ (mark_object): Use it for deleted windows and frames.
+ (mark_object): If symbol's value is set up for a killed buffer
+ or deleted frame, restore it's global binding.
+ * data.c (swap_in_global_binding): Add GC notice.
+ (swap_in_symval_forwarding): Use convenient set_blv_where.
+ * window.c (wset_next_buffers, wset_prev_buffers): Move ...
+ * window.h: ... to here.
+
+2012-09-11 Dmitry Antipov <[email protected]>
+
+ Convenient macro to check whether the buffer is live.
+ * buffer.h (BUFFER_LIVE_P): New macro.
+ * alloc.c, buffer.c, editfns.c, insdel.c, lread.c, marker.c:
+ * minibuf.c, print.c, process.c, window.c, xdisp.c: Use it.
+
+2012-09-11 YAMAMOTO Mitsuharu <[email protected]>
+
+ * xdisp.c (right_overwritten, right_overwriting): Also handle gstring
+ composition cases (Bug#12364).
+
+ * xterm.c (x_draw_glyph_string): Avoid overwriting inverted left
+ overhang of succeeding glyphs overlapping box cursor.
+
+ * w32term.c (x_draw_glyph_string): Likewise.
+
+2012-09-11 Paul Eggert <[email protected]>
+
+ Simplify, document, and port floating-point (Bug#12381).
+ The porting part of this patch fixes bugs on non-IEEE platforms
+ with frexp, ldexp, logb.
+ * data.c, lisp.h (Qdomain_error, Qsingularity_error, Qunderflow_error):
+ Now static.
+ * floatfns.c: Simplify discussion of functions that Emacs doesn't
+ support, by removing commented-out code and briefly listing the
+ C89 functions excluded. The commented-out stuff was confusing
+ maintenance, e.g., we thought we needed cbrt but it was commented out.
+ (logb): Remove decl; no longer needed.
+ (isfinite): New macro, if not already supplied.
+ (isnan): Don't replace any existing macro.
+ (Ffrexp, Fldexp): Define even if !HAVE_COPYSIGN, as frexp and ldexp
+ are present on all C89 platforms.
+ (Ffrexp): Do not special-case zero, as frexp does the right thing
+ for that case.
+ (Flogb): Do not use logb, as it doesn't have the desired meaning
+ on hosts that use non-base-2 floating point. Instead, stick with
+ frexp, which is C89 anyway. Do not pass an infinity or a NaN to
+ frexp, to avoid getting an unspecified result.
+
+ * xdisp.c (Qinhibit_debug_on_message): Now static.
+
+2012-09-10 Jan Djärv <[email protected]>
+
+ * nsterm.m (ns_update_begin): Set clip path to whole view by using
+ NSBezierPath (Bug#12131).
+
+2012-09-10 Chong Yidong <[email protected]>
+
+ * fns.c (Fdelq, Fdelete): Doc fix.
+
+2012-09-10 Paul Eggert <[email protected]>
+
+ * lisp.h (XSETINT, XSETCONS, XSETVECTOR, XSETSTRING, XSETSYMBOL)
+ (XSETFLOAT, XSETMISC): Parenthesize macro bodies.
+
+2012-09-09 Stefan Monnier <[email protected]>
+
+ * lisp.h (make_lisp_ptr): New macro to replace XSET.
+ (XSETCONS, XSETVECTOR, XSETSTRING, XSETSYMBOL, XSETFLOAT, XSETMISC):
+ Use it.
+
+2012-09-09 Eli Zaretskii <[email protected]>
+
+ * fringe.c (draw_fringe_bitmap_1): Don't reduce the width of the
+ left fringe if the window has a left margin. This avoids leaving
+ traces of the cursor because its leftmost pixel is not drawn over.
+
+ * dispnew.c (update_window_line): When the left margin area of a
+ screen line is updated, set the redraw_fringe_bitmaps_p flag of
+ that screen line. (Bug#12277)
+
+2012-09-09 Paul Eggert <[email protected]>
+
+ Assume C89 or later for math functions (Bug#12381).
+ This simplifies the code, and makes it a bit smaller and faster,
+ and (most important) makes it easier to clean up signal handling
+ since we can stop worring about floating-point exceptions in
+ library code. That was a problem before C89, but the problem
+ went away many years ago on all practical Emacs targets.
+ * data.c, image.c, lread.c, print.c:
+ Don't include <math.h>; no longer needed.
+ * data.c, floatfns.c (IEEE_FLOATING_POINT): Don't worry that it
+ might be autoconfigured, as that never happens.
+ * data.c (fmod):
+ * doprnt.c (DBL_MAX_10_EXP):
+ * print.c (DBL_DIG):
+ Remove. C89 or later always defines these.
+ * floatfns.c (HAVE_MATHERR, FLOAT_CHECK_ERRNO, FLOAT_CHECK_DOMAIN)
+ (in_float, float_error_arg, float_error_arg2, float_error_fn_name)
+ (arith_error, domain_error, domain_error2):
+ Remove all this pre-C89 cruft. Do not include <errno.h> as that's
+ no longer needed -- we simply return what C returns. All uses removed.
+ (IN_FLOAT, IN_FLOAT2): Remove. All uses replaced with
+ the wrapped code.
+ (FLOAT_TO_INT, FLOAT_TO_INT2, range_error, range_error2):
+ Remove. All uses expanded, as these macros are no longer used
+ more than once and are now more trouble than they're worth.
+ (Ftan): Use tan, not sin / cos.
+ (Flogb): Assume C89 frexp.
+ (fmod_float): Assume C89 fmod.
+ (matherr) [HAVE_MATHERR]: Remove; no longer needed.
+ (init_floatfns): Remove. All uses removed.
+
+2012-09-08 Jan Djärv <[email protected]>
+
+ * nsterm.m (ns_draw_fringe_bitmap, ns_dumpglyphs_image): Take back
+ compositeToPoint for OSX < 10.6 (Bug#12390).
+
+2012-09-08 Paul Eggert <[email protected]>
+
+ * floatfns.c (Ftan): Use tan (x), not (sin (x) / cos (x)).
+ This produces more-accurate results.
+
+2012-09-08 Jan Djärv <[email protected]>
+
+ * nsterm.m (updateFrameSize): Call setFrame: on the view when size
+ changes (Bug#12088).
+
+2012-09-08 Chong Yidong <[email protected]>
+
+ * syntax.c (Fstring_to_syntax): Doc fix.
+
+2012-09-08 Jan Djärv <[email protected]>
+
+ * nsterm.m (ns_clip_to_row): Remove code that deals with drawing fringe
+ in the internal border.
+ (x_set_window_size): Remove static variables and their usage.
+ (ns_redraw_scroll_bars): Fix NSTRACE arg.
+ (ns_after_update_window_line, ns_draw_fringe_bitmap): Remove
+ fringe/internal border adjustment (Bug#11052).
+ (ns_draw_fringe_bitmap): Make code more like other terms (xterm.c).
+ (ns_draw_window_cursor): Remove fringe/internal border adjustment.
+ (ns_fix_rect_ibw): Remove.
+ (ns_get_glyph_string_clip_rect): Remove call to ns_fix_rect_ibw.
+ (ns_dumpglyphs_box_or_relief): Ditto.
+ (ns_maybe_dumpglyphs_background): Remove fringe/internal border
+ adjustment.
+ (ns_dumpglyphs_image): Ditto.
+ (ns_dumpglyphs_stretch): Fix coding style. Remove fringe/internal
+ border adjustment.
+ (ns_set_vertical_scroll_bar): Remove variables barOnVeryLeft/Right and
+ their usage. Add fringe_extended_p and its use as in other terms.
+ (ns_judge_scroll_bars): Code style fix. Call updateFrameSize if
+ scroll bar was removed.
+ (updateFrameSize): New function.
+ (windowDidResize): Move code to updateFrameSize and call it.
+
+ * nsterm.h (EmacsView): Add updateFrameSize.
+
+2012-09-07 Chong Yidong <[email protected]>
+
+ * textprop.c (Fget_text_property): Minor doc fix (Bug#12323).
+
+ * data.c (Flocal_variable_if_set_p): Doc fix (Bug#10713).
+
+2012-09-07 Paul Eggert <[email protected]>
+
+ More signal-handler cleanup (Bug#12327).
+ * emacs.c (main): Convert three 'signal' calls to 'sigaction' calls.
+ Problem introduced when merging patches. Noted by Eli Zaretskii in
+ <http://bugs.gnu.org/12327#67>.
+ * floatfns.c: Comment fix.
+ * lisp.h (force_auto_save_soon): Declare regardless of SIGDANGER.
+ SIGDANGER might not be in scope so "#ifdef SIGDANGER" is not right,
+ and anyway the declaration is harmless even if SIGDANGER is not defined.
+ * syssignal.h (SIGIO): Also #undef if (! defined FIONREAD ||
+ defined BROKEN_FIONREAD). systty.h formerly did this, but other
+ source files not surprisingly expected syssignal.h to define, or
+ not define, SIGIO, and it's cleaner to do it that way, for consistency.
+ Include <sys/ioctl.h>, for FIONREAD.
+ * systty.h (SIGIO): Do not #undef here; it's now syssignal.h's job.
+ This eliminates a problem whereby other files mysteriously had
+ to include "syssignal.h" before including "systty.h" if they
+ wanted to use "#ifdef SIGIO".
+
+2012-09-07 Eli Zaretskii <[email protected]>
+
+ * w32proc.c (sigaction): New function, emulates Posix 'sigaction'.
+
+ * w32.c (sigemptyset): Empty the set.
+ (sigsetmask, sigmask, sigblock, sigunblock): Remove unused functions.
+
+ * alloc.c [ENABLE_CHECKING]: Include signal.h, since we need SIGABRT.
+
+2012-09-07 Dmitry Antipov <[email protected]>
+
+ * alloc.c (mark_buffer): Revert unsafe marking optimization.
+ (mark_object): Likewise for frame objects.
+
+2012-09-07 Paul Eggert <[email protected]>
+
+ * syssignal.h (handle_on_main_thread): Always declare,
+ even if FORWARD_SIGNAL_TO_MAIN_THREAD is not defined.
+ This ports to platforms without HAVE_PTHREAD.
+
+2012-09-06 Paul Eggert <[email protected]>
+
+ Signal-handler cleanup (Bug#12327).
+ Emacs's signal handlers were written in the old 4.2BSD style with
+ sigblock and sigmask and so forth, and this led to some
+ inefficiencies and confusion. Rewrite these to use
+ pthread_sigmask etc. without copying signal sets around. Also,
+ get rid of the confusing macros 'SIGNAL_THREAD_CHECK' and
+ 'signal', and instead use functions that do not attempt to take
+ over the system name space. This patch causes Emacs's text
+ segment to shrink by 0.7% on my platform, Fedora 17 x86-64.
+ * alloc.c, emacsgtkfixed.c, nsfns.m, widget.c, xmenu.c:
+ Do not include <signal.h> or "syssignal.h", as these
+ modules do not use signals.
+ * atimer.c, callproc.c, data.c, dispnew.c, emacs.c, floatfns.c:
+ * gtkutil.c, keyboard.c, process.c, sound.c, sysdep.c, term.c, xterm.c:
+ Do not include <signal.h>, as "syssignal.h" does that for us now.
+ * atimer.c (sigmask_atimers): New function.
+ (block_atimers, unblock_atimers): New functions,
+ replacing the old macros BLOCK_ATIMERS and UNBLOCK_ATIMERS.
+ All uses replaced.
+ * conf_post.h [SIGNAL_H_AHB]: Do not include <signal.h>;
+ no longer needed here.
+ * emacs.c (main): Inspect existing signal handler with sigaction,
+ so that there's no need to block and unblock SIGHUP.
+ * sysdep.c (struct save_signal): New member 'action', replacing
+ old member 'handler'.
+ (save_signal_handlers, restore_signal_handlers):
+ Use sigaction instead of 'signal' to save and restore.
+ (get_set_sighandler, set_sighandler) [!WINDOWSNT]:
+ New function. All users of 'signal' modified to use set_sighandler
+ if they're writeonly, and to use sys_signal if they're read+write.
+ (emacs_sigaction_init, forwarded_signal): New functions.
+ (sys_signal): Remove. All uses replaced by calls to sigaction
+ and emacs_sigaction_init, or by direct calls to 'signal'.
+ (sys_sigmask) [!__GNUC__]: Remove; no longer needed.
+ (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove;
+ all uses replaced by pthread_sigmask etc. calls.
+ * syssignal.h: Include <signal.h>.
+ (emacs_sigaction_init, forwarded_signal): New decls.
+ (SIGMASKTYPE): Remove. All uses replaced by its definiens, sigset_t.
+ (SIGEMPTYMASK): Remove; all uses replaced by its definiens, empty_mask.
+ (sigmask, sys_sigmask): Remove; no longer needed.
+ (sigpause): Remove. All uses replaced by its definiens, sigsuspend.
+ (sigblock, sigunblock, sigfree):
+ (sigsetmask) [!defined sigsetmask]:
+ Remove. All uses replaced by pthread_sigmask.
+ (signal): Remove. Its remaining uses (with SIG_DFL and SIG_IGN)
+ no longer need to be replaced, and its typical old uses
+ are now done via emacs_sigaction_init and sigaction.
+ (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove decls.
+ (sys_sigdel): Remove; unused.
+ (NSIG): Remove a FIXME; the code's fine. Remove an unnecessary ifdef.
+
+2012-09-06 Eli Zaretskii <[email protected]>
+
+ * process.c (CAN_HANDLE_MULTIPLE_CHILDREN): Fix a typo that broke
+ SIGCHLD handling on systems that don't have WNOHANG. (Bug#12327)
+
+2012-09-06 Dmitry Antipov <[email protected]>
+
+ Explicitly mark buffer_defaults and buffer_local_symbols.
+ * alloc.c (Fgarbage_collect): Mark buffer_defaults and
+ mark_local_symbols here.
+ (mark_object): If GC_CHECK_MARKED_OBJECTS, simplify checking
+ since special buffers aren't marked here any more.
+ (allocate_buffer): Chain new buffer with all_buffers here...
+ * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): ...and
+ not here.
+ (Vbuffer_defaults, Vbuffer_local_symbols): Remove.
+ (syms_of_buffer): Remove staticpro of the above.
+ (init_buffer_once): Set names for buffer_defaults and
+ buffer_local_symbols.
+
+2012-09-06 Paul Eggert <[email protected]>
+
+ Use bool for booleans in font-related modules.
+ * font.c (font_intern_prop, font_style_to_value)
+ (font_style_symbolic, font_parse_xlfd, font_parse_fcname)
+ (generate_otf_features, font_check_otf_features, font_check_otf)
+ (font_match_p, font_list_entities, font_at):
+ * fontset.c (fontset_id_valid_p, reorder_font_vector
+ (fontset_find_font, Fset_fontset_font)
+ (face_suitable_for_char_p) [0]:
+ * ftfont.c (fc_initialized, ftfont_get_open_type_spec)
+ (ftfont_open, ftfont_text_extents, ftfont_check_otf):
+ (m17n_flt_initialized, ftfont_shape_by_flt):
+ * ftxfont.c (ftxfont_draw_bitmap, ftxfont_draw):
+ * nsfont.m (nsfont_draw):
+ * w32font.c (w32font_draw):
+ * w32term.c (x_draw_glyphless_glyph_string_foreground):
+ Use bool for booleans.
+ * font.h: Adjust to above API changes.
+ (struct font, struct font_driver, struct font_driver_list):
+ Use bool for booleans.
+ (struct font): Remove useless member encoding_type.
+ All users removed.
+ * fontset.c, xftfont.c: Omit unnecessary static decls.
+
+2012-09-06 Dmitry Antipov <[email protected]>
+
+ * alloc.c (mark_object): Revert window marking code
+ since it's unsafe for the Fset_window_configuration.
+
+2012-09-05 Paul Eggert <[email protected]>
+
+ Fix race conditions with signal handlers and errno (Bug#12327).
+ Be more systematic about preserving errno whenever a signal
+ handler returns, even if it's not in the main thread. Do this by
+ renaming signal handlers to distinguish between signal delivery
+ and signal handling. All uses changed.
+ * atimer.c (deliver_alarm_signal): Rename from alarm_signal_handler.
+ * data.c (deliver_arith_signal): Rename from arith_error.
+ * dispnew.c (deliver_window_change_signal): Rename from
+ window_change_signal.
+ * emacs.c (deliver_error_signal): Rename from fatal_error_signal.
+ (deliver_danger_signal) [SIGDANGER]: Rename from memory_warning_signal.
+ * keyboard.c (deliver_input_available_signal): Rename from
+ input_available_signal.
+ (deliver_user_signal): Rename from handle_user_signal.
+ (deliver_interrupt_signal): Rename from interrupt_signal.
+ * process.c (deliver_pipe_signal): Rename from send_process_trap.
+ (deliver_child_signal): Rename from sigchld_handler.
+ * atimer.c (handle_alarm_signal):
+ * data.c (handle_arith_signal):
+ * dispnew.c (handle_window_change_signal):
+ * emacs.c (handle_fatal_signal, handle_danger_signal):
+ * keyboard.c (handle_input_available_signal):
+ * keyboard.c (handle_user_signal, handle_interrupt_signal):
+ * process.c (handle_pipe_signal, handle_child_signal):
+ New functions, with the actual signal-handling code taken from the
+ original respective signal handlers, sans the sporadic attempts to
+ preserve errno, since that's now done by handle_on_main_thread.
+ * atimer.c (alarm_signal_handler): Remove unnecessary decl.
+ * emacs.c, floatfns.c, lisp.h: Remove unused FLOAT_CATCH_SIGKILL cruft.
+ * emacs.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
+ Move to sysdep.c.
+ (main) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
+ Move initialization of main_thread to sysdep.c's init_signals.
+ * process.c (waitpid) [!WNOHANG]: #define to wait; that's good enough for
+ our usage, and simplifies the mainline code.
+ (record_child_status_change): New static function, as a helper
+ for handle_child_signal, and with most of the old child handler's
+ contents.
+ (CAN_HANDLE_MULTIPLE_CHILDREN): New constant.
+ (handle_child_signal): Use the above.
+ * sysdep.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]:
+ Moved here from emacs.c.
+ (init_signals) [FORWARD_SIGNAL_TO_MAIN_THREAD]: Initialize it;
+ code moved here from emacs.c's main function.
+ * sysdep.c, syssignal.h (handle_on_main_thread): New function,
+ replacing the old SIGNAL_THREAD_CHECK. All uses changed. This
+ lets callers save and restore errno properly.
+
+2012-09-05 Dmitry Antipov <[email protected]>
+
+ Remove redundant or unused things here and there.
+ * lisp.h (CYCLE_CHECK, CHAR_TABLE_TRANSLATE): Remove.
+ * conf_post.h (RE_TRANSLATE): Use char_table_translate.
+ * editfns.c (Fcompare_buffer_substrings): Likewise.
+ * frame.h (struct terminal, struct font_driver_list):
+ Remove redundant declarations.
+ * window.h (Qleft, Qright): Likewise.
+
+2012-09-05 Dmitry Antipov <[email protected]>
+
+ Do not mark objects from deleted buffers, windows and frames.
+ * alloc.c (mark_buffer): Mark just the buffer if it is dead.
+ (mark_object): Likewise for windows and frames.
+
+2012-09-05 Dmitry Antipov <[email protected]>
+
+ * alloc.c (valid_lisp_object_p): Treat killed buffers,
+ buffer_defaults and buffer_local_symbols as valid objects.
+ Return special value to denote them.
+
+2012-09-05 Paul Eggert <[email protected]>
+
+ * fileio.c, filelock.c, floatfns.c, fns.c: Use bool for boolean.
+ * fileio.c (auto_saving, auto_save_error_occurred, make_temp_name)
+ (Fexpand_file_name, barf_or_query_if_file_exists, Fcopy_file)
+ (file_name_absolute_p, Fsubstitute_in_file_name):
+ (check_executable, check_writable, Ffile_accessible_directory_p)
+ (Fset_file_selinux_context, Fdefault_file_modes)
+ (Finsert_file_contents, choose_write_coding_system)
+ (Fwrite_region, build_annotations, a_write, e_write)
+ (Fdo_auto_save):
+ * filelock.c (boot_time_initialized, get_boot_time)
+ (get_boot_time_1, lock_file_1, within_one_second):
+ * floatfns.c (in_float):
+ * fns.c (concat, internal_equal, Frequire, base64_encode_1)
+ (base64_decode_1, cmpfn_eql, cmpfn_user_defined)
+ (sweep_weak_table, sweep_weak_hash_tables, secure_hash):
+ * lisp.h (struct Lisp_Hash_Table.cmpfn):
+ * window.c (compare_window_configurations):
+ Use bool for booleans.
+ * fileio.c (auto_saving_dir_umask, auto_saving_mode_bits)
+ (Fdefault_file_modes): Now mode_t, not int, for modes.
+ (Fdo_auto_save): Set a boolean to 1 rather than using ++.
+ (internal_delete_file): Now returns void, not a (boolean) int,
+ since nobody was looking at the return value.
+ * lisp.h, window.h: Adjust to above API changes.
+
+ * xdisp.c (set_message): Simplify and reindent last change.
+
+2012-09-05 Juanma Barranquero <[email protected]>
+
+ * makefile.w32-in ($(BLD)/sysdep.$(O)): Update dependencies.
+
+2012-09-04 Lars Ingebrigtsen <[email protected]>
+
+ * eval.c (call_debugger): Make the function non-static so that we
+ can call it from set_message.
+
+ * xdisp.c (set_message): Implement the new variable `debug-on-message'.
+ (syms_of_xdisp): Defvar it and `inhibit-debug-on-message'.
+
+2012-09-04 Paul Eggert <[email protected]>
+
+ Give more-useful info on a fatal error (Bug#12328).
+ * alloc.c [ENABLE_CHECKING]: Do not include <execinfo.h>.
+ (die) [ENABLE_CHECKING]: Call fatal_error_backtrace instead
+ of doing the work ourselves.
+ * emacs.c (fatal_error_signal): Let fatal_error_backtrace
+ do most of the work.
+ (fatal_error_backtrace): New function, taken from the guts
+ of the old fatal_error_signal, but with a new option to output
+ a backtrace.
+ (shut_down_emacs) [!DOS_NT]: Use strsignal to give more-useful
+ info about the signal than just its number.
+ * lisp.h (fatal_error_backtrace, emacs_backtrace): New decls.
+ * sysdep.c: Include <execinfo.h>
+ (emacs_backtrace): New function, taken partly from the previous
+ code of the 'die' function.
+ (emacs_abort): Call fatal_error_backtrace rather than abort.
+
+2012-09-04 Stefan Monnier <[email protected]>
+
+ * lread.c (readevalloop): Call internal-macroexpand-for-load to perform
+ eager (load-time) macro-expansion.
+ * lisp.mk (lisp): Add macroexp.
+
+2012-09-04 Paul Eggert <[email protected]>
+
+ Simplify redefinition of 'abort' (Bug#12316).
+ Do not try to redefine the 'abort' function. Instead, redo
+ the code so that it calls 'emacs_abort' rather than 'abort'.
+ This removes the need for the NO_ABORT configure-time macro
+ and makes it easier to change the abort code to do a backtrace.
+ * .gdbinit: Just stop at emacs_abort, not at w32_abort or abort.
+ * emacs.c (abort) [!DOS_NT && !NO_ABORT]:
+ Remove; sysdep.c's emacs_abort now takes its place.
+ * lisp.h (emacs_abort): New decl. All calls from Emacs code to
+ 'abort' changed to use 'emacs_abort'.
+ * msdos.c (dos_abort) [defined abort]: Remove; not used.
+ (abort) [!defined abort]: Rename to ...
+ (emacs_abort): ... new name.
+ * sysdep.c (emacs_abort) [!HAVE_NTGUI]: New function, taking
+ the place of the old 'abort' in emacs.c.
+ * w32.c, w32fns.c (abort): Do not #undef.
+ * w32.c (emacs_abort): Rename from w32_abort.
+
+2012-09-04 Eli Zaretskii <[email protected]>
+
+ * w32uniscribe.c (uniscribe_shape): Reverse the sign of
+ offsets[j].dv, since the y axis of the screen coordinates points
+ down, while the y axis of the font definition coordinates points
+ up. This fixes display of Arabic diacritics such as KASRA and
+ KASRATAN. (Bug#11860)
+
+2012-09-04 Paul Eggert <[email protected]>
+
+ Be more systematic about _setjmp vs setjmp.
+ * alloc.c (test_setjmp, mark_stack):
+ * image.c (PNG_LONGJMP) [PNG_LIBPNG_VER < 10500]:
+ (PNG_JMPBUF) [! (PNG_LIBPNG_VER < 10500)]:
+ (png_load, my_error_exit, jpeg_load):
+ * process.c (send_process_trap, send_process):
+ Uniformly prefer _setjmp and _longjmp to setjmp and longjmp.
+ The underscored versions are up to 30x faster on some hosts.
+ Formerly, the code used setjmp+longjmp sometimes and
+ _setjmp+_longjmp at other times, with no particular reason to
+ prefer setjmp+longjmp.
+
+2012-09-03 Paul Eggert <[email protected]>
+
+ Fix minor problem found by static checking.
+ * buffer.c (Fdelete_all_overlays): Return nil.
+
+2012-09-03 Martin Rudalics <[email protected]>
+
+ * buffer.c (Fdelete_all_overlays): New function.
+
+2012-09-03 Chong Yidong <[email protected]>
+
+ * gtkutil.c: Add extern decl for Qxft.
+
+2012-09-02 Paul Eggert <[email protected]>
+
+ * emacs.c, eval.c: Use bool for boolean.
+ * emacs.c (initialized, inhibit_window_system, running_asynch_code):
+ (malloc_using_checking) [DOUG_LEA_MALLOC]:
+ (display_arg) [HAVE_X_WINDOWS || HAVE_NS]:
+ (noninteractive, no_site_lisp, fatal_error_in_progress, argmatch)
+ (main, decode_env_path, Fdaemon_initialized):
+ * eval.c (call_debugger, Finteractive_p, interactive_p):
+ (unwind_to_catch, Fsignal, wants_debugger, skip_debugger)
+ (maybe_call_debugger, Fbacktrace):
+ * process.c (read_process_output, exec_sentinel):
+ Use bool for booleans.
+ * emacs.c (shut_down_emacs): Omit unused boolean argument NO_X.
+ All callers changed.
+ * eval.c (interactive_p): Omit always-true boolean argument
+ EXCLUDE_SUBRS_P. All callers changed.
+ * dispextern.h, lisp.h: Reflect above API changes.
+ * firstfile.c (dummy): Use the address of 'main', whose signature
+ won't change, instead of the address of 'initialize', whose
+ signature just changed from int to bool.
+ * lisp.h (fatal_error_in_progress): New decl of boolean, moved here ...
+ * msdos.c (fatal_error_in_progress): ... from here.
+ * xdisp.c (redisplaying_p): Now a boolean. Set it to 1 instead
+ of incrementing it.
+ (redisplay_internal, unwind_redisplay): Simply clear
+ REDISPLAYING_P when unwinding, instead of saving its previous,
+ always-false value and then restoring it.
+
+ Clean up some extern decls.
+ Mostly, this hoists extern decls out of .c files and into .h files.
+ That way, we're more likely to catch errors if the interfaces change.
+ * alloc.c [USE_GTK]: Include "gtkutil.h" so that we need not
+ declare xg_mark_data.
+ * dispextern.h (x_frame_parm_handlers):
+ * font.h (Qxft):
+ * lisp.h (Qlexical_binding, Qinternal_interpreter_environment)
+ (Qextra_light, Qlight, Qsemi_light, Qsemi_bold, Qbold, Qextra_bold)
+ (Qultra_bold, Qoblique, Qitalic):
+ Move extern decl here from .c file.
+ * alloc.c (xg_mark_data) [USE_GTK]:
+ * doc.c (Qclosure):
+ * eval.c (Qlexical_binding):
+ * fns.c (time) [!HAVE_UNISTD_H]:
+ * gtkutil.c (Qxft, Qnormal, Qextra_light, Qlight, Qsemi_light)
+ (Qsemi_bold, Qbold, Qextra_bold, Qultra_bold, Qoblique, Qitalic):
+ * image.c (Vlibrary_cache, QCloaded_from) [HAVE_NTGUI]:
+ * lread.c (Qinternal_interpreter_environment):
+ * minibuf.c (Qbuffer):
+ * process.c (QCfamily, QCfilter):
+ * widget.c (free_frame_faces):
+ * xfaces.c (free_frame_menubar) [USE_X_TOOLKIT]:
+ * xfont.c (x_clear_errors):
+ * xterm.c (x_frame_parm_handlers):
+ Remove now-redundant extern decls.
+ * keyboard.c, keyboard.h (ignore_mouse_drag_p) [USE_GTK || HAVE_NS]:
+ * xfaces.c (Qultra_light, Qreverse_oblique, Qreverse_italic):
+ Now static.
+ * xfaces.c: Remove unnecessary static decls.
+ * xterm.c (updating_frame): Remove decl of nonexistent object.
+
+ * Makefile.in (gl-stamp): Don't scan $(SOME_MACHINE_OBJECTS)
+ when building globals.h, as the objects that are not built on
+ this host are not needed to compile C files on this host.
+
2012-09-02 Jan Djärv <[email protected]>
* gtkutil.h: Remove prototype for x_wm_set_size_hint.
@@ -187,18 +1085,18 @@
2012-08-28 Jan Djärv <[email protected]>
* nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize
- button_values to NULL. Call setStykeMask so dialogs get a close button.
+ button_values to NULL. Call setStykeMask so dialogs get a close button.
(windowShouldClose:): Set window_closed.
(dealloc): New member, free button_values.
- (process_dialog:): Make member function. Remove window argument,
- replace window with self. Count buttons and allocate and store values
+ (process_dialog:): Make member function. Remove window argument,
+ replace window with self. Count buttons and allocate and store values
in button_values.
(addButton:value:row:): value is int with the name tag. Call setTag
- with tag. Remove return self, declare return value as void.
+ with tag. Remove return self, declare return value as void.
(addString:row:): Remove return self, declare return value as void.
(addSplit): Remove return self, declare return value as void.
(clicked:): Remove return self, declare return value as void.
- Set dialog_return to button_values[seltag]. Code formatting change.
+ Set dialog_return to button_values[seltag]. Code formatting change.
(initFromContents:isQuestion:): Adjust call to process_dialog.
Code formatting change.
(timeout_handler:): Set timer_fired to YES.
@@ -533,7 +1431,7 @@
* fontset.c (FONTSET_ADD): Return void, not Lisp_Object.
Otherwise, the compiler complains about (A?B:C) where B is void
- and C is Lisp_Object. This fixes an incompatibility with Sun C 5.12.
+ and C is Lisp_Object. This fixes an incompatibility with Sun C 5.12.
(fontset_add): Return void, for FONTSET_ADD.
2012-08-21 Paul Eggert <[email protected]>
@@ -1049,7 +1947,7 @@
Start main loop and wait for application defined event.
Inform select thread to stop selecting after main loop is exited.
(ns_term_init): Create selfds pipe and set non-blocking.
- Initialize select_mutex. Start the select thread (fd_handler).
+ Initialize select_mutex. Start the select thread (fd_handler).
(fd_handler:): Loop forever, wait for info from the main thread
to either start or stop selecting. When select returns, send
and appdefined event.
@@ -1181,7 +2079,7 @@
(xg_create_tool_bar): Allocate and initialize a xg_frame_tb_info
if not present.
(update_frame_tool_bar): Return early if data in xg_frame_tb_info
- is up to date. Otherwise store new data.
+ is up to date. Otherwise store new data.
(free_frame_tool_bar): Free xg_frame_tb_info if present.
2012-08-13 Dmitry Antipov <[email protected]>
@@ -1208,7 +2106,7 @@
2012-08-11 Jan Djärv <[email protected]>
* nsterm.m (not_in_argv): New function.
- (application:openFile, application:openTempFile:):
+ (application:openFile, application:openTempFile:):
(application:openFileWithoutUI:, application:openFiles:): Open file
if not_in_argv returns non-zero (bug#12171).
@@ -2395,7 +3293,7 @@
2012-07-21 Jan Djärv <[email protected]>
- * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134).
+ * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134).
(conversationIdentifier): Return value is NSInteger.
* nsterm.m (accessibilityAttributeValue): Surround with NS_IMPL_COCOA.
@@ -4905,7 +5803,7 @@
* lisp.h (struct vectorlike_header): New field `nbytes',
adjust comment accordingly.
* alloc.c (enum mem_type): New type `MEM_TYPE_VECTOR_BLOCK'
- to denote vector blocks. Adjust users (live_vector_p,
+ to denote vector blocks. Adjust users (live_vector_p,
mark_maybe_pointer, valid_lisp_object_p) accordingly.
(COMMON_MULTIPLE): Move outside #if USE_LSB_TAG.
(VECTOR_BLOCK_SIZE, vroundup, VECTOR_BLOCK_BYTES),
@@ -4919,7 +5817,7 @@
(allocate_vector_from_block, init_vectors, allocate_vector_from_block)
(sweep_vectors): New functions.
(allocate_vectorlike): Return `zero_vector' as the only vector of
- 0 items. Allocate new vector from block if vector size is less than
+ 0 items. Allocate new vector from block if vector size is less than
or equal to VBLOCK_BYTES_MAX.
(Fgarbage_collect): Move all vector sweeping code to sweep_vectors.
(init_alloc_once): Add call to init_vectors.
@@ -5009,7 +5907,7 @@
change it's type from Lisp_Object to bitfield.
Change type of 'force_start', 'optional_new_start',
'last_had_star', 'update_mode_line' and 'start_at_line_beg'
- fields from Lisp_Object to bitfield. Adjust users accordingly.
+ fields from Lisp_Object to bitfield. Adjust users accordingly.
2012-05-31 Paul Eggert <[email protected]>
diff --git a/src/Makefile.in b/src/Makefile.in
index 847a5e58fd..a31499e276 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -252,9 +252,6 @@ MSDOS_OBJ =
## w16select.o termcap.o if MSDOS && HAVE_X_WINDOWS.
MSDOS_X_OBJ =
-ns_appdir=@ns_appdir@
-ns_appbindir=@ns_appbindir@
-ns_appsrc=@ns_appsrc@
NS_OBJ=@NS_OBJ@
## nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o if HAVE_NS.
NS_OBJC_OBJ=@NS_OBJC_OBJ@
@@ -453,7 +450,7 @@ GLOBAL_SOURCES = $(base_obj:.o=.c) $(NS_OBJC_OBJ:.o=.m)
gl-stamp: $(libsrc)/make-docfile$(EXEEXT) $(GLOBAL_SOURCES)
@rm -f gl-tmp
- $(libsrc)/make-docfile -d $(srcdir) -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp
+ $(libsrc)/make-docfile -d $(srcdir) -g $(obj) > gl-tmp
$(srcdir)/../build-aux/move-if-change gl-tmp globals.h
echo timestamp > $@
@@ -506,8 +503,9 @@ $(OLDXMENU): $(OLDXMENU_TARGET)
doc.o: buildobj.h
-## If HAVE_NS, some ns-specific rules (for OTHER_FILES) are inserted here.
-@ns_frag@
+ns-app: emacs$(EXEEXT)
+ cd ../nextstep && $(MAKE) $(MFLAGS) all
+
.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
.PHONY: versionclean extraclean frc
@@ -521,7 +519,6 @@ mostlyclean:
clean: mostlyclean
rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT)
-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,
diff --git a/src/alloc.c b/src/alloc.c
index e8637471bc..fb7d35b559 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -24,9 +24,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <limits.h> /* For CHAR_BIT. */
-#include <setjmp.h>
-#include <signal.h>
+#ifdef ENABLE_CHECKING
+#include <signal.h> /* For SIGABRT. */
+#endif
#ifdef HAVE_PTHREAD
#include <pthread.h>
@@ -42,9 +43,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "keyboard.h"
#include "frame.h"
#include "blockinput.h"
-#include "syssignal.h"
#include "termhooks.h" /* For struct terminal. */
-#include <setjmp.h>
+
#include <verify.h>
/* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects.
@@ -69,6 +69,9 @@ extern void *sbrk ();
#include <fcntl.h>
+#ifdef USE_GTK
+# include "gtkutil.h"
+#endif
#ifdef WINDOWSNT
#include "w32.h"
#endif
@@ -82,66 +85,8 @@ extern void *sbrk ();
#define MMAP_MAX_AREAS 100000000
-#else /* not DOUG_LEA_MALLOC */
-
-/* The following come from gmalloc.c. */
-
-extern size_t _bytes_used;
-extern size_t __malloc_extra_blocks;
-extern void *_malloc_internal (size_t);
-extern void _free_internal (void *);
-
#endif /* not DOUG_LEA_MALLOC */
-#if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT
-#ifdef HAVE_PTHREAD
-
-/* When GTK uses the file chooser dialog, different backends can be loaded
- dynamically. One such a backend is the Gnome VFS backend that gets loaded
- if you run Gnome. That backend creates several threads and also allocates
- memory with malloc.
-
- Also, gconf and gsettings may create several threads.
-
- If Emacs sets malloc hooks (! SYSTEM_MALLOC) and the emacs_blocked_*
- functions below are called from malloc, there is a chance that one
- of these threads preempts the Emacs main thread and the hook variables
- end up in an inconsistent state. So we have a mutex to prevent that (note
- that the backend handles concurrent access to malloc within its own threads
- but Emacs code running in the main thread is not included in that control).
-
- When UNBLOCK_INPUT is called, reinvoke_input_signal may be called. If this
- happens in one of the backend threads we will have two threads that tries
- to run Emacs code at once, and the code is not prepared for that.
- To prevent that, we only call BLOCK/UNBLOCK from the main thread. */
-
-static pthread_mutex_t alloc_mutex;
-
-#define BLOCK_INPUT_ALLOC \
- do \
- { \
- if (pthread_equal (pthread_self (), main_thread)) \
- BLOCK_INPUT; \
- pthread_mutex_lock (&alloc_mutex); \
- } \
- while (0)
-#define UNBLOCK_INPUT_ALLOC \
- do \
- { \
- pthread_mutex_unlock (&alloc_mutex); \
- if (pthread_equal (pthread_self (), main_thread)) \
- UNBLOCK_INPUT; \
- } \
- while (0)
-
-#else /* ! defined HAVE_PTHREAD */
-
-#define BLOCK_INPUT_ALLOC BLOCK_INPUT
-#define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT
-
-#endif /* ! defined HAVE_PTHREAD */
-#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */
-
/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer
to a struct Lisp_String. */
@@ -200,10 +145,6 @@ static char *spare_memory[7];
#define SPARE_MEMORY (1 << 14)
-/* Number of extra blocks malloc should get when it needs more core. */
-
-static int malloc_hysteresis;
-
/* 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
@@ -275,6 +216,7 @@ static void gc_sweep (void);
static Lisp_Object make_pure_vector (ptrdiff_t);
static void mark_glyph_matrix (struct glyph_matrix *);
static void mark_face_cache (struct face_cache *);
+static void mark_buffer (struct buffer *);
#if !defined REL_ALLOC || defined SYSTEM_MALLOC
static void refill_memory_reserve (void);
@@ -407,12 +349,12 @@ static void mark_memory (void *, void *);
static void mem_init (void);
static struct mem_node *mem_insert (void *, void *, enum mem_type);
static void mem_insert_fixup (struct mem_node *);
-#endif
static void mem_rotate_left (struct mem_node *);
static void mem_rotate_right (struct mem_node *);
static void mem_delete (struct mem_node *);
static void mem_delete_fixup (struct mem_node *);
static inline struct mem_node *mem_find (void *);
+#endif
#if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS
@@ -581,39 +523,17 @@ xmalloc_get_size (unsigned char *ptr)
}
-/* The call depth in overrun_check functions. For example, this might happen:
- xmalloc()
- overrun_check_malloc()
- -> malloc -> (via hook)_-> emacs_blocked_malloc
- -> overrun_check_malloc
- call malloc (hooks are NULL, so real malloc is called).
- malloc returns 10000.
- add overhead, return 10016.
- <- (back in overrun_check_malloc)
- add overhead again, return 10032
- xmalloc returns 10032.
-
- (time passes).
-
- xfree(10032)
- overrun_check_free(10032)
- decrease overhead
- free(10016) <- crash, because 10000 is the original pointer. */
-
-static ptrdiff_t check_depth;
-
/* Like malloc, but wraps allocated block with header and trailer. */
static void *
overrun_check_malloc (size_t size)
{
register unsigned char *val;
- int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0;
- if (SIZE_MAX - overhead < size)
- abort ();
+ if (SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD < size)
+ emacs_abort ();
- val = malloc (size + overhead);
- if (val && check_depth == 1)
+ val = malloc (size + XMALLOC_OVERRUN_CHECK_OVERHEAD);
+ if (val)
{
memcpy (val, xmalloc_overrun_check_header, XMALLOC_OVERRUN_CHECK_SIZE);
val += XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE;
@@ -621,7 +541,6 @@ overrun_check_malloc (size_t size)
memcpy (val + size, xmalloc_overrun_check_trailer,
XMALLOC_OVERRUN_CHECK_SIZE);
}
- --check_depth;
return val;
}
@@ -633,12 +552,10 @@ static void *
overrun_check_realloc (void *block, size_t size)
{
register unsigned char *val = (unsigned char *) block;
- int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0;
- if (SIZE_MAX - overhead < size)
- abort ();
+ if (SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD < size)
+ emacs_abort ();
if (val
- && check_depth == 1
&& memcmp (xmalloc_overrun_check_header,
val - XMALLOC_OVERRUN_CHECK_SIZE - XMALLOC_OVERRUN_SIZE_SIZE,
XMALLOC_OVERRUN_CHECK_SIZE) == 0)
@@ -646,15 +563,15 @@ overrun_check_realloc (void *block, size_t size)
size_t osize = xmalloc_get_size (val);
if (memcmp (xmalloc_overrun_check_trailer, val + osize,
XMALLOC_OVERRUN_CHECK_SIZE))
- abort ();
+ emacs_abort ();
memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE);
val -= XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE;
memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE);
}
- val = realloc (val, size + overhead);
+ val = realloc (val, size + XMALLOC_OVERRUN_CHECK_OVERHEAD);
- if (val && check_depth == 1)
+ if (val)
{
memcpy (val, xmalloc_overrun_check_header, XMALLOC_OVERRUN_CHECK_SIZE);
val += XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE;
@@ -662,7 +579,6 @@ overrun_check_realloc (void *block, size_t size)
memcpy (val + size, xmalloc_overrun_check_trailer,
XMALLOC_OVERRUN_CHECK_SIZE);
}
- --check_depth;
return val;
}
@@ -673,9 +589,7 @@ overrun_check_free (void *block)
{
unsigned char *val = (unsigned char *) block;
- ++check_depth;
if (val
- && check_depth == 1
&& memcmp (xmalloc_overrun_check_header,
val - XMALLOC_OVERRUN_CHECK_SIZE - XMALLOC_OVERRUN_SIZE_SIZE,
XMALLOC_OVERRUN_CHECK_SIZE) == 0)
@@ -683,7 +597,7 @@ overrun_check_free (void *block)
size_t osize = xmalloc_get_size (val);
if (memcmp (xmalloc_overrun_check_trailer, val + osize,
XMALLOC_OVERRUN_CHECK_SIZE))
- abort ();
+ emacs_abort ();
#ifdef XMALLOC_CLEAR_FREE_MEMORY
val -= XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE;
memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_OVERHEAD);
@@ -695,7 +609,6 @@ overrun_check_free (void *block)
}
free (val);
- --check_depth;
}
#undef malloc
@@ -706,14 +619,33 @@ overrun_check_free (void *block)
#define free overrun_check_free
#endif
-#ifdef SYNC_INPUT
-/* When using SYNC_INPUT, we don't call malloc from a signal handler, so
- there's no need to block input around malloc. */
-#define MALLOC_BLOCK_INPUT ((void)0)
-#define MALLOC_UNBLOCK_INPUT ((void)0)
+/* If compiled with XMALLOC_BLOCK_INPUT_CHECK, define a symbol
+ BLOCK_INPUT_IN_MEMORY_ALLOCATORS that is visible to the debugger.
+ If that variable is set, block input while in one of Emacs's memory
+ allocation functions. There should be no need for this debugging
+ option, since signal handlers do not allocate memory, but Emacs
+ formerly allocated memory in signal handlers and this compile-time
+ option remains as a way to help debug the issue should it rear its
+ ugly head again. */
+#ifdef XMALLOC_BLOCK_INPUT_CHECK
+bool block_input_in_memory_allocators EXTERNALLY_VISIBLE;
+static void
+malloc_block_input (void)
+{
+ if (block_input_in_memory_allocators)
+ BLOCK_INPUT;
+}
+static void
+malloc_unblock_input (void)
+{
+ if (block_input_in_memory_allocators)
+ UNBLOCK_INPUT;
+}
+# define MALLOC_BLOCK_INPUT malloc_block_input ()
+# define MALLOC_UNBLOCK_INPUT malloc_unblock_input ()
#else
-#define MALLOC_BLOCK_INPUT BLOCK_INPUT
-#define MALLOC_UNBLOCK_INPUT UNBLOCK_INPUT
+# define MALLOC_BLOCK_INPUT ((void) 0)
+# define MALLOC_UNBLOCK_INPUT ((void) 0)
#endif
/* Like malloc but check for no memory and block interrupt input.. */
@@ -782,8 +714,7 @@ xfree (void *block)
free (block);
MALLOC_UNBLOCK_INPUT;
/* We don't call refill_memory_reserve here
- because that duplicates doing so in emacs_blocked_free
- and the criterion should go there. */
+ because in practice the call in r_alloc_free seems to suffice. */
}
@@ -1210,256 +1141,6 @@ lisp_align_free (void *block)
}
-#ifndef SYSTEM_MALLOC
-
-/* Arranging to disable input signals while we're in malloc.
-
- This only works with GNU malloc. To help out systems which can't
- use GNU malloc, all the calls to malloc, realloc, and free
- elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT
- pair; unfortunately, we have no idea what C library functions
- might call malloc, so we can't really protect them unless you're
- using GNU malloc. Fortunately, most of the major operating systems
- can use GNU malloc. */
-
-#ifndef SYNC_INPUT
-/* When using SYNC_INPUT, we don't call malloc from a signal handler, so
- there's no need to block input around malloc. */
-
-#ifndef DOUG_LEA_MALLOC
-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) (size_t, const void *);
-static void * (*old_realloc_hook) (void *, size_t, const void*);
-static void (*old_free_hook) (void*, const void*);
-
-#ifdef DOUG_LEA_MALLOC
-# define BYTES_USED (mallinfo ().uordblks)
-#else
-# define BYTES_USED _bytes_used
-#endif
-
-#ifdef GC_MALLOC_CHECK
-static bool dont_register_blocks;
-#endif
-
-static size_t bytes_used_when_reconsidered;
-
-/* Value of _bytes_used, when spare_memory was freed. */
-
-static size_t bytes_used_when_full;
-
-/* This function is used as the hook for free to call. */
-
-static void
-emacs_blocked_free (void *ptr, const void *ptr2)
-{
- BLOCK_INPUT_ALLOC;
-
-#ifdef GC_MALLOC_CHECK
- if (ptr)
- {
- struct mem_node *m;
-
- m = mem_find (ptr);
- if (m == MEM_NIL || m->start != ptr)
- {
- fprintf (stderr,
- "Freeing `%p' which wasn't allocated with malloc\n", ptr);
- abort ();
- }
- else
- {
- /* fprintf (stderr, "free %p...%p (%p)\n", m->start, m->end, ptr); */
- mem_delete (m);
- }
- }
-#endif /* GC_MALLOC_CHECK */
-
- __free_hook = old_free_hook;
- free (ptr);
-
- /* If we released our reserve (due to running out of memory),
- and we have a fair amount free once again,
- try to set aside another reserve in case we run out once more. */
- if (! NILP (Vmemory_full)
- /* Verify there is enough space that even with the malloc
- hysteresis this call won't run out again.
- The code here is correct as long as SPARE_MEMORY
- is substantially larger than the block size malloc uses. */
- && (bytes_used_when_full
- > ((bytes_used_when_reconsidered = BYTES_USED)
- + max (malloc_hysteresis, 4) * SPARE_MEMORY)))
- refill_memory_reserve ();
-
- __free_hook = emacs_blocked_free;
- UNBLOCK_INPUT_ALLOC;
-}
-
-
-/* This function is the malloc hook that Emacs uses. */
-
-static void *
-emacs_blocked_malloc (size_t size, const void *ptr)
-{
- void *value;
-
- BLOCK_INPUT_ALLOC;
- __malloc_hook = old_malloc_hook;
-#ifdef DOUG_LEA_MALLOC
- /* Segfaults on my system. --lorentey */
- /* mallopt (M_TOP_PAD, malloc_hysteresis * 4096); */
-#else
- __malloc_extra_blocks = malloc_hysteresis;
-#endif
-
- value = malloc (size);
-
-#ifdef GC_MALLOC_CHECK
- {
- struct mem_node *m = mem_find (value);
- if (m != MEM_NIL)
- {
- fprintf (stderr, "Malloc returned %p which is already in use\n",
- value);
- fprintf (stderr, "Region in use is %p...%p, %td bytes, type %d\n",
- m->start, m->end, (char *) m->end - (char *) m->start,
- m->type);
- abort ();
- }
-
- if (!dont_register_blocks)
- {
- mem_insert (value, (char *) value + max (1, size), allocated_mem_type);
- allocated_mem_type = MEM_TYPE_NON_LISP;
- }
- }
-#endif /* GC_MALLOC_CHECK */
-
- __malloc_hook = emacs_blocked_malloc;
- UNBLOCK_INPUT_ALLOC;
-
- /* fprintf (stderr, "%p malloc\n", value); */
- return value;
-}
-
-
-/* This function is the realloc hook that Emacs uses. */
-
-static void *
-emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2)
-{
- void *value;
-
- BLOCK_INPUT_ALLOC;
- __realloc_hook = old_realloc_hook;
-
-#ifdef GC_MALLOC_CHECK
- if (ptr)
- {
- struct mem_node *m = mem_find (ptr);
- if (m == MEM_NIL || m->start != ptr)
- {
- fprintf (stderr,
- "Realloc of %p which wasn't allocated with malloc\n",
- ptr);
- abort ();
- }
-
- mem_delete (m);
- }
-
- /* fprintf (stderr, "%p -> realloc\n", ptr); */
-
- /* Prevent malloc from registering blocks. */
- dont_register_blocks = 1;
-#endif /* GC_MALLOC_CHECK */
-
- value = realloc (ptr, size);
-
-#ifdef GC_MALLOC_CHECK
- dont_register_blocks = 0;
-
- {
- struct mem_node *m = mem_find (value);
- if (m != MEM_NIL)
- {
- fprintf (stderr, "Realloc returns memory that is already in use\n");
- abort ();
- }
-
- /* Can't handle zero size regions in the red-black tree. */
- mem_insert (value, (char *) value + max (size, 1), MEM_TYPE_NON_LISP);
- }
-
- /* fprintf (stderr, "%p <- realloc\n", value); */
-#endif /* GC_MALLOC_CHECK */
-
- __realloc_hook = emacs_blocked_realloc;
- UNBLOCK_INPUT_ALLOC;
-
- return value;
-}
-
-
-#ifdef HAVE_PTHREAD
-/* Called from Fdump_emacs so that when the dumped Emacs starts, it has a
- normal malloc. Some thread implementations need this as they call
- malloc before main. The pthread_self call in BLOCK_INPUT_ALLOC then
- calls malloc because it is the first call, and we have an endless loop. */
-
-void
-reset_malloc_hooks (void)
-{
- __free_hook = old_free_hook;
- __malloc_hook = old_malloc_hook;
- __realloc_hook = old_realloc_hook;
-}
-#endif /* HAVE_PTHREAD */
-
-
-/* Called from main to set up malloc to use our hooks. */
-
-void
-uninterrupt_malloc (void)
-{
-#ifdef HAVE_PTHREAD
-#ifdef DOUG_LEA_MALLOC
- pthread_mutexattr_t attr;
-
- /* GLIBC has a faster way to do this, but let's keep it portable.
- This is according to the Single UNIX Specification. */
- pthread_mutexattr_init (&attr);
- pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
- pthread_mutex_init (&alloc_mutex, &attr);
-#else /* !DOUG_LEA_MALLOC */
- /* 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 */
-#endif /* HAVE_PTHREAD */
-
- if (__free_hook != emacs_blocked_free)
- old_free_hook = __free_hook;
- __free_hook = emacs_blocked_free;
-
- if (__malloc_hook != emacs_blocked_malloc)
- old_malloc_hook = __malloc_hook;
- __malloc_hook = emacs_blocked_malloc;
-
- if (__realloc_hook != emacs_blocked_realloc)
- old_realloc_hook = __realloc_hook;
- __realloc_hook = emacs_blocked_realloc;
-}
-
-#endif /* not SYNC_INPUT */
-#endif /* not SYSTEM_MALLOC */
-
-
-
/***********************************************************************
Interval Allocation
***********************************************************************/
@@ -1505,8 +1186,6 @@ make_interval (void)
{
INTERVAL val;
- /* eassert (!handling_signal); */
-
MALLOC_BLOCK_INPUT;
if (interval_free_list)
@@ -1801,7 +1480,7 @@ string_bytes (struct Lisp_String *s)
if (!PURE_POINTER_P (s)
&& s->data
&& nbytes != SDATA_NBYTES (SDATA_OF_STRING (s)))
- abort ();
+ emacs_abort ();
return nbytes;
}
@@ -1875,7 +1554,7 @@ check_string_free_list (void)
while (s != NULL)
{
if ((uintptr_t) s < 1024)
- abort ();
+ emacs_abort ();
s = NEXT_FREE_LISP_STRING (s);
}
}
@@ -1890,8 +1569,6 @@ allocate_string (void)
{
struct Lisp_String *s;
- /* eassert (!handling_signal); */
-
MALLOC_BLOCK_INPUT;
/* If the free-list is empty, allocate a new string_block, and
@@ -2104,7 +1781,7 @@ sweep_strings (void)
back-pointer so that we know it's free. */
#ifdef GC_CHECK_STRING_BYTES
if (string_bytes (s) != SDATA_NBYTES (data))
- abort ();
+ emacs_abort ();
#else
data->u.nbytes = STRING_BYTES (s);
#endif
@@ -2215,7 +1892,7 @@ compact_small_strings (void)
/* Check that the string size recorded in the string is the
same as the one recorded in the sdata structure. */
if (s && string_bytes (s) != SDATA_NBYTES (from))
- abort ();
+ emacs_abort ();
#endif /* GC_CHECK_STRING_BYTES */
nbytes = s ? STRING_BYTES (s) : SDATA_NBYTES (from);
@@ -2228,7 +1905,7 @@ compact_small_strings (void)
if (memcmp (string_overrun_cookie,
(char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE,
GC_STRING_OVERRUN_COOKIE_SIZE))
- abort ();
+ emacs_abort ();
#endif
/* Non-NULL S means it's alive. Copy its data. */
@@ -2485,7 +2162,7 @@ make_uninit_multibyte_string (EMACS_INT nchars, EMACS_INT nbytes)
struct Lisp_String *s;
if (nchars < 0)
- abort ();
+ emacs_abort ();
if (!nbytes)
return empty_multibyte_string;
@@ -2583,8 +2260,6 @@ make_float (double float_value)
{
register Lisp_Object val;
- /* eassert (!handling_signal); */
-
MALLOC_BLOCK_INPUT;
if (float_free_list)
@@ -2692,8 +2367,6 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
{
register Lisp_Object val;
- /* eassert (!handling_signal); */
-
MALLOC_BLOCK_INPUT;
if (cons_free_list)
@@ -2806,7 +2479,7 @@ listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...)
else if (type == CONSTYPE_HEAP)
val = Fcons (objp[i], val);
else
- abort ();
+ emacs_abort ();
}
return val;
}
@@ -3199,9 +2872,6 @@ allocate_vectorlike (ptrdiff_t len)
MALLOC_BLOCK_INPUT;
- /* This gets triggered by code which I haven't bothered to fix. --Stef */
- /* eassert (!handling_signal); */
-
if (len == 0)
p = XVECTOR (zero_vector);
else
@@ -3278,7 +2948,10 @@ allocate_buffer (void)
XSETPVECTYPESIZE (b, PVEC_BUFFER, (offsetof (struct buffer, own_text)
- header_size) / word_size);
- /* Note that the fields of B are not initialized. */
+ /* Put B on the chain of all buffers including killed ones. */
+ b->header.next.buffer = all_buffers;
+ all_buffers = b;
+ /* Note that the rest fields of B are not initialized. */
return b;
}
@@ -3483,8 +3156,6 @@ Its value and function definition are void, and its property list is nil. */)
CHECK_STRING (name);
- /* eassert (!handling_signal); */
-
MALLOC_BLOCK_INPUT;
if (symbol_free_list)
@@ -3569,8 +3240,6 @@ allocate_misc (enum Lisp_Misc_Type type)
{
Lisp_Object val;
- /* eassert (!handling_signal); */
-
MALLOC_BLOCK_INPUT;
if (marker_free_list)
@@ -3674,7 +3343,7 @@ build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos)
struct Lisp_Marker *m;
/* No dead buffers here. */
- eassert (!NILP (BVAR (buf, name)));
+ eassert (BUFFER_LIVE_P (buf));
/* Every character is at least one byte. */
eassert (charpos <= bytepos);
@@ -3790,12 +3459,6 @@ memory_full (size_t nbytes)
lisp_free (spare_memory[i]);
spare_memory[i] = 0;
}
-
- /* Record the space now used. When it decreases substantially,
- we can refill the memory reserve. */
-#if !defined SYSTEM_MALLOC && !defined SYNC_INPUT
- bytes_used_when_full = BYTES_USED;
-#endif
}
/* This used to call error, but if we've run out of memory, we could
@@ -3916,7 +3579,7 @@ mem_insert (void *start, void *end, enum mem_type type)
while (c != MEM_NIL)
{
if (start >= c->start && start < c->end)
- abort ();
+ emacs_abort ();
parent = c;
c = start < c->start ? c->left : c->right;
}
@@ -3933,9 +3596,9 @@ mem_insert (void *start, void *end, enum mem_type type)
/* Create a new node. */
#ifdef GC_MALLOC_CHECK
- x = _malloc_internal (sizeof *x);
+ x = malloc (sizeof *x);
if (x == NULL)
- abort ();
+ emacs_abort ();
#else
x = xmalloc (sizeof *x);
#endif
@@ -4157,7 +3820,7 @@ mem_delete (struct mem_node *z)
mem_delete_fixup (x);
#ifdef GC_MALLOC_CHECK
- _free_internal (y);
+ free (y);
#else
xfree (y);
#endif
@@ -4610,7 +4273,7 @@ mark_maybe_pointer (void *p)
break;
default:
- abort ();
+ emacs_abort ();
}
if (!NILP (obj))
@@ -4754,14 +4417,14 @@ test_setjmp (void)
{
char buf[10];
register int x;
- jmp_buf jbuf;
+ sys_jmp_buf jbuf;
/* Arrange for X to be put in a register. */
sprintf (buf, "1");
x = strlen (buf);
x = 2 * x - 1;
- setjmp (jbuf);
+ sys_setjmp (jbuf);
if (longjmps_done == 1)
{
/* Came here after the longjmp at the end of the function.
@@ -4786,7 +4449,7 @@ test_setjmp (void)
++longjmps_done;
x = 2;
if (longjmps_done == 1)
- longjmp (jbuf, 1);
+ sys_longjmp (jbuf, 1);
}
#endif /* not GC_SAVE_REGISTERS_ON_STACK && not GC_SETJMP_WORKS */
@@ -4807,7 +4470,7 @@ check_gcpros (void)
if (!survives_gc_p (p->var[i]))
/* FIXME: It's not necessarily a bug. It might just be that the
GCPRO is unnecessary or should release the object sooner. */
- abort ();
+ emacs_abort ();
}
#elif GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
@@ -4892,7 +4555,7 @@ mark_stack (void)
/* jmp_buf may not be aligned enough on darwin-ppc64 */
union aligned_jmpbuf {
Lisp_Object o;
- jmp_buf j;
+ sys_jmp_buf j;
} j;
volatile bool stack_grows_down_p = (char *) &j > (char *) stack_base;
#endif
@@ -4928,7 +4591,7 @@ mark_stack (void)
}
#endif /* GC_SETJMP_WORKS */
- setjmp (j.j);
+ sys_setjmp (j.j);
end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j;
#endif /* not GC_SAVE_REGISTERS_ON_STACK */
#endif /* not HAVE___BUILTIN_UNWIND_INIT */
@@ -4978,7 +4641,8 @@ valid_pointer_p (void *p)
#endif
}
-/* Return 1 if OBJ is a valid lisp object.
+/* Return 2 if OBJ is a killed or special buffer object.
+ Return 1 if OBJ is a valid lisp object.
Return 0 if OBJ is NOT a valid lisp object.
Return -1 if we cannot validate OBJ.
This function can be quite slow,
@@ -4999,6 +4663,9 @@ valid_lisp_object_p (Lisp_Object obj)
if (PURE_POINTER_P (p))
return 1;
+ if (p == &buffer_defaults || p == &buffer_local_symbols)
+ return 2;
+
#if !GC_MARK_STACK
return valid_pointer_p (p);
#else
@@ -5024,7 +4691,7 @@ valid_lisp_object_p (Lisp_Object obj)
return 0;
case MEM_TYPE_BUFFER:
- return live_buffer_p (m, p);
+ return live_buffer_p (m, p) ? 1 : 2;
case MEM_TYPE_CONS:
return live_cons_p (m, p);
@@ -5348,7 +5015,7 @@ staticpro (Lisp_Object *varaddress)
{
staticvec[staticidx++] = varaddress;
if (staticidx >= NSTATICS)
- abort ();
+ emacs_abort ();
}
@@ -5403,7 +5070,7 @@ See Info node `(elisp)Garbage Collection'. */)
Lisp_Object retval = Qnil;
if (abort_on_gc)
- abort ();
+ emacs_abort ();
/* Can't GC if pure storage overflowed because we can't determine
if something is a pure object or not. */
@@ -5466,6 +5133,9 @@ See Info node `(elisp)Garbage Collection'. */)
/* Mark all the special slots that serve as the roots of accessibility. */
+ mark_buffer (&buffer_defaults);
+ mark_buffer (&buffer_local_symbols);
+
for (i = 0; i < staticidx; i++)
mark_object (*staticvec[i]);
@@ -5478,10 +5148,7 @@ See Info node `(elisp)Garbage Collection'. */)
mark_kboards ();
#ifdef USE_GTK
- {
- extern void xg_mark_data (void);
- xg_mark_data ();
- }
+ xg_mark_data ();
#endif
#if (GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS \
@@ -5853,6 +5520,32 @@ mark_buffer (struct buffer *buffer)
mark_buffer (buffer->base_buffer);
}
+/* Remove killed buffers or items whose car is a killed buffer from
+ LIST, and mark other items. Return changed LIST, which is marked. */
+
+static Lisp_Object
+mark_discard_killed_buffers (Lisp_Object list)
+{
+ Lisp_Object tail, *prev = &list;
+
+ for (tail = list; CONSP (tail) && !CONS_MARKED_P (XCONS (tail));
+ tail = XCDR (tail))
+ {
+ Lisp_Object tem = XCAR (tail);
+ if (CONSP (tem))
+ tem = XCAR (tem);
+ if (BUFFERP (tem) && !BUFFER_LIVE_P (XBUFFER (tem)))
+ *prev = XCDR (tail);
+ else
+ {
+ CONS_MARK (XCONS (tail));
+ mark_object (XCAR (tail));
+ prev = &XCDR_AS_LVALUE (tail);
+ }
+ }
+ return list;
+}
+
/* Determine type of generic Lisp_Object and mark it accordingly. */
void
@@ -5887,7 +5580,7 @@ mark_object (Lisp_Object arg)
do { \
m = mem_find (po); \
if (m == MEM_NIL) \
- abort (); \
+ emacs_abort (); \
} while (0)
/* Check that the object pointed to by PO is live, using predicate
@@ -5895,7 +5588,7 @@ mark_object (Lisp_Object arg)
#define CHECK_LIVE(LIVEP) \
do { \
if (!LIVEP (m, po)) \
- abort (); \
+ emacs_abort (); \
} while (0)
/* Check both of the above conditions. */
@@ -5940,10 +5633,8 @@ mark_object (Lisp_Object arg)
#ifdef GC_CHECK_MARKED_OBJECTS
m = mem_find (po);
- if (m == MEM_NIL && !SUBRP (obj)
- && po != &buffer_defaults
- && po != &buffer_local_symbols)
- abort ();
+ if (m == MEM_NIL && !SUBRP (obj))
+ emacs_abort ();
#endif /* GC_CHECK_MARKED_OBJECTS */
if (ptr->header.size & PSEUDOVECTOR_FLAG)
@@ -5959,15 +5650,14 @@ mark_object (Lisp_Object arg)
{
case PVEC_BUFFER:
#ifdef GC_CHECK_MARKED_OBJECTS
- if (po != &buffer_defaults && po != &buffer_local_symbols)
- {
- struct buffer *b;
- FOR_EACH_BUFFER (b)
- if (b == po)
- break;
- if (b == NULL)
- abort ();
- }
+ {
+ struct buffer *b;
+ FOR_EACH_BUFFER (b)
+ if (b == po)
+ break;
+ if (b == NULL)
+ emacs_abort ();
+ }
#endif /* GC_CHECK_MARKED_OBJECTS */
mark_buffer ((struct buffer *) ptr);
break;
@@ -5992,22 +5682,31 @@ mark_object (Lisp_Object arg)
break;
case PVEC_FRAME:
- {
- mark_vectorlike (ptr);
- mark_face_cache (((struct frame *) ptr)->face_cache);
- }
+ mark_vectorlike (ptr);
+ mark_face_cache (((struct frame *) ptr)->face_cache);
break;
case PVEC_WINDOW:
{
struct window *w = (struct window *) ptr;
+ bool leaf = NILP (w->hchild) && NILP (w->vchild);
+
+ /* For live windows, Lisp code filters out killed buffers
+ from both buffer lists. For dead windows, we do it here
+ in attempt to help GC to reclaim killed buffers faster. */
+ if (leaf && NILP (w->buffer))
+ {
+ wset_prev_buffers
+ (w, mark_discard_killed_buffers (w->prev_buffers));
+ wset_next_buffers
+ (w, mark_discard_killed_buffers (w->next_buffers));
+ }
mark_vectorlike (ptr);
/* Mark glyphs for leaf windows. Marking window
matrices is sufficient because frame matrices
use the same glyph memory. */
- if (NILP (w->hchild) && NILP (w->vchild)
- && w->current_matrix)
+ if (leaf && w->current_matrix)
{
mark_glyph_matrix (w->current_matrix);
mark_glyph_matrix (w->desired_matrix);
@@ -6042,7 +5741,7 @@ mark_object (Lisp_Object arg)
break;
case PVEC_FREE:
- abort ();
+ emacs_abort ();
default:
mark_vectorlike (ptr);
@@ -6074,10 +5773,14 @@ mark_object (Lisp_Object arg)
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. */
+ Lisp_Object where = blv->where;
+ /* If the value is set up for a killed buffer or deleted
+ frame, restore it's global binding. If the value is
+ forwarded to a C variable, either it's not a Lisp_Object
+ var, or it's staticpro'd already. */
+ if ((BUFFERP (where) && !BUFFER_LIVE_P (XBUFFER (where)))
+ || (FRAMEP (where) && !FRAME_LIVE_P (XFRAME (where))))
+ swap_in_global_binding (ptr);
mark_object (blv->where);
mark_object (blv->valcell);
mark_object (blv->defcell);
@@ -6089,7 +5792,7 @@ mark_object (Lisp_Object arg)
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 ();
+ default: emacs_abort ();
}
if (!PURE_POINTER_P (XSTRING (ptr->name)))
MARK_STRING (XSTRING (ptr->name));
@@ -6143,7 +5846,7 @@ mark_object (Lisp_Object arg)
break;
default:
- abort ();
+ emacs_abort ();
}
break;
@@ -6165,7 +5868,7 @@ mark_object (Lisp_Object arg)
obj = ptr->u.cdr;
cdr_count++;
if (cdr_count == mark_object_loop_halt)
- abort ();
+ emacs_abort ();
goto loop;
}
@@ -6178,7 +5881,7 @@ mark_object (Lisp_Object arg)
break;
default:
- abort ();
+ emacs_abort ();
}
#undef CHECK_LIVE
@@ -6247,7 +5950,7 @@ survives_gc_p (Lisp_Object obj)
break;
default:
- abort ();
+ emacs_abort ();
}
return survives_p || PURE_POINTER_P ((void *) XPNTR (obj));
@@ -6685,21 +6388,14 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
#ifdef ENABLE_CHECKING
-# include <execinfo.h>
-
bool suppress_checking;
void
die (const char *msg, const char *file, int line)
{
- enum { NPOINTERS_MAX = 500 };
- void *buffer[NPOINTERS_MAX];
- int npointers;
fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n",
file, line, msg);
- npointers = backtrace (buffer, NPOINTERS_MAX);
- backtrace_symbols_fd (buffer, npointers, STDERR_FILENO);
- abort ();
+ fatal_error_backtrace (SIGABRT, INT_MAX);
}
#endif
@@ -6725,12 +6421,6 @@ init_alloc_once (void)
init_strings ();
init_vectors ();
-#ifdef REL_ALLOC
- malloc_hysteresis = 32;
-#else
- malloc_hysteresis = 0;
-#endif
-
refill_memory_reserve ();
gc_cons_threshold = GC_DEFAULT_THRESHOLD;
}
diff --git a/src/atimer.c b/src/atimer.c
index eb3136ae55..5dbd807872 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -17,9 +17,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/>. */
#include <config.h>
-#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "syssignal.h"
#include "systime.h"
@@ -41,7 +40,7 @@ static struct atimer *stopped_atimers;
static struct atimer *atimers;
-/* Non-zero means alarm_signal_handler has found ripe timers but
+/* Non-zero means alarm signal handler has found ripe timers but
interrupt_input_blocked was non-zero. In this case, timer
functions are not called until the next UNBLOCK_INPUT because timer
functions are expected to call X, and X cannot be assumed to be
@@ -51,8 +50,24 @@ int pending_atimers;
/* Block/unblock SIGALRM. */
-#define BLOCK_ATIMERS sigblock (sigmask (SIGALRM))
-#define UNBLOCK_ATIMERS sigunblock (sigmask (SIGALRM))
+static void
+sigmask_atimers (int how)
+{
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGALRM);
+ pthread_sigmask (how, &blocked, 0);
+}
+static void
+block_atimers (void)
+{
+ sigmask_atimers (SIG_BLOCK);
+}
+static void
+unblock_atimers (void)
+{
+ sigmask_atimers (SIG_UNBLOCK);
+}
/* Function prototypes. */
@@ -60,8 +75,6 @@ static void set_alarm (void);
static void schedule_atimer (struct atimer *);
static struct atimer *append_atimer_lists (struct atimer *,
struct atimer *);
-static void alarm_signal_handler (int signo);
-
/* Start a new atimer of type TYPE. TIME specifies when the timer is
ripe. FN is the function to call when the timer fires.
@@ -111,7 +124,7 @@ start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn,
t->fn = fn;
t->client_data = client_data;
- BLOCK_ATIMERS;
+ block_atimers ();
/* Compute the timer's expiration time. */
switch (type)
@@ -132,7 +145,7 @@ start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn,
/* Insert the timer in the list of active atimers. */
schedule_atimer (t);
- UNBLOCK_ATIMERS;
+ unblock_atimers ();
/* Arrange for a SIGALRM at the time the next atimer is ripe. */
set_alarm ();
@@ -148,7 +161,7 @@ cancel_atimer (struct atimer *timer)
{
int i;
- BLOCK_ATIMERS;
+ block_atimers ();
for (i = 0; i < 2; ++i)
{
@@ -175,7 +188,7 @@ cancel_atimer (struct atimer *timer)
}
}
- UNBLOCK_ATIMERS;
+ unblock_atimers ();
}
@@ -206,7 +219,7 @@ append_atimer_lists (struct atimer *list_1, struct atimer *list_2)
void
stop_other_atimers (struct atimer *t)
{
- BLOCK_ATIMERS;
+ block_atimers ();
if (t)
{
@@ -231,7 +244,7 @@ stop_other_atimers (struct atimer *t)
stopped_atimers = append_atimer_lists (atimers, stopped_atimers);
atimers = t;
- UNBLOCK_ATIMERS;
+ unblock_atimers ();
}
@@ -246,7 +259,7 @@ run_all_atimers (void)
struct atimer *t = atimers;
struct atimer *next;
- BLOCK_ATIMERS;
+ block_atimers ();
atimers = stopped_atimers;
stopped_atimers = NULL;
@@ -257,7 +270,7 @@ run_all_atimers (void)
t = next;
}
- UNBLOCK_ATIMERS;
+ unblock_atimers ();
}
}
@@ -356,7 +369,6 @@ run_timers (void)
if (! atimers)
pending_atimers = 0;
-#ifdef SYNC_INPUT
if (pending_atimers)
pending_signals = 1;
else
@@ -364,42 +376,36 @@ run_timers (void)
pending_signals = interrupt_input_pending;
set_alarm ();
}
-#else
- if (! pending_atimers)
- set_alarm ();
-#endif
}
/* Signal handler for SIGALRM. SIGNO is the signal number, i.e.
SIGALRM. */
-void
-alarm_signal_handler (int signo)
+static void
+handle_alarm_signal (int sig)
{
-#ifndef SYNC_INPUT
- SIGNAL_THREAD_CHECK (signo);
-#endif
-
pending_atimers = 1;
-#ifdef SYNC_INPUT
pending_signals = 1;
-#else
- run_timers ();
-#endif
+}
+
+static void
+deliver_alarm_signal (int sig)
+{
+ handle_on_main_thread (sig, handle_alarm_signal);
}
-/* Call alarm_signal_handler for pending timers. */
+/* Call alarm signal handler for pending timers. */
void
do_pending_atimers (void)
{
if (pending_atimers)
{
- BLOCK_ATIMERS;
+ block_atimers ();
run_timers ();
- UNBLOCK_ATIMERS;
+ unblock_atimers ();
}
}
@@ -412,7 +418,9 @@ turn_on_atimers (bool on)
{
if (on)
{
- signal (SIGALRM, alarm_signal_handler);
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_alarm_signal);
+ sigaction (SIGALRM, &action, 0);
set_alarm ();
}
else
@@ -423,8 +431,10 @@ turn_on_atimers (bool on)
void
init_atimer (void)
{
+ struct sigaction action;
free_atimers = stopped_atimers = atimers = NULL;
pending_atimers = 0;
/* pending_signals is initialized in init_keyboard.*/
- signal (SIGALRM, alarm_signal_handler);
+ emacs_sigaction_init (&action, deliver_alarm_signal);
+ sigaction (SIGALRM, &action, 0);
}
diff --git a/src/bidi.c b/src/bidi.c
index 6b3ac53d31..af0209565e 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -56,7 +56,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
@@ -105,7 +104,7 @@ bidi_get_type (int ch, bidi_dir_t override)
if (ch == BIDI_EOB)
return NEUTRAL_B;
if (ch < 0 || ch > MAX_CHAR)
- abort ();
+ emacs_abort ();
default_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch));
/* Every valid character code, even those that are unassigned by the
@@ -113,7 +112,7 @@ bidi_get_type (int ch, bidi_dir_t override)
DerivedBidiClass.txt file. Therefore, if we ever get UNKNOWN_BT
(= zero) code from CHAR_TABLE_REF, that's a bug. */
if (default_type == UNKNOWN_BT)
- abort ();
+ emacs_abort ();
if (override == NEUTRAL_DIR)
return default_type;
@@ -141,7 +140,7 @@ bidi_get_type (int ch, bidi_dir_t override)
else if (override == R2L)
return STRONG_R;
else
- abort (); /* can't happen: handled above */
+ emacs_abort (); /* can't happen: handled above */
}
}
}
@@ -183,7 +182,7 @@ bidi_get_category (bidi_type_t type)
case NEUTRAL_ON:
return NEUTRAL;
default:
- abort ();
+ emacs_abort ();
}
}
@@ -199,7 +198,7 @@ bidi_mirror_char (int c)
if (c == BIDI_EOB)
return c;
if (c < 0 || c > MAX_CHAR)
- abort ();
+ emacs_abort ();
val = CHAR_TABLE_REF (bidi_mirror_table, c);
if (INTEGERP (val))
@@ -215,7 +214,7 @@ bidi_mirror_char (int c)
/* Minimal test we must do in optimized builds, to prevent weird
crashes further down the road. */
if (v < 0 || v > MAX_CHAR)
- abort ();
+ emacs_abort ();
return v;
}
@@ -373,7 +372,7 @@ bidi_cache_fetch_state (ptrdiff_t idx, struct bidi_it *bidi_it)
int current_scan_dir = bidi_it->scan_dir;
if (idx < bidi_cache_start || idx >= bidi_cache_idx)
- abort ();
+ emacs_abort ();
bidi_copy_it (bidi_it, &bidi_cache[idx]);
bidi_it->scan_dir = current_scan_dir;
@@ -518,7 +517,7 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, bool resolved)
/* We should never cache on backward scans. */
if (bidi_it->scan_dir == -1)
- abort ();
+ emacs_abort ();
idx = bidi_cache_search (bidi_it->charpos, -1, 1);
if (idx < 0)
@@ -537,7 +536,7 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, bool resolved)
idx = bidi_cache_start;
}
if (bidi_it->nchars <= 0)
- abort ();
+ emacs_abort ();
bidi_copy_it (&bidi_cache[idx], bidi_it);
if (!resolved)
bidi_cache[idx].resolved_level = -1;
@@ -592,7 +591,7 @@ static inline int
bidi_peek_at_next_level (struct bidi_it *bidi_it)
{
if (bidi_cache_idx == bidi_cache_start || bidi_cache_last_idx == -1)
- abort ();
+ emacs_abort ();
return bidi_cache[bidi_cache_last_idx + bidi_it->scan_dir].resolved_level;
}
@@ -612,7 +611,7 @@ bidi_push_it (struct bidi_it *bidi_it)
/* Save the current iterator state in its entirety after the last
used cache slot. */
bidi_cache_ensure_space (bidi_cache_idx);
- memcpy (&bidi_cache[bidi_cache_idx++], bidi_it, sizeof (struct bidi_it));
+ bidi_cache[bidi_cache_idx++] = *bidi_it;
/* Push the current cache start onto the stack. */
eassert (bidi_cache_sp < IT_STACK_SIZE);
@@ -629,18 +628,18 @@ void
bidi_pop_it (struct bidi_it *bidi_it)
{
if (bidi_cache_start <= 0)
- abort ();
+ emacs_abort ();
/* Reset the next free cache slot index to what it was before the
call to bidi_push_it. */
bidi_cache_idx = bidi_cache_start - 1;
/* Restore the bidi iterator state saved in the cache. */
- memcpy (bidi_it, &bidi_cache[bidi_cache_idx], sizeof (struct bidi_it));
+ *bidi_it = bidi_cache[bidi_cache_idx];
/* Pop the previous cache start from the stack. */
if (bidi_cache_sp <= 0)
- abort ();
+ emacs_abort ();
bidi_cache_start = bidi_cache_start_stack[--bidi_cache_sp];
/* Invalidate the last-used cache slot data. */
@@ -762,12 +761,12 @@ bidi_initialize (void)
{
bidi_type_table = uniprop_table (intern ("bidi-class"));
if (NILP (bidi_type_table))
- abort ();
+ emacs_abort ();
staticpro (&bidi_type_table);
bidi_mirror_table = uniprop_table (intern ("mirroring"));
if (NILP (bidi_mirror_table))
- abort ();
+ emacs_abort ();
staticpro (&bidi_mirror_table);
Qparagraph_start = intern ("paragraph-start");
@@ -885,7 +884,7 @@ bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg,
else
{
if (!CHAR_HEAD_P (*p))
- abort ();
+ emacs_abort ();
while (pos < end)
{
@@ -965,7 +964,7 @@ bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos,
/* We don't expect to find ourselves in the middle of a display
property. Hopefully, it will never be needed. */
if (charpos > *disp_pos)
- abort ();
+ emacs_abort ();
/* Text covered by `display' properties and overlays with
display properties or display strings is handled as a single
character that represents the entire run of characters
@@ -995,7 +994,7 @@ bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos,
}
*nchars = disp_end_pos - *disp_pos;
if (*nchars <= 0)
- abort ();
+ emacs_abort ();
if (string->s)
*ch_len = bidi_count_bytes (string->s, *disp_pos, bytepos,
disp_end_pos, string->unibyte);
@@ -1160,7 +1159,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
dir = L2R;
/* We should never be called at EOB or before BEGV. */
else if (bidi_it->charpos >= end || bytepos < begbyte)
- abort ();
+ emacs_abort ();
if (dir == L2R)
{
@@ -1298,7 +1297,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
&& no_default_p && bidi_it->paragraph_dir == NEUTRAL_DIR);
}
else
- abort ();
+ emacs_abort ();
/* Contrary to UAX#9 clause P3, we only default the paragraph
direction to L2R if we have no previous usable paragraph
@@ -1325,7 +1324,7 @@ bidi_explicit_dir_char (int ch)
bidi_type_t ch_type;
if (!bidi_initialized)
- abort ();
+ emacs_abort ();
ch_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch));
return (ch_type == LRE || ch_type == LRO
|| ch_type == RLE || ch_type == RLO
@@ -1378,10 +1377,10 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it)
/* Advance to the next character, skipping characters covered by
display strings (nchars > 1). */
if (bidi_it->nchars <= 0)
- abort ();
+ emacs_abort ();
bidi_it->charpos += bidi_it->nchars;
if (bidi_it->ch_len == 0)
- abort ();
+ emacs_abort ();
bidi_it->bytepos += bidi_it->ch_len;
}
@@ -1581,7 +1580,7 @@ bidi_resolve_explicit (struct bidi_it *bidi_it)
}
if (bidi_it->nchars <= 0)
- abort ();
+ emacs_abort ();
if (level == prev_level) /* empty embedding */
saved_it.ignore_bn_limit = bidi_it->charpos + bidi_it->nchars;
else /* this embedding is non-empty */
@@ -1644,7 +1643,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it)
|| type == RLE
|| type == RLO
|| type == PDF)
- abort ();
+ emacs_abort ();
if (new_level != prev_level
|| bidi_it->type == NEUTRAL_B)
@@ -1685,7 +1684,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it)
else if (bidi_it->sor == L2R)
type = STRONG_L;
else /* shouldn't happen! */
- abort ();
+ emacs_abort ();
}
if (type == WEAK_EN /* W2 */
&& bidi_it->last_strong.type_after_w1 == STRONG_AL)
@@ -1767,7 +1766,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it)
: bidi_it->string.s);
if (bidi_it->nchars <= 0)
- abort ();
+ emacs_abort ();
next_char
= (bidi_it->charpos + bidi_it->nchars >= eob
? BIDI_EOB
@@ -1875,7 +1874,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
|| type == NEUTRAL_S
|| type == NEUTRAL_WS
|| type == NEUTRAL_ON))
- abort ();
+ emacs_abort ();
if ((type != NEUTRAL_B /* Don't risk entering the long loop below if
we are already at paragraph end. */
@@ -1930,7 +1929,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
bidi_type_t next_type;
if (bidi_it->scan_dir == -1)
- abort ();
+ emacs_abort ();
bidi_copy_it (&saved_it, bidi_it);
/* Scan the text forward until we find the first non-neutral
@@ -1979,7 +1978,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
break;
case WEAK_BN:
if (!bidi_explicit_dir_char (bidi_it->ch))
- abort (); /* can't happen: BNs are skipped */
+ emacs_abort (); /* can't happen: BNs are skipped */
/* FALLTHROUGH */
case NEUTRAL_B:
/* Marched all the way to the end of this level run.
@@ -1998,7 +1997,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
}
break;
default:
- abort ();
+ emacs_abort ();
}
type = bidi_resolve_neutral_1 (saved_it.prev_for_neutral.type,
next_type, current_level);
@@ -2023,7 +2022,7 @@ bidi_type_of_next_char (struct bidi_it *bidi_it)
/* This should always be called during a forward scan. */
if (bidi_it->scan_dir != 1)
- abort ();
+ emacs_abort ();
/* Reset the limit until which to ignore BNs if we step out of the
area where we found only empty levels. */
@@ -2107,7 +2106,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
if (bidi_it->scan_dir > 0)
{
if (bidi_it->nchars <= 0)
- abort ();
+ emacs_abort ();
next_char_pos = bidi_it->charpos + bidi_it->nchars;
}
else if (bidi_it->charpos >= bob)
@@ -2143,7 +2142,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
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 ();
+ emacs_abort ();
if (type == UNKNOWN_BT)
type = bidi_type_of_next_char (bidi_it);
@@ -2156,7 +2155,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
|| (type == WEAK_BN && prev_level == level))
{
if (bidi_it->next_for_neutral.type == UNKNOWN_BT)
- abort ();
+ emacs_abort ();
/* If the cached state shows a neutral character, it was not
resolved by bidi_resolve_neutral, so do it now. */
@@ -2170,7 +2169,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
|| type == WEAK_BN
|| type == WEAK_EN
|| type == WEAK_AN))
- abort ();
+ emacs_abort ();
bidi_it->type = type;
bidi_check_type (bidi_it->type);
@@ -2192,7 +2191,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
int dpp = bidi_it->disp_prop;
if (bidi_it->nchars <= 0)
- abort ();
+ emacs_abort ();
do {
ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, &dpp, &bs,
fwp, &clen, &nc);
@@ -2301,8 +2300,9 @@ bidi_find_other_level_edge (struct bidi_it *bidi_it, int level, bool end_flag)
{
int new_level;
+ /* If we are at end of level, its edges must be cached. */
if (end_flag)
- abort (); /* if we are at end of level, its edges must be cached */
+ emacs_abort ();
bidi_cache_iterator_state (bidi_it, 1);
do {
@@ -2320,7 +2320,7 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
struct gcpro gcpro1;
if (bidi_it->charpos < 0 || bidi_it->bytepos < 0)
- abort ();
+ emacs_abort ();
if (bidi_it->scan_dir == 0)
{
@@ -2431,7 +2431,7 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
= bidi_at_paragraph_end (bidi_it->charpos + bidi_it->nchars,
bidi_it->bytepos + bidi_it->ch_len);
if (bidi_it->nchars <= 0)
- abort ();
+ emacs_abort ();
if (sep_len >= 0)
{
bidi_it->new_paragraph = 1;
diff --git a/src/blockinput.h b/src/blockinput.h
index dc02919cf4..7501bfc91a 100644
--- a/src/blockinput.h
+++ b/src/blockinput.h
@@ -67,15 +67,10 @@ extern int pending_atimers;
If doing signal-driven input, and a signal came in when input was
blocked, reinvoke the signal handler now to deal with it.
- We used to have two possible definitions of this macro - one for
- when SIGIO was #defined, and one for when it wasn't; when SIGIO
- wasn't #defined, we wouldn't bother to check if we should re-invoke
- the signal handler. But that doesn't work very well; some of the
- files which use this macro don't #include the right files to get
- SIGIO.
-
- So, we always test interrupt_input_pending now; that's not too
- expensive, and it'll never get set if we don't need to resignal. */
+ Always test interrupt_input_pending; that's not too expensive, and
+ it'll never get set if we don't need to resignal. This is simpler
+ than dealing here with every configuration option that might affect
+ whether interrupt_input_pending can be nonzero. */
#define UNBLOCK_INPUT \
do \
@@ -89,7 +84,7 @@ extern int pending_atimers;
do_pending_atimers (); \
} \
else if (interrupt_input_blocked < 0) \
- abort (); \
+ emacs_abort (); \
} \
while (0)
@@ -124,4 +119,3 @@ extern int pending_atimers;
extern void reinvoke_input_signal (void);
#endif /* EMACS_BLOCKINPUT_H */
-
diff --git a/src/buffer.c b/src/buffer.c
index 0e2e50d9f5..b020edb996 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -26,7 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/param.h>
#include <errno.h>
#include <stdio.h>
-#include <setjmp.h>
#include <unistd.h>
#include <verify.h>
@@ -44,7 +43,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "keymap.h"
#include "frame.h"
-struct buffer *current_buffer; /* the current buffer */
+struct buffer *current_buffer; /* The current buffer. */
/* First buffer in chain of all buffers (in reverse order of creation).
Threaded through ->header.next.buffer. */
@@ -60,10 +59,6 @@ struct buffer *all_buffers;
struct buffer alignas (GCALIGNMENT) buffer_defaults;
-/* A Lisp_Object pointer to the above, used for staticpro */
-
-static Lisp_Object Vbuffer_defaults;
-
/* This structure marks which slots in a buffer have corresponding
default values in buffer_defaults.
Each such slot has a nonzero value in this structure.
@@ -78,18 +73,15 @@ static Lisp_Object Vbuffer_defaults;
and the corresponding slot in buffer_defaults is not used.
If a slot in this structure corresponding to a DEFVAR_PER_BUFFER is
- zero, that is a bug */
+ zero, that is a bug. */
struct buffer buffer_local_flags;
/* This structure holds the names of symbols whose values may be
- buffer-local. It is indexed and accessed in the same way as the above. */
+ buffer-local. It is indexed and accessed in the same way as the above. */
struct buffer alignas (GCALIGNMENT) 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. */
@@ -115,7 +107,7 @@ static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay,
static void swap_out_buffer_local_variables (struct buffer *b);
static void reset_buffer_local_variables (struct buffer *, bool);
-/* Alist of all buffer names vs the buffers. */
+/* Alist of all buffer names vs the buffers. */
/* This used to be a variable, but is no longer,
to prevent lossage due to user rplac'ing this alist or its elements. */
Lisp_Object Vbuffer_alist;
@@ -134,7 +126,7 @@ static Lisp_Object Qpermanent_local_hook;
static Lisp_Object Qprotected_field;
-static Lisp_Object QSFundamental; /* A string "Fundamental" */
+static Lisp_Object QSFundamental; /* A string "Fundamental". */
static Lisp_Object Qkill_buffer_hook;
static Lisp_Object Qbuffer_list_update_hook;
@@ -395,7 +387,7 @@ DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0,
Value is nil if OBJECT is not a buffer or if it has been killed. */)
(Lisp_Object object)
{
- return ((BUFFERP (object) && ! NILP (BVAR (XBUFFER (object), name)))
+ return ((BUFFERP (object) && BUFFER_LIVE_P (XBUFFER (object)))
? Qt : Qnil);
}
@@ -595,10 +587,6 @@ even if it is dead. The return value is never nil. */)
bset_width_table (b, Qnil);
b->prevent_redisplay_optimizations_p = 1;
- /* Put this on the chain of all buffers including killed ones. */
- b->header.next.buffer = all_buffers;
- all_buffers = b;
-
/* An ordinary buffer normally doesn't need markers
to handle BEGV and ZV. */
bset_pt_marker (b, Qnil);
@@ -787,7 +775,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
base_buffer = Fget_buffer (base_buffer);
if (NILP (base_buffer))
error ("No such buffer: `%s'", SDATA (tem));
- if (NILP (BVAR (XBUFFER (base_buffer), name)))
+ if (!BUFFER_LIVE_P (XBUFFER (base_buffer)))
error ("Base buffer has been killed");
if (SCHARS (name) == 0)
@@ -819,10 +807,6 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
b->width_run_cache = 0;
bset_width_table (b, Qnil);
- /* Put this on the chain of all buffers including killed ones. */
- b->header.next.buffer = all_buffers;
- all_buffers = b;
-
name = Fcopy_sequence (name);
set_string_intervals (name, NULL);
bset_name (b, name);
@@ -1242,7 +1226,7 @@ buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer)
result = Fdefault_value (variable);
break;
}
- default: abort ();
+ default: emacs_abort ();
}
return result;
@@ -1568,7 +1552,7 @@ exists, return the buffer `*scratch*' (creating it if necessary). */)
{
buf = XCAR (tail);
if (BUFFERP (buf) && !EQ (buf, buffer)
- && !NILP (BVAR (XBUFFER (buf), name))
+ && BUFFER_LIVE_P (XBUFFER (buf))
&& (SREF (BVAR (XBUFFER (buf), name), 0) != ' ')
/* If the frame has a buffer_predicate, disregard buffers that
don't fit the predicate. */
@@ -1588,7 +1572,7 @@ exists, return the buffer `*scratch*' (creating it if necessary). */)
{
buf = Fcdr (XCAR (tail));
if (BUFFERP (buf) && !EQ (buf, buffer)
- && !NILP (BVAR (XBUFFER (buf), name))
+ && BUFFER_LIVE_P (XBUFFER (buf))
&& (SREF (BVAR (XBUFFER (buf), name), 0) != ' ')
/* If the frame has a buffer_predicate, disregard buffers that
don't fit the predicate. */
@@ -1630,7 +1614,7 @@ other_buffer_safely (Lisp_Object buffer)
{
buf = Fcdr (XCAR (tail));
if (BUFFERP (buf) && !EQ (buf, buffer)
- && !NILP (BVAR (XBUFFER (buf), name))
+ && BUFFER_LIVE_P (XBUFFER (buf))
&& (SREF (BVAR (XBUFFER (buf), name), 0) != ' '))
return buf;
}
@@ -1749,7 +1733,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
b = XBUFFER (buffer);
/* Avoid trouble for buffer already dead. */
- if (NILP (BVAR (b, name)))
+ if (!BUFFER_LIVE_P (b))
return Qnil;
/* Query if the buffer is still modified. */
@@ -1785,7 +1769,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
}
/* If the hooks have killed the buffer, exit now. */
- if (NILP (BVAR (b, name)))
+ if (!BUFFER_LIVE_P (b))
return Qt;
/* We have no more questions to ask. Verify that it is valid
@@ -1817,7 +1801,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
UNGCPRO;
/* Exit if we now have killed the base buffer (Bug#11665). */
- if (NILP (BVAR (b, name)))
+ if (!BUFFER_LIVE_P (b))
return Qt;
}
@@ -1828,7 +1812,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
replace_buffer_in_windows (buffer);
/* Exit if replacing the buffer in windows has killed our buffer. */
- if (NILP (BVAR (b, name)))
+ if (!BUFFER_LIVE_P (b))
return Qt;
/* Make this buffer not be current. Exit if it is the sole visible
@@ -1861,7 +1845,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
/* Killing buffer processes may run sentinels which may have killed
our buffer. */
- if (NILP (BVAR (b, name)))
+ if (!BUFFER_LIVE_P (b))
return Qt;
/* These may run Lisp code and into infinite loops (if someone
@@ -1893,7 +1877,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
}
/* Deleting an auto-save file could have killed our buffer. */
- if (NILP (BVAR (b, name)))
+ if (!BUFFER_LIVE_P (b))
return Qt;
if (b->base_buffer)
@@ -2062,7 +2046,7 @@ the current buffer's major mode. */)
CHECK_BUFFER (buffer);
- if (NILP (BVAR (XBUFFER (buffer), name)))
+ if (!BUFFER_LIVE_P (XBUFFER (buffer)))
error ("Attempt to set major mode for a dead buffer");
if (strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0)
@@ -2198,7 +2182,7 @@ ends when the current command terminates. Use `switch-to-buffer' or
buffer = Fget_buffer (buffer_or_name);
if (NILP (buffer))
nsberror (buffer_or_name);
- if (NILP (BVAR (XBUFFER (buffer), name)))
+ if (!BUFFER_LIVE_P (XBUFFER (buffer)))
error ("Selecting deleted buffer");
set_buffer_internal (XBUFFER (buffer));
return buffer;
@@ -2209,7 +2193,7 @@ ends when the current command terminates. Use `switch-to-buffer' or
Lisp_Object
set_buffer_if_live (Lisp_Object buffer)
{
- if (! NILP (BVAR (XBUFFER (buffer), name)))
+ if (BUFFER_LIVE_P (XBUFFER (buffer)))
set_buffer_internal (XBUFFER (buffer));
return Qnil;
}
@@ -2304,7 +2288,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
CHECK_BUFFER (buffer);
other_buffer = XBUFFER (buffer);
- if (NILP (BVAR (other_buffer, name)))
+ if (!BUFFER_LIVE_P (other_buffer))
error ("Cannot swap a dead buffer's text");
/* Actually, it probably works just fine.
@@ -2671,7 +2655,7 @@ current buffer is cleared. */)
/* Make sure no markers were put on the chain
while the chain value was incorrect. */
if (BUF_MARKERS (current_buffer))
- abort ();
+ emacs_abort ();
BUF_MARKERS (current_buffer) = markers;
@@ -2700,7 +2684,7 @@ current buffer is cleared. */)
/* Copy this buffer's new multibyte status
into all of its indirect buffers. */
FOR_EACH_BUFFER (other)
- if (other->base_buffer == current_buffer && !NILP (BVAR (other, name)))
+ if (other->base_buffer == current_buffer && BUFFER_LIVE_P (other))
{
BVAR (other, enable_multibyte_characters)
= BVAR (current_buffer, enable_multibyte_characters);
@@ -3413,7 +3397,7 @@ overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr)
}
}
if (p != overlay_str_buf + total)
- abort ();
+ emacs_abort ();
if (pstr)
*pstr = overlay_str_buf;
return total;
@@ -4073,6 +4057,26 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
return unbind_to (count, Qnil);
}
+
+DEFUN ("delete-all-overlays", Fdelete_all_overlays, Sdelete_all_overlays, 0, 1, 0,
+ doc: /* Delete all overlays of BUFFER.
+BUFFER omitted or nil means delete all overlays of the current
+buffer. */)
+ (Lisp_Object buffer)
+{
+ register struct buffer *buf;
+
+ if (NILP (buffer))
+ buf = current_buffer;
+ else
+ {
+ CHECK_BUFFER (buffer);
+ buf = XBUFFER (buffer);
+ }
+
+ delete_all_overlays (buf);
+ return Qnil;
+}
/* Overlay dissection functions. */
@@ -4576,7 +4580,7 @@ buffer_slot_type_mismatch (Lisp_Object newval, int type)
case_Lisp_Int: predicate = Qintegerp; break;
case Lisp_String: predicate = Qstringp; break;
case Lisp_Symbol: predicate = Qsymbolp; break;
- default: abort ();
+ default: emacs_abort ();
}
wrong_type_argument (predicate, newval);
@@ -5125,10 +5129,11 @@ init_buffer_once (void)
buffer_local_symbols.indirections = 0;
set_buffer_intervals (&buffer_defaults, NULL);
set_buffer_intervals (&buffer_local_symbols, NULL);
+ /* This is not strictly necessary, but let's make them initialized. */
+ bset_name (&buffer_defaults, build_pure_c_string (" *buffer-defaults*"));
+ bset_name (&buffer_local_symbols, build_pure_c_string (" *buffer-local-symbols*"));
XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize);
- XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize);
- XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols);
/* Set up the default values of various buffer slots. */
/* Must do these before making the first buffer! */
@@ -5257,7 +5262,7 @@ init_buffer_once (void)
/* Need more room? */
if (idx >= MAX_PER_BUFFER_VARS)
- abort ();
+ emacs_abort ();
last_per_buffer_idx = idx;
Vbuffer_alist = Qnil;
@@ -5398,7 +5403,7 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
if (PER_BUFFER_IDX (offset) == 0)
/* Did a DEFVAR_PER_BUFFER without initializing the corresponding
slot of buffer_local_flags */
- abort ();
+ emacs_abort ();
}
@@ -5410,8 +5415,6 @@ syms_of_buffer (void)
last_overlay_modification_hooks
= Fmake_vector (make_number (10), Qnil);
- staticpro (&Vbuffer_defaults);
- staticpro (&Vbuffer_local_symbols);
staticpro (&Qfundamental_mode);
staticpro (&Qmode_class);
staticpro (&QSFundamental);
@@ -6286,6 +6289,7 @@ and `bury-buffer-internal'. */);
defsubr (&Soverlayp);
defsubr (&Smake_overlay);
defsubr (&Sdelete_overlay);
+ defsubr (&Sdelete_all_overlays);
defsubr (&Smove_overlay);
defsubr (&Soverlay_start);
defsubr (&Soverlay_end);
diff --git a/src/buffer.h b/src/buffer.h
index 3acf142381..d18ef30ea3 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -959,7 +959,10 @@ bset_width_table (struct buffer *b, Lisp_Object val)
b->INTERNAL_FIELD (width_table) = val;
}
-
+/* Convenient check whether buffer B is live. */
+
+#define BUFFER_LIVE_P(b) (!NILP (BVAR (b, name)))
+
/* Chain of all buffers, including killed ones. */
extern struct buffer *all_buffers;
@@ -1149,7 +1152,7 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos)
We assume you know which buffer it's pointing into. */
#define OVERLAY_POSITION(P) \
- (MARKERP (P) ? marker_position (P) : (abort (), 0))
+ (MARKERP (P) ? marker_position (P) : (emacs_abort (), 0))
/***********************************************************************
@@ -1189,7 +1192,7 @@ extern int last_per_buffer_idx;
#define PER_BUFFER_VALUE_P(B, IDX) \
(((IDX) < 0 || IDX >= last_per_buffer_idx) \
- ? (abort (), 0) \
+ ? (emacs_abort (), 0) \
: ((B)->local_flags[IDX] != 0))
/* Set whether per-buffer variable with index IDX has a buffer-local
@@ -1198,7 +1201,7 @@ extern int last_per_buffer_idx;
#define SET_PER_BUFFER_VALUE_P(B, IDX, VAL) \
do { \
if ((IDX) < 0 || (IDX) >= last_per_buffer_idx) \
- abort (); \
+ emacs_abort (); \
(B)->local_flags[IDX] = (VAL); \
} while (0)
diff --git a/src/bytecode.c b/src/bytecode.c
index 40729cbd45..5f4fdcc5ef 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -33,7 +33,7 @@ by Hallvard:
*/
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
@@ -435,7 +435,7 @@ unmark_byte_stack (void)
#ifdef BYTE_CODE_SAFE
#define CHECK_RANGE(ARG) \
- if (ARG >= bytestr_length) abort ()
+ if (ARG >= bytestr_length) emacs_abort ()
#else /* not BYTE_CODE_SAFE */
@@ -458,7 +458,8 @@ unmark_byte_stack (void)
Fsignal (Qquit, Qnil); \
AFTER_POTENTIAL_GC (); \
} \
- ELSE_PENDING_SIGNALS \
+ else if (pending_signals) \
+ process_pending_signals (); \
} while (0)
@@ -508,7 +509,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
if (FRAME_X_P (f)
&& FRAME_FONT (f)->direction != 0
&& FRAME_FONT (f)->direction != 1)
- abort ();
+ emacs_abort ();
}
#endif
@@ -600,9 +601,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
{
#ifdef BYTE_CODE_SAFE
if (top > stacke)
- abort ();
+ emacs_abort ();
else if (top < stack.bottom - 1)
- abort ();
+ emacs_abort ();
#endif
#ifdef BYTE_CODE_METER
@@ -1875,7 +1876,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
/* Actually this is Bstack_ref with offset 0, but we use Bdup
for that instead. */
/* CASE (Bstack_ref): */
- abort ();
+ emacs_abort ();
/* Handy byte-codes for lexical binding. */
CASE (Bstack_ref1):
@@ -1928,11 +1929,11 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
#ifdef BYTE_CODE_SAFE
if (op < Bconstant)
{
- abort ();
+ emacs_abort ();
}
if ((op -= Bconstant) >= const_length)
{
- abort ();
+ emacs_abort ();
}
PUSH (vectorp[op]);
#else
@@ -1951,7 +1952,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
#ifdef BYTE_CODE_SAFE
error ("binding stack not balanced (serious byte compiler bug)");
#else
- abort ();
+ emacs_abort ();
#endif
return result;
diff --git a/src/callint.c b/src/callint.c
index b11545ddea..c4c087e83d 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
diff --git a/src/callproc.c b/src/callproc.c
index 2e9a895070..2604d295f3 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -19,10 +19,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <signal.h>
#include <errno.h>
#include <stdio.h>
-#include <setjmp.h>
#include <sys/types.h>
#include <unistd.h>
@@ -498,17 +496,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
register char **save_environ = environ;
register int fd1 = fd[1];
int fd_error = fd1;
-#ifdef HAVE_WORKING_VFORK
- sigset_t procmask;
- sigset_t blocked;
- struct sigaction sigpipe_action;
-#endif
if (fd_output >= 0)
fd1 = fd_output;
-#if 0 /* Some systems don't have sigblock. */
- mask = sigblock (sigmask (SIGCHLD));
-#endif
/* Record that we're about to create a synchronous process. */
synch_process_alive = 1;
@@ -592,17 +582,6 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
0, current_dir);
#else /* not WINDOWSNT */
-#ifdef HAVE_WORKING_VFORK
- /* On many hosts (e.g. Solaris 2.4), if a vforked child calls `signal',
- this sets the parent's signal handlers as well as the child's.
- So delay all interrupts whose handlers the child might munge,
- and record the current handlers so they can be restored later. */
- sigemptyset (&blocked);
- sigaddset (&blocked, SIGPIPE);
- sigaction (SIGPIPE, 0, &sigpipe_action);
- pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
-#endif
-
BLOCK_INPUT;
/* vfork, and prevent local vars from being clobbered by the vfork. */
@@ -650,9 +629,6 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
/* GConf causes us to ignore SIGPIPE, make sure it is restored
in the child. */
signal (SIGPIPE, SIG_DFL);
-#ifdef HAVE_WORKING_VFORK
- pthread_sigmask (SIG_SETMASK, &procmask, 0);
-#endif
child_setup (filefd, fd1, fd_error, (char **) new_argv,
0, current_dir);
@@ -660,12 +636,6 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
UNBLOCK_INPUT;
-#ifdef HAVE_WORKING_VFORK
- /* Restore the signal state. */
- sigaction (SIGPIPE, &sigpipe_action, 0);
- pthread_sigmask (SIG_SETMASK, &procmask, 0);
-#endif
-
#endif /* not WINDOWSNT */
/* The MSDOS case did this already. */
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 1102054b15..e365462757 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -19,7 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
diff --git a/src/casetab.c b/src/casetab.c
index 3e22d0d0b7..a84bc9202d 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
diff --git a/src/category.c b/src/category.c
index 80dc6938d8..01a6f54ad1 100644
--- a/src/category.c
+++ b/src/category.c
@@ -32,7 +32,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define CATEGORY_INLINE EXTERN_INLINE
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
#include "buffer.h"
diff --git a/src/ccl.c b/src/ccl.c
index dd37934451..34cc1c98ee 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -26,7 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <limits.h>
#include "lisp.h"
diff --git a/src/character.c b/src/character.c
index cfaaf8eeca..def1ad090f 100644
--- a/src/character.c
+++ b/src/character.c
@@ -36,7 +36,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef emacs
#include <sys/types.h>
-#include <setjmp.h>
#include <intprops.h>
#include "lisp.h"
#include "character.h"
@@ -541,7 +540,7 @@ multibyte_chars_in_text (const unsigned char *ptr, ptrdiff_t nbytes)
int len = MULTIBYTE_LENGTH (ptr, endp);
if (len == 0)
- abort ();
+ emacs_abort ();
ptr += len;
chars++;
}
diff --git a/src/charset.c b/src/charset.c
index 0673790e91..d8c38e5ea3 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -32,7 +32,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <limits.h>
#include <sys/types.h>
-#include <setjmp.h>
#include <c-ctype.h>
#include "lisp.h"
#include "character.h"
@@ -636,7 +635,7 @@ load_charset (struct charset *charset, int control_flag)
else
{
if (! CHARSET_UNIFIED_P (charset))
- abort ();
+ emacs_abort ();
map = CHARSET_UNIFY_MAP (charset);
}
if (STRINGP (map))
@@ -2025,10 +2024,10 @@ CH in the charset. */)
c = XFASTINT (ch);
charset = CHAR_CHARSET (c);
if (! charset)
- abort ();
+ emacs_abort ();
code = ENCODE_CHAR (charset, c);
if (code == CHARSET_INVALID_CODE (charset))
- abort ();
+ emacs_abort ();
dimension = CHARSET_DIMENSION (charset);
for (val = Qnil; dimension > 0; dimension--)
{
diff --git a/src/chartab.c b/src/chartab.c
index c14df0ebac..e864514e33 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "charset.h"
diff --git a/src/cm.c b/src/cm.c
index 1922cd8140..eda6430baf 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "frame.h"
@@ -119,7 +118,7 @@ cmcheckmagic (struct tty_display_info *tty)
if (curX (tty) == FrameCols (tty))
{
if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1)
- abort ();
+ emacs_abort ();
if (tty->termscript)
putc ('\r', tty->termscript);
putc ('\r', tty->output);
diff --git a/src/cmds.c b/src/cmds.c
index 90d3cd6dce..45f7df948a 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -19,7 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "commands.h"
#include "character.h"
diff --git a/src/coding.c b/src/coding.c
index 02e7b34695..4b3d22f956 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -285,7 +285,6 @@ encode_coding_XXX (struct coding_system *coding)
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
@@ -2051,7 +2050,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
break;
default:
- abort ();
+ emacs_abort ();
}
CODING_DECODE_CHAR (coding, src, src_base, src_end,
CHARSET_FROM_ID (charset_ID), code, c);
@@ -2345,7 +2344,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
int i;
if (charbuf_end - charbuf < cmp_status->length)
- abort ();
+ emacs_abort ();
for (i = 0; i < cmp_status->length; i++)
*charbuf++ = cmp_status->carryover[i];
coding->annotated = 1;
@@ -2619,7 +2618,7 @@ encode_coding_emacs_mule (struct coding_system *coding)
preferred_charset_id = -1;
break;
default:
- abort ();
+ emacs_abort ();
}
charbuf += -c - 1;
continue;
@@ -3482,7 +3481,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
if (cmp_status->state != COMPOSING_NO)
{
if (charbuf_end - charbuf < cmp_status->length)
- abort ();
+ emacs_abort ();
for (i = 0; i < cmp_status->length; i++)
*charbuf++ = cmp_status->carryover[i];
coding->annotated = 1;
@@ -3864,7 +3863,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
break;
default:
- abort ();
+ emacs_abort ();
}
if (cmp_status->state == COMPOSING_NO
@@ -4419,7 +4418,7 @@ encode_coding_iso_2022 (struct coding_system *coding)
preferred_charset_id = -1;
break;
default:
- abort ();
+ emacs_abort ();
}
charbuf += -c - 1;
continue;
@@ -4933,7 +4932,7 @@ encode_coding_sjis (struct coding_system *coding)
}
}
if (code == CHARSET_INVALID_CODE (charset))
- abort ();
+ emacs_abort ();
if (charset == charset_kanji)
{
int c1, c2;
@@ -5023,7 +5022,7 @@ encode_coding_big5 (struct coding_system *coding)
}
}
if (code == CHARSET_INVALID_CODE (charset))
- abort ();
+ emacs_abort ();
if (charset == charset_big5)
{
int c1, c2;
@@ -7190,7 +7189,7 @@ handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit,
*buf++ = XINT (XCAR (components));
}
else
- abort ();
+ emacs_abort ();
*head -= len;
}
}
@@ -9428,7 +9427,7 @@ usage: (set-coding-system-priority &rest coding-systems) */)
&& changed[coding_priorities[j]])
j++;
if (j == coding_category_max)
- abort ();
+ emacs_abort ();
priorities[i] = coding_priorities[j];
}
diff --git a/src/composite.c b/src/composite.c
index eddabb66d3..ae46df0a57 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -26,7 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define COMPOSITE_INLINE EXTERN_INLINE
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
#include "buffer.h"
diff --git a/src/composite.h b/src/composite.h
index 68f5b27ee4..9462b932c6 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -113,7 +113,7 @@ extern Lisp_Object composition_temp;
&& (end - start) == COMPOSITION_LENGTH (prop))
/* Return the Nth glyph of composition specified by CMP. CMP is a
- pointer to `struct composition'. */
+ pointer to `struct composition'. */
#define COMPOSITION_GLYPH(cmp, n) \
XINT (XVECTOR (XVECTOR (XHASH_TABLE (composition_hash_table) \
->key_and_value) \
diff --git a/src/conf_post.h b/src/conf_post.h
index 8bd66be2c4..53fc941f46 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -40,11 +40,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif
#endif
-#ifdef SIGNAL_H_AHB
-#undef SIGNAL_H_AHB
-#include <signal.h>
-#endif
-
/* This silences a few compilation warnings on FreeBSD. */
#ifdef BSD_SYSTEM_AHB
#undef BSD_SYSTEM_AHB
@@ -95,7 +90,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
char *_getpty();
#endif
-#undef SA_RESTART /* not the same as defining BROKEN_SA_RESTART */
#endif /* IRIX6_5 */
#ifdef MSDOS
@@ -138,22 +132,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
#endif
#endif /* MSDOS */
-#ifdef USG5_4
-/* 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. */
-#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>
-#endif
-#endif /* USG5_4 */
-
/* Mac OS X / GNUstep need a bit more pure memory. Of the existing knobs,
SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */
#ifdef HAVE_NS
@@ -181,7 +159,7 @@ extern void _DebPrint (const char *fmt, ...);
#ifdef emacs /* Don't do this for lib-src. */
/* Tell regex.c to use a type compatible with Emacs. */
#define RE_TRANSLATE_TYPE Lisp_Object
-#define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C)
+#define RE_TRANSLATE(TBL, C) char_table_translate (TBL, C)
#ifdef make_number
/* If make_number is a macro, use it. */
#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0)))
@@ -192,9 +170,6 @@ extern void _DebPrint (const char *fmt, ...);
#endif
#include <string.h>
-/* If you think about removing the line below, note that the
- MS-Windows build relies on it for declaration of 'environ' needed
- by a few source files. */
#include <stdlib.h>
#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
diff --git a/src/data.c b/src/data.c
index d8b7f42ea3..72d7c8ccf9 100644
--- a/src/data.c
+++ b/src/data.c
@@ -19,9 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
#include <intprops.h>
@@ -37,17 +35,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "keymap.h"
#include <float.h>
-/* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */
-#ifndef IEEE_FLOATING_POINT
#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
&& FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)
#define IEEE_FLOATING_POINT 1
#else
#define IEEE_FLOATING_POINT 0
#endif
-#endif
-
-#include <math.h>
Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound;
static Lisp_Object Qsubr;
@@ -77,8 +70,8 @@ Lisp_Object Qchar_table_p, Qvector_or_char_table_p;
Lisp_Object Qcdr;
static Lisp_Object Qad_advice_info, Qad_activate_internal;
-Lisp_Object Qrange_error, Qdomain_error, Qsingularity_error;
-Lisp_Object Qoverflow_error, Qunderflow_error;
+static Lisp_Object Qdomain_error, Qsingularity_error, Qunderflow_error;
+Lisp_Object Qrange_error, Qoverflow_error;
Lisp_Object Qfloatp;
Lisp_Object Qnumberp, Qnumber_or_marker_p;
@@ -108,7 +101,7 @@ wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value)
to try and do that by checking the tagbits, but nowadays all
tagbits are potentially valid. */
/* if ((unsigned int) XTYPE (value) >= Lisp_Type_Limit)
- * abort (); */
+ * emacs_abort (); */
xsignal2 (Qwrong_type_argument, predicate, value);
}
@@ -182,7 +175,7 @@ for example, (type-of 1) returns `integer'. */)
case Lisp_Misc_Float:
return Qfloat;
}
- abort ();
+ emacs_abort ();
case Lisp_Vectorlike:
if (WINDOW_CONFIGURATIONP (object))
@@ -217,7 +210,7 @@ for example, (type-of 1) returns `integer'. */)
return Qfloat;
default:
- abort ();
+ emacs_abort ();
}
}
@@ -551,7 +544,7 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0,
/* In set_internal, we un-forward vars when their value is
set to Qunbound. */
return Qt;
- default: abort ();
+ default: emacs_abort ();
}
return (EQ (valcontents, Qunbound) ? Qnil : Qt);
@@ -864,7 +857,7 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents)
don't think anything will break. --lorentey */
return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset
+ (char *)FRAME_KBOARD (SELECTED_FRAME ()));
- default: abort ();
+ default: emacs_abort ();
}
}
@@ -950,12 +943,14 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
break;
default:
- abort (); /* goto def; */
+ emacs_abort (); /* goto def; */
}
}
-/* Set up SYMBOL to refer to its global binding.
- This makes it safe to alter the status of other bindings. */
+/* Set up SYMBOL to refer to its global binding. This makes it safe
+ to alter the status of other bindings. BEWARE: this may be called
+ during the mark phase of GC, where we assume that Lisp_Object slots
+ of BLV are marked after this function has changed them. */
void
swap_in_global_binding (struct Lisp_Symbol *symbol)
@@ -1014,7 +1009,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
else
{
tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist));
- XSETBUFFER (blv->where, current_buffer);
+ set_blv_where (blv, Fcurrent_buffer ());
}
}
if (!(blv->found = !NILP (tem1)))
@@ -1055,7 +1050,7 @@ find_symbol_value (Lisp_Object symbol)
/* FALLTHROUGH */
case SYMBOL_FORWARDED:
return do_symval_forwarding (SYMBOL_FWD (sym));
- default: abort ();
+ default: emacs_abort ();
}
}
@@ -1168,7 +1163,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
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). */
+ /* 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.
@@ -1265,7 +1260,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
store_symval_forwarding (/* sym, */ innercontents, newval, buf);
break;
}
- default: abort ();
+ default: emacs_abort ();
}
return;
}
@@ -1316,7 +1311,7 @@ default_value (Lisp_Object symbol)
/* For other variables, get the current value. */
return do_symval_forwarding (valcontents);
}
- default: abort ();
+ default: emacs_abort ();
}
}
@@ -1414,7 +1409,7 @@ for this variable. */)
else
return Fset (symbol, value);
}
- default: abort ();
+ default: emacs_abort ();
}
}
@@ -1538,7 +1533,7 @@ The function `default-value' gets the default value and `set-default' sets it.
else if (BUFFER_OBJFWDP (valcontents.fwd))
return variable;
break;
- default: abort ();
+ default: emacs_abort ();
}
if (sym->constant)
@@ -1611,7 +1606,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
error ("Symbol %s may not be buffer-local",
SDATA (SYMBOL_NAME (variable)));
break;
- default: abort ();
+ default: emacs_abort ();
}
if (sym->constant)
@@ -1718,7 +1713,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
if (blv->frame_local)
return variable;
break;
- default: abort ();
+ default: emacs_abort ();
}
/* Get rid of this buffer's alist element, if any. */
@@ -1800,7 +1795,7 @@ frame-local bindings). */)
error ("Symbol %s may not be frame-local",
SDATA (SYMBOL_NAME (variable)));
break;
- default: abort ();
+ default: emacs_abort ();
}
if (sym->constant)
@@ -1877,18 +1872,18 @@ BUFFER defaults to the current buffer. */)
}
return Qnil;
}
- default: abort ();
+ default: emacs_abort ();
}
}
DEFUN ("local-variable-if-set-p", Flocal_variable_if_set_p, Slocal_variable_if_set_p,
1, 2, 0,
- doc: /* Non-nil if VARIABLE will be local in buffer BUFFER when set there.
-More precisely, this means that setting the variable \(with `set' or`setq'),
-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. */)
+ doc: /* Non-nil if VARIABLE is local in buffer BUFFER when set there.
+BUFFER defaults to the current buffer.
+
+More precisely, return non-nil if either VARIABLE already has a local
+value in BUFFER, or if VARIABLE is automatically buffer-local (see
+`make-variable-buffer-local'). */)
(register Lisp_Object variable, Lisp_Object buffer)
{
struct Lisp_Symbol *sym;
@@ -1912,7 +1907,7 @@ BUFFER defaults to the current buffer. */)
case SYMBOL_FORWARDED:
/* All BUFFER_OBJFWD slots become local if they are set. */
return (BUFFER_OBJFWDP (SYMBOL_FWD (sym)) ? Qt : Qnil);
- default: abort ();
+ default: emacs_abort ();
}
}
@@ -1956,7 +1951,7 @@ If the current binding is global (the default), the value is nil. */)
return SYMBOL_BLV (sym)->where;
else
return Qnil;
- default: abort ();
+ default: emacs_abort ();
}
}
@@ -2272,7 +2267,7 @@ arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
return Qnil;
default:
- abort ();
+ emacs_abort ();
}
}
@@ -2738,28 +2733,6 @@ Both must be integers or markers. */)
return val;
}
-#ifndef HAVE_FMOD
-double
-fmod (double f1, double f2)
-{
- double r = f1;
-
- if (f2 < 0.0)
- f2 = -f2;
-
- /* If the magnitude of the result exceeds that of the divisor, or
- the sign of the result does not agree with that of the dividend,
- iterate with the reduced value. This does not yield a
- particularly accurate result, but at least it will be in the
- range promised by fmod. */
- do
- r -= f2 * floor (r / f2);
- while (f2 <= (r < 0 ? -r : r) || ((r < 0) != (f1 < 0) && ! isnan (r)));
-
- return r;
-}
-#endif /* ! HAVE_FMOD */
-
DEFUN ("mod", Fmod, Smod, 2, 2, 0,
doc: /* Return X modulo Y.
The result falls between zero (inclusive) and Y (exclusive).
@@ -3207,21 +3180,23 @@ syms_of_data (void)
XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1;
}
-#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD
-_Noreturn
-#endif
-static void
-arith_error (int signo)
+static _Noreturn void
+handle_arith_signal (int sig)
{
- sigsetmask (SIGEMPTYMASK);
-
- SIGNAL_THREAD_CHECK (signo);
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
xsignal0 (Qarith_error);
}
+static void
+deliver_arith_signal (int sig)
+{
+ handle_on_main_thread (sig, handle_arith_signal);
+}
+
void
init_data (void)
{
+ struct sigaction action;
/* Don't do this if just dumping out.
We don't want to call `signal' in this case
so that we don't have trouble with dumping
@@ -3230,5 +3205,6 @@ init_data (void)
if (!initialized)
return;
#endif /* CANNOT_DUMP */
- signal (SIGFPE, arith_error);
+ emacs_sigaction_init (&action, deliver_arith_signal);
+ sigaction (SIGFPE, &action, 0);
}
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 901820648c..c2eefd605b 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -21,7 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_DBUS
#include <stdio.h>
#include <dbus/dbus.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "frame.h"
#include "termhooks.h"
diff --git a/src/dired.c b/src/dired.c
index fa29325810..3aa27ecf92 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <setjmp.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
@@ -275,7 +274,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
/* Some bug somewhere. */
if (nchars > nbytes)
- abort ();
+ emacs_abort ();
STRING_SET_CHARS (fullname, nchars);
if (nchars == nbytes)
diff --git a/src/dispextern.h b/src/dispextern.h
index 1aff547f18..5acfe6b5ca 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3055,7 +3055,7 @@ void move_it_in_display_line (struct it *it,
int in_display_vector_p (struct it *);
int frame_mode_line_height (struct frame *);
extern Lisp_Object Qtool_bar;
-extern int redisplaying_p;
+extern bool redisplaying_p;
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;
@@ -3193,6 +3193,7 @@ void unrequest_sigio (void);
int tabs_safe_p (int);
void init_baud_rate (int);
void init_sigio (int);
+void ignore_sigio (void);
/* Defined in xfaces.c */
@@ -3251,9 +3252,12 @@ void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
extern Lisp_Object tip_frame;
extern Window tip_window;
+extern frame_parm_handler x_frame_parm_handlers[];
+
extern void start_hourglass (void);
extern void cancel_hourglass (void);
extern int hourglass_shown_p;
+
struct atimer; /* Defined in atimer.h. */
/* If non-null, an asynchronous timer that, when it expires, displays
an hourglass cursor on all frames. */
diff --git a/src/dispnew.c b/src/dispnew.c
index cac4c2da4c..5827316a7b 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -21,9 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define DISPEXTERN_INLINE EXTERN_INLINE
-#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
#include <unistd.h>
#include "lisp.h"
@@ -297,7 +295,7 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history,
void
__executable_start (void)
{
- abort ();
+ emacs_abort ();
}
#endif
@@ -347,7 +345,7 @@ free_glyph_matrix (struct glyph_matrix *matrix)
/* Detect the case that more matrices are freed than were
allocated. */
if (--glyph_matrix_count < 0)
- abort ();
+ emacs_abort ();
/* Free glyph memory if MATRIX owns it. */
if (matrix->pool == NULL)
@@ -2339,9 +2337,9 @@ check_glyph_memory (void)
/* Check that nothing is left allocated. */
if (glyph_matrix_count)
- abort ();
+ emacs_abort ();
if (glyph_pool_count)
- abort ();
+ emacs_abort ();
}
@@ -3024,7 +3022,7 @@ check_matrix_pointers (struct glyph_matrix *window_matrix,
{
if (!glyph_row_slice_p (window_matrix->rows + i,
frame_matrix->rows + j))
- abort ();
+ emacs_abort ();
++i, ++j;
}
}
@@ -3453,7 +3451,7 @@ check_current_matrix_flags (struct window *w)
if (!last_seen_p && MATRIX_ROW_BOTTOM_Y (row) >= yb)
last_seen_p = 1;
else if (last_seen_p && row->enabled_p)
- abort ();
+ emacs_abort ();
}
}
@@ -3952,6 +3950,11 @@ update_window_line (struct window *w, int vpos, bool *mouse_face_overwritten_p)
{
changed_p = 1;
update_marginal_area (w, LEFT_MARGIN_AREA, vpos);
+ /* Setting this flag will ensure the vertical border, if
+ any, between this window and the one on its left will be
+ redrawn. This is necessary because updating the left
+ margin area can potentially draw over the border. */
+ current_row->redraw_fringe_bitmaps_p = 1;
}
/* Update the display of the text area. */
@@ -4809,7 +4812,7 @@ scrolling (struct frame *frame)
struct glyph_matrix *desired_matrix = frame->desired_matrix;
if (!current_matrix)
- abort ();
+ emacs_abort ();
/* Compute hash codes of all the lines. Also calculate number of
changed lines, number of unchanged lines at the beginning, and
@@ -5477,7 +5480,7 @@ marginal_area_string (struct window *w, enum window_part part,
else if (part == ON_RIGHT_MARGIN)
area = RIGHT_MARGIN_AREA;
else
- abort ();
+ emacs_abort ();
for (i = 0; row->enabled_p && i < w->current_matrix->nrows; ++i, ++row)
if (wy >= row->y && wy < MATRIX_ROW_BOTTOM_Y (row))
@@ -5552,17 +5555,17 @@ marginal_area_string (struct window *w, enum window_part part,
#ifdef SIGWINCH
+static void deliver_window_change_signal (int);
+
static void
-window_change_signal (int signalnum) /* If we don't have an argument, */
- /* some compilers complain in signal calls. */
+handle_window_change_signal (int sig)
{
int width, height;
- int old_errno = errno;
-
struct tty_display_info *tty;
- signal (SIGWINCH, window_change_signal);
- SIGNAL_THREAD_CHECK (signalnum);
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_window_change_signal);
+ sigaction (SIGWINCH, &action, 0);
/* The frame size change obviously applies to a single
termcap-controlled terminal, but we can't decide which.
@@ -5591,8 +5594,12 @@ window_change_signal (int signalnum) /* If we don't have an argument, */
change_frame_size (XFRAME (frame), height, width, 0, 1, 0);
}
}
+}
- errno = old_errno;
+static void
+deliver_window_change_signal (int sig)
+{
+ handle_on_main_thread (sig, handle_window_change_signal);
}
#endif /* SIGWINCH */
@@ -5604,7 +5611,7 @@ window_change_signal (int signalnum) /* If we don't have an argument, */
void
do_pending_window_change (bool safe)
{
- /* If window_change_signal should have run before, run it now. */
+ /* If window change signal handler should have run before, run it now. */
if (redisplaying_p && !safe)
return;
@@ -5963,7 +5970,7 @@ sit_for (Lisp_Object timeout, bool reading, int do_display)
wrong_type_argument (Qnumberp, timeout);
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
gobble_input (0);
#endif
@@ -6173,7 +6180,11 @@ init_display (void)
#ifndef CANNOT_DUMP
if (initialized)
#endif /* CANNOT_DUMP */
- signal (SIGWINCH, window_change_signal);
+ {
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_window_change_signal);
+ sigaction (SIGWINCH, &action, 0);
+ }
#endif /* SIGWINCH */
/* If running as a daemon, no need to initialize any frames/terminal. */
@@ -6277,7 +6288,7 @@ init_display (void)
/* Convert the initial frame to use the new display. */
if (f->output_method != output_initial)
- abort ();
+ emacs_abort ();
f->output_method = t->type;
f->terminal = t;
diff --git a/src/doc.c b/src/doc.c
index b4eadfff87..d2d664df26 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/types.h>
#include <sys/file.h> /* Must be after sys/types.h for USG*/
-#include <setjmp.h>
#include <fcntl.h>
#include <unistd.h>
@@ -37,7 +36,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
Lisp_Object Qfunction_documentation;
-extern Lisp_Object Qclosure;
/* Buffer used for reading from documentation file. */
static char *get_doc_string_buffer;
static ptrdiff_t get_doc_string_buffer_size;
diff --git a/src/doprnt.c b/src/doprnt.c
index b36e946005..caa56d6ae8 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -102,7 +102,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <float.h>
#include <unistd.h>
#include <limits.h>
@@ -114,10 +113,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
another macro. */
#include "character.h"
-#ifndef DBL_MAX_10_EXP
-#define DBL_MAX_10_EXP 308 /* IEEE double */
-#endif
-
/* Generate output from a format-spec FORMAT,
terminated at position FORMAT_END.
(*FORMAT_END is not part of the format, but must exist and be readable.)
diff --git a/src/dosfns.c b/src/dosfns.c
index 21676f4b4f..3c649f4d53 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -30,7 +30,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <dos.h>
#undef gettime
#undef settime
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
diff --git a/src/editfns.c b/src/editfns.c
index a14e043c1b..c6744648bc 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <sys/types.h>
#include <stdio.h>
-#include <setjmp.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
@@ -2613,7 +2612,7 @@ They default to the values of (point-min) and (point-max) in BUFFER. */)
if (NILP (buf))
nsberror (buffer);
bp = XBUFFER (buf);
- if (NILP (BVAR (bp, name)))
+ if (!BUFFER_LIVE_P (bp))
error ("Selecting deleted buffer");
if (NILP (start))
@@ -2677,7 +2676,7 @@ determines whether case is significant or ignored. */)
if (NILP (buf1))
nsberror (buffer1);
bp1 = XBUFFER (buf1);
- if (NILP (BVAR (bp1, name)))
+ if (!BUFFER_LIVE_P (bp1))
error ("Selecting deleted buffer");
}
@@ -2715,7 +2714,7 @@ determines whether case is significant or ignored. */)
if (NILP (buf2))
nsberror (buffer2);
bp2 = XBUFFER (buf2);
- if (NILP (BVAR (bp2, name)))
+ if (!BUFFER_LIVE_P (bp2))
error ("Selecting deleted buffer");
}
@@ -2783,8 +2782,8 @@ determines whether case is significant or ignored. */)
if (!NILP (trt))
{
- c1 = CHAR_TABLE_TRANSLATE (trt, c1);
- c2 = CHAR_TABLE_TRANSLATE (trt, c2);
+ c1 = char_table_translate (trt, c1);
+ c2 = char_table_translate (trt, c2);
}
if (c1 < c2)
return make_number (- 1 - chars);
@@ -4263,7 +4262,7 @@ usage: (format STRING &rest OBJECTS) */)
}
if (bufsize < p - buf)
- abort ();
+ emacs_abort ();
if (maybe_combine_byte)
nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf);
@@ -4603,7 +4602,7 @@ Transposing beyond buffer boundaries is an error. */)
len1_byte, end2, start2_byte + len2_byte)
|| count_combining_after (BYTE_POS_ADDR (start1_byte),
len1_byte, end2, start2_byte + len2_byte))
- abort ();
+ emacs_abort ();
}
else
{
@@ -4615,7 +4614,7 @@ Transposing beyond buffer boundaries is an error. */)
len2_byte, end1, start1_byte + len1_byte)
|| count_combining_after (BYTE_POS_ADDR (start1_byte),
len1_byte, end2, start2_byte + len2_byte))
- abort ();
+ emacs_abort ();
}
#endif
diff --git a/src/emacs.c b/src/emacs.c
index 7b643f5226..80d536a5c1 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -20,13 +20,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <signal.h>
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/file.h>
-#include <setjmp.h>
#include <unistd.h>
#include "lisp.h"
@@ -101,15 +99,15 @@ extern void moncontrol (int mode);
#endif
static const char emacs_version[] = VERSION;
-static const char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundation, Inc.";
+static const char emacs_copyright[] = COPYRIGHT;
/* Empty lisp strings. To avoid having to build any others. */
Lisp_Object empty_unibyte_string, empty_multibyte_string;
-/* Set nonzero after Emacs has started up the first time.
- Prevents reinitialization of the Lisp world and keymaps
- on subsequent starts. */
-int initialized;
+/* Set after Emacs has started up the first time.
+ Prevents reinitialization of the Lisp world and keymaps
+ on subsequent starts. */
+bool initialized;
#ifdef DARWIN_OS
extern void unexec_init_emacs_zone (void);
@@ -123,9 +121,9 @@ static void *malloc_state_ptr;
extern void *malloc_get_state (void);
/* From glibc, a routine that overwrites the malloc internal state. */
extern int malloc_set_state (void*);
-/* Non-zero if the MALLOC_CHECK_ environment variable was set while
+/* True if the MALLOC_CHECK_ environment variable was set while
dumping. Used to work around a bug in glibc's malloc. */
-static int malloc_using_checking;
+static bool malloc_using_checking;
#endif
Lisp_Object Qfile_name_handler_alist;
@@ -134,17 +132,17 @@ Lisp_Object Qrisky_local_variable;
Lisp_Object Qkill_emacs;
-/* If non-zero, Emacs should not attempt to use a window-specific code,
+/* If true, 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;
+bool inhibit_window_system;
-/* If non-zero, a filter or a sentinel is running. Tested to save the match
+/* If true, a filter or a sentinel is running. Tested to save the match
data on the first attempt to change it inside asynchronous code. */
-int running_asynch_code;
+bool running_asynch_code;
#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
-/* If non-zero, -d was specified, meaning we're using some window system. */
-int display_arg;
+/* If true, -d was specified, meaning we're using some window system. */
+bool display_arg;
#endif
/* An address near the bottom of the stack.
@@ -177,11 +175,11 @@ static uprintmax_t heap_bss_diff;
# define DAEMON_MUST_EXEC
#endif
-/* Nonzero means running Emacs without interactive terminal. */
-int noninteractive;
+/* True means running Emacs without interactive terminal. */
+bool noninteractive;
-/* Nonzero means remove site-lisp directories from load-path. */
-int no_site_lisp;
+/* True means remove site-lisp directories from load-path. */
+bool no_site_lisp;
/* Name for the server started by the daemon.*/
static char *daemon_name;
@@ -299,16 +297,8 @@ section of the Emacs manual or the file BUGS.\n"
/* Signal code for the fatal signal that was received. */
static int fatal_error_code;
-/* Nonzero if handling a fatal error already. */
-int fatal_error_in_progress;
-
-#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
-/* When compiled with GTK and running under Gnome,
- multiple threads may be created. Keep track of our main
- thread to make sure signals are delivered to it (see syssignal.h). */
-
-pthread_t main_thread;
-#endif
+/* True if handling a fatal error already. */
+bool fatal_error_in_progress;
#ifdef HAVE_NS
/* NS autrelease pool, for memory management. */
@@ -318,13 +308,23 @@ static void *ns_pool;
/* Handle bus errors, invalid instruction, etc. */
-#ifndef FLOAT_CATCH_SIGILL
-static
-#endif
-void
-fatal_error_signal (int sig)
+static void
+handle_fatal_signal (int sig)
+{
+ fatal_error_backtrace (sig, 10);
+}
+
+static void
+deliver_fatal_signal (int sig)
+{
+ handle_on_main_thread (sig, handle_fatal_signal);
+}
+
+/* Report a fatal error due to signal SIG, output a backtrace of at
+ most BACKTRACE_LIMIT lines, and exit. */
+_Noreturn void
+fatal_error_backtrace (int sig, int backtrace_limit)
{
- SIGNAL_THREAD_CHECK (sig);
fatal_error_code = sig;
signal (sig, SIG_DFL);
@@ -338,7 +338,8 @@ fatal_error_signal (int sig)
if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT)
Fkill_emacs (make_number (sig));
- shut_down_emacs (sig, 0, Qnil);
+ shut_down_emacs (sig, Qnil);
+ emacs_backtrace (backtrace_limit);
}
/* Signal the same code; this time it will really be fatal.
@@ -346,43 +347,44 @@ fatal_error_signal (int sig)
going to send is probably blocked, so we have to unblock it if we
want to really receive it. */
#ifndef MSDOS
- sigunblock (sigmask (fatal_error_code));
+ {
+ sigset_t unblocked;
+ sigemptyset (&unblocked);
+ sigaddset (&unblocked, fatal_error_code);
+ pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
+ }
#endif
kill (getpid (), fatal_error_code);
+
+ /* This shouldn't be executed, but it prevents a warning. */
+ exit (1);
}
#ifdef SIGDANGER
/* Handler for SIGDANGER. */
-void
-memory_warning_signal (int sig)
+static void deliver_danger_signal (int);
+
+static void
+handle_danger_signal (int sig)
{
- signal (sig, memory_warning_signal);
- SIGNAL_THREAD_CHECK (sig);
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_danger_signal);
+ sigaction (sig, &action, 0);
malloc_warning ("Operating system warns that virtual memory is running low.\n");
/* It might be unsafe to call do_auto_save now. */
force_auto_save_soon ();
}
-#endif
-
-/* We define abort, rather than using it from the library,
- so that GDB can return from a breakpoint here.
- MSDOS has its own definition in msdos.c. */
-#if ! defined (DOS_NT) && ! defined (NO_ABORT)
-
-void
-abort (void)
+static void
+deliver_danger_signal (int sig)
{
- kill (getpid (), SIGABRT);
- /* This shouldn't be executed, but it prevents a warning. */
- exit (1);
+ handle_on_main_thread (sig, handle_danger_signal);
}
#endif
-
/* Code for dealing with Lisp access to the Unix command line. */
@@ -595,7 +597,7 @@ DEFINE_DUMMY_FUNCTION (__main)
Too bad we can't just use getopt for all of this, but we don't have
enough information to do it right. */
-static int
+static bool
argmatch (char **argv, int argc, const char *sstr, const char *lstr,
int minlen, char **valptr, int *skipptr)
{
@@ -702,18 +704,19 @@ main (int argc, char **argv)
Lisp_Object dummy;
#endif
char stack_bottom_variable;
- int do_initial_setlocale;
+ bool do_initial_setlocale;
int skip_args = 0;
#ifdef HAVE_SETRLIMIT
struct rlimit rlim;
#endif
- int no_loadup = 0;
+ bool no_loadup = 0;
char *junk = 0;
char *dname_arg = 0;
#ifdef DAEMON_MUST_EXEC
char dname_arg2[80];
#endif /* DAEMON_MUST_EXEC */
char *ch_to_dir;
+ struct sigaction fatal_error_action;
#if GC_MARK_STACK
stack_base = &dummy;
@@ -872,20 +875,12 @@ main (int argc, char **argv)
/* Arrange to get warning messages as memory fills up. */
memory_warnings (0, malloc_warning);
- /* Call malloc at least once, to run the initial __malloc_hook.
+ /* Call malloc at least once, to run malloc_initialize_hook.
Also call realloc and free for consistency. */
free (realloc (malloc (4), 4));
-# ifndef SYNC_INPUT
- /* Arrange to disable interrupt input inside malloc etc. */
- uninterrupt_malloc ();
-# endif /* not SYNC_INPUT */
#endif /* not SYSTEM_MALLOC */
-#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
- main_thread = pthread_self ();
-#endif /* FORWARD_SIGNAL_TO_MAIN_THREAD */
-
#if defined (MSDOS) || defined (WINDOWSNT)
/* We do all file input/output as binary files. When we need to translate
newlines, we do that manually. */
@@ -1132,6 +1127,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
}
init_signals ();
+ emacs_sigaction_init (&fatal_error_action, deliver_fatal_signal);
/* Don't catch SIGHUP if dumping. */
if (1
@@ -1140,13 +1136,17 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
#endif
)
{
- sigblock (sigmask (SIGHUP));
/* In --batch mode, don't catch SIGHUP if already ignored.
That makes nohup work. */
- if (! noninteractive
- || signal (SIGHUP, SIG_IGN) != SIG_IGN)
- signal (SIGHUP, fatal_error_signal);
- sigunblock (sigmask (SIGHUP));
+ bool catch_SIGHUP = !noninteractive;
+ if (!catch_SIGHUP)
+ {
+ struct sigaction old_action;
+ sigaction (SIGHUP, 0, &old_action);
+ catch_SIGHUP = old_action.sa_handler != SIG_IGN;
+ }
+ if (catch_SIGHUP)
+ sigaction (SIGHUP, &fatal_error_action, 0);
}
if (
@@ -1160,9 +1160,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
/* Don't catch these signals in batch mode if dumping.
On some machines, this sets static data that would make
signal fail to work right when the dumped Emacs is run. */
- signal (SIGQUIT, fatal_error_signal);
- signal (SIGILL, fatal_error_signal);
- signal (SIGTRAP, fatal_error_signal);
+ sigaction (SIGQUIT, &fatal_error_action, 0);
+ sigaction (SIGILL, &fatal_error_action, 0);
+ sigaction (SIGTRAP, &fatal_error_action, 0);
#ifdef SIGUSR1
add_user_signal (SIGUSR1, "sigusr1");
#endif
@@ -1170,68 +1170,73 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
add_user_signal (SIGUSR2, "sigusr2");
#endif
#ifdef SIGABRT
- signal (SIGABRT, fatal_error_signal);
+ sigaction (SIGABRT, &fatal_error_action, 0);
#endif
#ifdef SIGHWE
- signal (SIGHWE, fatal_error_signal);
+ sigaction (SIGHWE, &fatal_error_action, 0);
#endif
#ifdef SIGPRE
- signal (SIGPRE, fatal_error_signal);
+ sigaction (SIGPRE, &fatal_error_action, 0);
#endif
#ifdef SIGORE
- signal (SIGORE, fatal_error_signal);
+ sigaction (SIGORE, &fatal_error_action, 0);
#endif
#ifdef SIGUME
- signal (SIGUME, fatal_error_signal);
+ sigaction (SIGUME, &fatal_error_action, 0);
#endif
#ifdef SIGDLK
- signal (SIGDLK, fatal_error_signal);
+ sigaction (SIGDLK, &fatal_error_action, 0);
#endif
#ifdef SIGCPULIM
- signal (SIGCPULIM, fatal_error_signal);
+ sigaction (SIGCPULIM, &fatal_error_action, 0);
#endif
#ifdef SIGIOT
/* This is missing on some systems - OS/2, for example. */
- signal (SIGIOT, fatal_error_signal);
+ sigaction (SIGIOT, &fatal_error_action, 0);
#endif
#ifdef SIGEMT
- signal (SIGEMT, fatal_error_signal);
+ sigaction (SIGEMT, &fatal_error_action, 0);
#endif
- signal (SIGFPE, fatal_error_signal);
+ sigaction (SIGFPE, &fatal_error_action, 0);
#ifdef SIGBUS
- signal (SIGBUS, fatal_error_signal);
+ sigaction (SIGBUS, &fatal_error_action, 0);
#endif
- signal (SIGSEGV, fatal_error_signal);
+ sigaction (SIGSEGV, &fatal_error_action, 0);
#ifdef SIGSYS
- signal (SIGSYS, fatal_error_signal);
+ sigaction (SIGSYS, &fatal_error_action, 0);
#endif
/* May need special treatment on MS-Windows. See
http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html
Please update the doc of kill-emacs, kill-emacs-hook, and
NEWS if you change this.
*/
- if (noninteractive) signal (SIGINT, fatal_error_signal);
- signal (SIGTERM, fatal_error_signal);
+ if (noninteractive)
+ sigaction (SIGINT, &fatal_error_action, 0);
+ sigaction (SIGTERM, &fatal_error_action, 0);
#ifdef SIGXCPU
- signal (SIGXCPU, fatal_error_signal);
+ sigaction (SIGXCPU, &fatal_error_action, 0);
#endif
#ifdef SIGXFSZ
- signal (SIGXFSZ, fatal_error_signal);
+ sigaction (SIGXFSZ, &fatal_error_action, 0);
#endif /* SIGXFSZ */
#ifdef SIGDANGER
/* This just means available memory is getting low. */
- signal (SIGDANGER, memory_warning_signal);
+ {
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_danger_signal);
+ sigaction (SIGDANGER, &action, 0);
+ }
#endif
#ifdef AIX
/* 20 is SIGCHLD, 21 is SIGTTIN, 22 is SIGTTOU. */
- signal (SIGXCPU, fatal_error_signal);
- signal (SIGIOINT, fatal_error_signal);
- signal (SIGGRANT, fatal_error_signal);
- signal (SIGRETRACT, fatal_error_signal);
- signal (SIGSOUND, fatal_error_signal);
- signal (SIGMSG, fatal_error_signal);
+ sigaction (SIGXCPU, &fatal_error_action, 0);
+ sigaction (SIGIOINT, &fatal_error_action, 0);
+ sigaction (SIGGRANT, &fatal_error_action, 0);
+ sigaction (SIGRETRACT, &fatal_error_action, 0);
+ sigaction (SIGSOUND, &fatal_error_action, 0);
+ sigaction (SIGMSG, &fatal_error_action, 0);
#endif /* AIX */
}
@@ -1607,7 +1612,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
init_fringe ();
#endif /* HAVE_WINDOW_SYSTEM */
init_macros ();
- init_floatfns ();
init_window ();
init_font ();
@@ -1922,7 +1926,7 @@ sort_args (int argc, char **argv)
}
if (best < 0)
- abort ();
+ emacs_abort ();
/* Copy the highest priority remaining option, with its args, to NEW.
Unless it is a duplicate of the previous one. */
@@ -1985,7 +1989,7 @@ all of which are called before Emacs is actually killed. */)
x_clipboard_manager_save_all ();
#endif
- shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil);
+ shut_down_emacs (0, STRINGP (arg) ? arg : Qnil);
#ifdef HAVE_NS
ns_release_autorelease_pool (ns_pool);
@@ -2021,7 +2025,7 @@ all of which are called before Emacs is actually killed. */)
and Fkill_emacs. */
void
-shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
+shut_down_emacs (int sig, Lisp_Object stuff)
{
/* Prevent running of hooks from now on. */
Vrun_hooks = Qnil;
@@ -2038,7 +2042,7 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
{
reset_all_sys_modes ();
if (sig && sig != SIGTERM)
- fprintf (stderr, "Fatal error (%d)", sig);
+ fprintf (stderr, "Fatal error %d: %s", sig, strsignal (sig));
}
}
#else
@@ -2056,23 +2060,10 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
unlock_all_files ();
#endif
-#if 0 /* This triggers a bug in XCloseDisplay and is not needed. */
-#ifdef HAVE_X_WINDOWS
- /* It's not safe to call intern here. Maybe we are crashing. */
- if (!noninteractive && SYMBOLP (Vinitial_window_system)
- && SCHARS (SYMBOL_NAME (Vinitial_window_system)) == 1
- && SREF (SYMBOL_NAME (Vinitial_window_system), 0) == 'x'
- && ! no_x)
- Fx_close_current_connection ();
-#endif /* HAVE_X_WINDOWS */
-#endif
-
-#ifdef SIGIO
/* There is a tendency for a SIGIO signal to arrive within exit,
and cause a SIGHUP because the input descriptor is already closed. */
unrequest_sigio ();
- signal (SIGIO, SIG_IGN);
-#endif
+ ignore_sigio ();
#ifdef WINDOWSNT
term_ntproc ();
@@ -2178,12 +2169,6 @@ You must run Emacs in batch mode in order to dump it. */)
memory_warnings (my_edata, malloc_warning);
}
#endif /* not WINDOWSNT */
-#if defined (HAVE_PTHREAD) && !defined SYNC_INPUT
- /* Pthread may call malloc before main, and then we will get an endless
- loop, because pthread_self (see alloc.c) calls malloc the first time
- it is called on some systems. */
- reset_malloc_hooks ();
-#endif
#endif /* not SYSTEM_MALLOC */
#ifdef DOUG_LEA_MALLOC
malloc_state_ptr = malloc_get_state ();
@@ -2258,7 +2243,7 @@ decode_env_path (const char *evarname, const char *defalt)
const char *path, *p;
Lisp_Object lpath, element, tem;
#ifdef WINDOWSNT
- int defaulted = 0;
+ bool defaulted = 0;
const char *emacs_dir = egetenv ("emacs_dir");
static const char *emacs_dir_env = "%emacs_dir%/";
const size_t emacs_dir_len = strlen (emacs_dir_env);
@@ -2354,7 +2339,7 @@ from the parent process and its tty file descriptors. */)
(void)
{
int nfd;
- int err = 0;
+ bool err = 0;
if (!IS_DAEMON)
error ("This function can only be called if emacs is run as a daemon");
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index 1a62b59b7a..d10185072c 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -21,13 +21,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include "emacsgtkfixed.h"
-#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "frame.h"
#include "xterm.h"
+/* Silence a bogus diagnostic; see GNOME bug 683906. */
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wunused-local-typedefs"
+#endif
+
#define EMACS_TYPE_FIXED emacs_fixed_get_type ()
#define EMACS_FIXED(obj) \
G_TYPE_CHECK_INSTANCE_CAST (obj, EMACS_TYPE_FIXED, EmacsFixed)
diff --git a/src/eval.c b/src/eval.c
index c56be10c5a..1c565e233c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <limits.h>
-#include <setjmp.h>
#include <stdio.h>
#include "lisp.h"
#include "blockinput.h"
@@ -69,7 +68,7 @@ Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp;
Lisp_Object Qinhibit_quit;
Lisp_Object Qand_rest;
static Lisp_Object Qand_optional;
-static Lisp_Object Qdebug_on_error;
+static Lisp_Object Qinhibit_debugger;
static Lisp_Object Qdeclare;
Lisp_Object Qinternal_interpreter_environment, Qclosure;
@@ -118,12 +117,6 @@ static EMACS_INT when_entered_debugger;
Lisp_Object Vsignaling_function;
-/* Set to non-zero while processing X events. Checked in Feval to
- make sure the Lisp interpreter isn't called from a signal handler,
- which is unsafe because the interpreter isn't reentrant. */
-
-int handling_signal;
-
/* If non-nil, Lisp code must not be run since some part of Emacs is
in an inconsistent state. Currently, x-create-frame uses this to
avoid triggering window-configuration-change-hook while the new
@@ -131,7 +124,7 @@ int handling_signal;
Lisp_Object inhibit_lisp_code;
static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
-static int interactive_p (int);
+static bool interactive_p (void);
static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
/* Functions to set Lisp_Object slots of struct specbinding. */
@@ -191,10 +184,10 @@ restore_stack_limits (Lisp_Object data)
/* Call the Lisp debugger, giving it argument ARG. */
-static Lisp_Object
+Lisp_Object
call_debugger (Lisp_Object arg)
{
- int debug_while_redisplaying;
+ bool debug_while_redisplaying;
ptrdiff_t count = SPECPDL_INDEX ();
Lisp_Object val;
EMACS_INT old_max = max_specpdl_size;
@@ -229,7 +222,7 @@ call_debugger (Lisp_Object arg)
specbind (intern ("debugger-may-continue"),
debug_while_redisplaying ? Qnil : Qt);
specbind (Qinhibit_redisplay, Qnil);
- specbind (Qdebug_on_error, Qnil);
+ specbind (Qinhibit_debugger, Qt);
#if 0 /* Binding this prevents execution of Lisp code during
redisplay, which necessarily leads to display problems. */
@@ -525,7 +518,7 @@ spec that specifies non-nil unconditionally (such as \"p\"); or (ii)
use `called-interactively-p'. */)
(void)
{
- return interactive_p (1) ? Qt : Qnil;
+ return interactive_p () ? Qt : Qnil;
}
@@ -550,19 +543,17 @@ non-nil unconditionally (\"p\" is a good way to do this), or via
\(not (or executing-kbd-macro noninteractive)). */)
(Lisp_Object kind)
{
- return ((INTERACTIVE || !EQ (kind, intern ("interactive")))
- && interactive_p (1)) ? Qt : Qnil;
+ return (((INTERACTIVE || !EQ (kind, intern ("interactive")))
+ && interactive_p ())
+ ? Qt : Qnil);
}
-/* Return 1 if function in which this appears was called using
- call-interactively.
+/* Return true if function in which this appears was called using
+ call-interactively and is not a built-in. */
- EXCLUDE_SUBRS_P non-zero means always return 0 if the function
- called is a built-in. */
-
-static int
-interactive_p (int exclude_subrs_p)
+static bool
+interactive_p (void)
{
struct backtrace *btp;
Lisp_Object fun;
@@ -591,9 +582,9 @@ interactive_p (int exclude_subrs_p)
/* `btp' now points at the frame of the innermost function that isn't
a special form, ignoring frames for Finteractive_p and/or
Fbytecode at the top. If this frame is for a built-in function
- (such as load or eval-region) return nil. */
+ (such as load or eval-region) return false. */
fun = Findirect_function (*btp->function, Qnil);
- if (exclude_subrs_p && SUBRP (fun))
+ if (SUBRP (fun))
return 0;
/* `btp' points to the frame of a Lisp function that called interactive-p.
@@ -709,7 +700,7 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
else
{ /* Check if there is really a global binding rather than just a let
binding that shadows the global unboundness of the var. */
- volatile struct specbinding *pdl = specpdl_ptr;
+ struct specbinding *pdl = specpdl_ptr;
while (pdl > specpdl)
{
if (EQ ((--pdl)->symbol, sym) && !pdl->func
@@ -1074,7 +1065,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object
catchlist = &c;
/* Call FUNC. */
- if (! _setjmp (c.jmp))
+ if (! sys_setjmp (c.jmp))
c.val = (*func) (arg);
/* Throw works by a longjmp that comes right here. */
@@ -1101,7 +1092,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object
static _Noreturn void
unwind_to_catch (struct catchtag *catch, Lisp_Object value)
{
- int last_time;
+ bool last_time;
/* Save the value in the tag. */
catch->val = value;
@@ -1109,7 +1100,6 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
/* Restore certain special C variables. */
set_poll_suppress_count (catch->poll_suppress_count);
UNBLOCK_INPUT_TO (catch->interrupt_input_blocked);
- handling_signal = 0;
immediate_quit = 0;
do
@@ -1142,7 +1132,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
backtrace_list = catch->backlist;
lisp_eval_depth = catch->lisp_eval_depth;
- _longjmp (catch->jmp, 1);
+ sys_longjmp (catch->jmp, 1);
}
DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0,
@@ -1206,12 +1196,9 @@ See also the function `signal' for more info.
usage: (condition-case VAR BODYFORM &rest HANDLERS) */)
(Lisp_Object args)
{
- register Lisp_Object bodyform, handlers;
- volatile Lisp_Object var;
-
- var = Fcar (args);
- bodyform = Fcar (Fcdr (args));
- handlers = Fcdr (Fcdr (args));
+ Lisp_Object var = Fcar (args);
+ Lisp_Object bodyform = Fcar (Fcdr (args));
+ Lisp_Object handlers = Fcdr (Fcdr (args));
return internal_lisp_condition_case (var, bodyform, handlers);
}
@@ -1251,7 +1238,7 @@ internal_lisp_condition_case (volatile Lisp_Object var, Lisp_Object bodyform,
c.interrupt_input_blocked = interrupt_input_blocked;
c.gcpro = gcprolist;
c.byte_stack = byte_stack_list;
- if (_setjmp (c.jmp))
+ if (sys_setjmp (c.jmp))
{
if (!NILP (h.var))
specbind (h.var, c.val);
@@ -1306,7 +1293,7 @@ internal_condition_case (Lisp_Object (*bfun) (void), Lisp_Object handlers,
c.interrupt_input_blocked = interrupt_input_blocked;
c.gcpro = gcprolist;
c.byte_stack = byte_stack_list;
- if (_setjmp (c.jmp))
+ if (sys_setjmp (c.jmp))
{
return (*hfun) (c.val);
}
@@ -1344,7 +1331,7 @@ internal_condition_case_1 (Lisp_Object (*bfun) (Lisp_Object), Lisp_Object arg,
c.interrupt_input_blocked = interrupt_input_blocked;
c.gcpro = gcprolist;
c.byte_stack = byte_stack_list;
- if (_setjmp (c.jmp))
+ if (sys_setjmp (c.jmp))
{
return (*hfun) (c.val);
}
@@ -1386,7 +1373,7 @@ internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object),
c.interrupt_input_blocked = interrupt_input_blocked;
c.gcpro = gcprolist;
c.byte_stack = byte_stack_list;
- if (_setjmp (c.jmp))
+ if (sys_setjmp (c.jmp))
{
return (*hfun) (c.val);
}
@@ -1430,7 +1417,7 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *),
c.interrupt_input_blocked = interrupt_input_blocked;
c.gcpro = gcprolist;
c.byte_stack = byte_stack_list;
- if (_setjmp (c.jmp))
+ if (sys_setjmp (c.jmp))
{
return (*hfun) (c.val, nargs, args);
}
@@ -1450,8 +1437,8 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *),
static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object);
-static int maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig,
- Lisp_Object data);
+static bool maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig,
+ Lisp_Object data);
void
process_quit_flag (void)
@@ -1492,10 +1479,10 @@ See also the function `condition-case'. */)
struct handler *h;
struct backtrace *bp;
- immediate_quit = handling_signal = 0;
+ immediate_quit = 0;
abort_on_gc = 0;
if (gc_in_progress || waiting_for_input)
- abort ();
+ emacs_abort ();
#if 0 /* rms: I don't know why this was here,
but it is surely wrong for an error that is handled. */
@@ -1556,7 +1543,7 @@ See also the function `condition-case'. */)
if requested". */
|| EQ (h->handler, Qerror)))
{
- int debugger_called
+ bool debugger_called
= maybe_call_debugger (conditions, error_symbol, data);
/* We can't return values to code which signaled an error, but we
can continue code which has signaled a quit. */
@@ -1592,7 +1579,7 @@ void
xsignal (Lisp_Object error_symbol, Lisp_Object data)
{
Fsignal (error_symbol, data);
- abort ();
+ emacs_abort ();
}
/* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */
@@ -1650,10 +1637,10 @@ signal_error (const char *s, Lisp_Object arg)
}
-/* Return nonzero if LIST is a non-nil atom or
+/* Return true if LIST is a non-nil atom or
a list containing one of CONDITIONS. */
-static int
+static bool
wants_debugger (Lisp_Object list, Lisp_Object conditions)
{
if (NILP (list))
@@ -1673,15 +1660,15 @@ wants_debugger (Lisp_Object list, Lisp_Object conditions)
return 0;
}
-/* Return 1 if an error with condition-symbols CONDITIONS,
+/* Return true if an error with condition-symbols CONDITIONS,
and described by SIGNAL-DATA, should skip the debugger
according to debugger-ignored-errors. */
-static int
+static bool
skip_debugger (Lisp_Object conditions, Lisp_Object data)
{
Lisp_Object tail;
- int first_string = 1;
+ bool first_string = 1;
Lisp_Object error_message;
error_message = Qnil;
@@ -1716,7 +1703,7 @@ skip_debugger (Lisp_Object conditions, Lisp_Object data)
= SIG is the error symbol, and DATA is the rest of the data.
= SIG is nil, and DATA is (SYMBOL . REST-OF-DATA).
This is for memory-full errors only. */
-static int
+static bool
maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data)
{
Lisp_Object combined_data;
@@ -1727,6 +1714,7 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data)
/* Don't try to run the debugger with interrupts blocked.
The editing loop would return anyway. */
! INPUT_BLOCKED_P
+ && NILP (Vinhibit_debugger)
/* Does user want to enter debugger for this kind of error? */
&& (EQ (sig, Qquit)
? debug_on_quit
@@ -2044,9 +2032,6 @@ eval_sub (Lisp_Object form)
struct backtrace backtrace;
struct gcpro gcpro1, gcpro2, gcpro3;
- if (handling_signal)
- abort ();
-
if (SYMBOLP (form))
{
/* Look up its binding in the lexical environment.
@@ -2209,7 +2194,7 @@ eval_sub (Lisp_Object form)
is supported by this code. We need to either rewrite the
subr to use a different argument protocol, or add more
cases to this switch. */
- abort ();
+ emacs_abort ();
}
}
}
@@ -2232,7 +2217,6 @@ eval_sub (Lisp_Object form)
if (EQ (funcar, Qmacro))
{
ptrdiff_t count = SPECPDL_INDEX ();
- extern Lisp_Object Qlexical_binding;
Lisp_Object exp;
/* Bind lexical-binding during expansion of the macro, so the
macro can know reliably if the code it outputs will be
@@ -2853,7 +2837,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
/* If a subr takes more than 8 arguments without using MANY
or UNEVALLED, we need to extend this function to support it.
Until this is done, there is no way to call the function. */
- abort ();
+ emacs_abort ();
}
}
}
@@ -2940,7 +2924,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
Lisp_Object val, syms_left, next, lexenv;
ptrdiff_t count = SPECPDL_INDEX ();
ptrdiff_t i;
- int optional, rest;
+ bool optional, rest;
if (CONSP (fun))
{
@@ -2984,7 +2968,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
lexenv = Qnil;
}
else
- abort ();
+ emacs_abort ();
i = optional = rest = 0;
for (; CONSP (syms_left); syms_left = XCDR (syms_left))
@@ -3110,8 +3094,6 @@ specbind (Lisp_Object symbol, Lisp_Object value)
{
struct Lisp_Symbol *sym;
- eassert (!handling_signal);
-
CHECK_SYMBOL (symbol);
sym = XSYMBOL (symbol);
if (specpdl_ptr == specpdl + specpdl_size)
@@ -3198,15 +3180,13 @@ specbind (Lisp_Object symbol, Lisp_Object value)
set_internal (symbol, value, Qnil, 1);
break;
}
- default: abort ();
+ default: emacs_abort ();
}
}
void
record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg)
{
- eassert (!handling_signal);
-
if (specpdl_ptr == specpdl + specpdl_size)
grow_specpdl ();
specpdl_ptr->func = function;
@@ -3343,13 +3323,13 @@ Output stream used is value of `standard-output'. */)
write_string ("(", -1);
if (backlist->nargs == MANY)
{ /* FIXME: Can this happen? */
- int i;
- for (tail = *backlist->args, i = 0;
- !NILP (tail);
- tail = Fcdr (tail), i = 1)
+ bool later_arg = 0;
+ for (tail = *backlist->args; !NILP (tail); tail = Fcdr (tail))
{
- if (i) write_string (" ", -1);
+ if (later_arg)
+ write_string (" ", -1);
Fprin1 (Fcar (tail), Qnil);
+ later_arg = 1;
}
}
else
@@ -3470,7 +3450,7 @@ before making `inhibit-quit' nil. */);
DEFSYM (Qinhibit_quit, "inhibit-quit");
DEFSYM (Qautoload, "autoload");
- DEFSYM (Qdebug_on_error, "debug-on-error");
+ DEFSYM (Qinhibit_debugger, "inhibit-debugger");
DEFSYM (Qmacro, "macro");
DEFSYM (Qdeclare, "declare");
@@ -3485,6 +3465,12 @@ before making `inhibit-quit' nil. */);
DEFSYM (Qclosure, "closure");
DEFSYM (Qdebug, "debug");
+ DEFVAR_LISP ("inhibit-debugger", Vinhibit_debugger,
+ doc: /* Non-nil means never enter the debugger.
+Normally set while the debugger is already active, to avoid recursive
+invocations. */);
+ Vinhibit_debugger = Qnil;
+
DEFVAR_LISP ("debug-on-error", Vdebug_on_error,
doc: /* Non-nil means enter debugger if an error is signaled.
Does not apply to errors handled by `condition-case' or those
@@ -3494,7 +3480,7 @@ if one of its condition symbols appears in the list.
When you evaluate an expression interactively, this variable
is temporarily non-nil if `eval-expression-debug-on-error' is non-nil.
The command `toggle-debug-on-error' toggles this.
-See also the variable `debug-on-quit'. */);
+See also the variable `debug-on-quit' and `inhibit-debugger'. */);
Vdebug_on_error = Qnil;
DEFVAR_LISP ("debug-ignored-errors", Vdebug_ignored_errors,
diff --git a/src/fileio.c b/src/fileio.c
index 7466914af1..ca71af7ed9 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <setjmp.h>
#include <unistd.h>
#ifdef HAVE_PWD_H
@@ -85,18 +84,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "commands.h"
-/* Nonzero during writing of auto-save files. */
-static int auto_saving;
+/* True during writing of auto-save files. */
+static bool auto_saving;
/* Nonzero umask during creation of auto-save directories. */
-static int auto_saving_dir_umask;
+static mode_t auto_saving_dir_umask;
/* Set by auto_save_1 to mode of original file so Fwrite_region will create
a new file with the same mode as the original. */
-static int auto_save_mode_bits;
+static mode_t auto_save_mode_bits;
/* Set by auto_save_1 if an error occurred during the last auto-save. */
-static int auto_save_error_occurred;
+static bool auto_save_error_occurred;
/* The symbol bound to coding-system-for-read when
insert-file-contents is called for recovering a file. This is not
@@ -145,10 +144,10 @@ Lisp_Object Qfile_name_history;
static Lisp_Object Qcar_less_than_car;
-static int a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
- Lisp_Object *, struct coding_system *);
-static int e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
- struct coding_system *);
+static bool a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
+ Lisp_Object *, struct coding_system *);
+static bool e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
+ struct coding_system *);
void
@@ -595,7 +594,7 @@ static unsigned make_temp_name_count, make_temp_name_count_initialized_p;
which has no existing file. To make this work, PREFIX should be
an absolute file name.
- BASE64_P non-zero means add the pid as 3 characters in base64
+ BASE64_P means add the pid as 3 characters in base64
encoding. In this case, 6 characters will be added to PREFIX to
form the file name. Otherwise, if Emacs is running on a system
with long file names, add the pid as a decimal number.
@@ -604,7 +603,7 @@ static unsigned make_temp_name_count, make_temp_name_count_initialized_p;
generated. */
Lisp_Object
-make_temp_name (Lisp_Object prefix, int base64_p)
+make_temp_name (Lisp_Object prefix, bool base64_p)
{
Lisp_Object val;
int len, clen;
@@ -761,8 +760,8 @@ filesystem tree, not (expand-file-name ".." dirname). */)
struct passwd *pw;
#ifdef DOS_NT
int drive = 0;
- int collapse_newdir = 1;
- int is_escaped = 0;
+ bool collapse_newdir = 1;
+ bool is_escaped = 0;
#endif /* DOS_NT */
ptrdiff_t length;
Lisp_Object handler, result, handled_name;
@@ -920,10 +919,9 @@ filesystem tree, not (expand-file-name ".." dirname). */)
/* If it turns out that the filename we want to return is just a
suffix of FILENAME, we don't need to go through and edit
things; we just need to construct a new string using data
- starting at the middle of FILENAME. If we set lose to a
- non-zero value, that means we've discovered that we can't do
- that cool trick. */
- int lose = 0;
+ starting at the middle of FILENAME. If we set LOSE, that
+ means we've discovered that we can't do that cool trick. */
+ bool lose = 0;
char *p = nm;
while (*p)
@@ -1294,7 +1292,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
if (!(IS_DIRECTORY_SEP (target[0]) && IS_DIRECTORY_SEP (target[1])))
#endif /* WINDOWSNT */
{
- if (!drive) abort ();
+ if (!drive) emacs_abort ();
target -= 2;
target[0] = DRIVE_LETTER (drive);
target[1] = ':';
@@ -1360,7 +1358,6 @@ See also the function `substitute-in-file-name'.")
ptrdiff_t tlen;
unsigned char *target;
struct passwd *pw;
- int lose;
CHECK_STRING (name);
nm = SDATA (name);
@@ -1369,8 +1366,8 @@ See also the function `substitute-in-file-name'.")
If no /./ or /../ we can return right away. */
if (nm[0] == '/')
{
+ bool lose = 0;
p = nm;
- lose = 0;
while (*p)
{
if (p[0] == '/' && p[1] == '/'
@@ -1494,7 +1491,7 @@ See also the function `substitute-in-file-name'.")
#endif
/* If /~ or // appears, discard everything through first slash. */
-static int
+static bool
file_name_absolute_p (const char *filename)
{
return
@@ -1560,12 +1557,10 @@ If `//' appears, everything up to and including the first of
those `/' is discarded. */)
(Lisp_Object filename)
{
- char *nm;
-
- register char *s, *p, *o, *x, *endp;
+ char *nm, *s, *p, *o, *x, *endp;
char *target = NULL;
int total = 0;
- int substituted = 0;
+ bool substituted = 0;
bool multibyte;
char *xnm;
Lisp_Object handler;
@@ -1780,7 +1775,7 @@ expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir)
}
/* Signal an error if the file ABSNAME already exists.
- If INTERACTIVE is nonzero, ask the user whether to proceed,
+ If INTERACTIVE, ask the user whether to proceed,
and bypass the error if the user says to go ahead.
QUERYSTRING is a name for the action that is being considered
to alter the file.
@@ -1789,13 +1784,14 @@ expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir)
If the file does not exist, STATPTR->st_mode is set to 0.
If STATPTR is null, we don't store into it.
- If QUICK is nonzero, we ask for y or n, not yes or no. */
+ If QUICK, ask for y or n, not yes or no. */
static void
barf_or_query_if_file_exists (Lisp_Object absname, const char *querystring,
- int interactive, struct stat *statptr, int quick)
+ bool interactive, struct stat *statptr,
+ bool quick)
{
- register Lisp_Object tem, encoded_filename;
+ Lisp_Object tem, encoded_filename;
struct stat statbuf;
struct gcpro gcpro1;
@@ -1869,11 +1865,11 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
Lisp_Object handler;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
ptrdiff_t count = SPECPDL_INDEX ();
- int input_file_statable_p;
+ bool input_file_statable_p;
Lisp_Object encoded_file, encoded_newname;
#if HAVE_LIBSELINUX
security_context_t con;
- int fail, conlength = 0;
+ int conlength = 0;
#endif
encoded_file = encoded_newname = Qnil;
@@ -1988,7 +1984,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
S_IREAD | S_IWRITE);
#else /* not MSDOS */
{
- int new_mask = 0666;
+ mode_t new_mask = 0666;
if (input_file_statable_p)
{
if (!NILP (preserve_uid_gid))
@@ -2018,7 +2014,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
owner and group. */
if (input_file_statable_p)
{
- int mode_mask = 07777;
+ mode_t mode_mask = 07777;
if (!NILP (preserve_uid_gid))
{
/* Attempt to change owner and group. If that doesn't work
@@ -2041,7 +2037,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
if (conlength > 0)
{
/* Set the modified context back to the file. */
- fail = fsetfilecon (ofd, con);
+ bool fail = fsetfilecon (ofd, con) != 0;
/* See http://debbugs.gnu.org/11245 for ENOTSUP. */
if (fail && errno != ENOTSUP)
report_file_error ("Doing fsetfilecon", Fcons (newname, Qnil));
@@ -2184,17 +2180,14 @@ internal_delete_file_1 (Lisp_Object ignore)
return Qt;
}
-/* Delete file FILENAME, returning 1 if successful and 0 if failed.
+/* Delete file FILENAME.
This ignores `delete-by-moving-to-trash'. */
-int
+void
internal_delete_file (Lisp_Object filename)
{
- Lisp_Object tem;
-
- tem = internal_condition_case_2 (Fdelete_file, filename, Qnil,
- Qt, internal_delete_file_1);
- return NILP (tem);
+ internal_condition_case_2 (Fdelete_file, filename, Qnil,
+ Qt, internal_delete_file_1);
}
DEFUN ("rename-file", Frename_file, Srename_file, 2, 3,
@@ -2430,9 +2423,9 @@ On Unix, this is a name starting with a `/' or a `~'. */)
return file_name_absolute_p (SSDATA (filename)) ? Qt : Qnil;
}
-/* Return nonzero if file FILENAME exists and can be executed. */
+/* Return true if file FILENAME exists and can be executed. */
-static int
+static bool
check_executable (char *filename)
{
#ifdef DOS_NT
@@ -2452,9 +2445,9 @@ check_executable (char *filename)
#endif /* not DOS_NT */
}
-/* Return nonzero if file FILENAME exists and can be written. */
+/* Return true if file FILENAME exists and can be written. */
-static int
+static bool
check_writable (const char *filename)
{
#ifdef MSDOS
@@ -2464,7 +2457,7 @@ check_writable (const char *filename)
return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode));
#else /* not MSDOS */
#ifdef HAVE_EUIDACCESS
- int res = (euidaccess (filename, 2) >= 0);
+ bool res = (euidaccess (filename, 2) >= 0);
#ifdef CYGWIN
/* euidaccess may have returned failure because Cygwin couldn't
determine the file's UID or GID; if so, we return success. */
@@ -2732,7 +2725,7 @@ searchable directory. */)
(Lisp_Object filename)
{
Lisp_Object handler;
- int tem;
+ bool tem;
struct gcpro gcpro1;
/* If the file name has special constructs in it,
@@ -2868,7 +2861,8 @@ compiled with SELinux support. */)
Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context)));
Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context))));
security_context_t con;
- int fail, conlength;
+ bool fail;
+ int conlength;
context_t parsed_con;
#endif
@@ -2912,8 +2906,9 @@ compiled with SELinux support. */)
}
/* Set the modified context back to the file. */
- fail = lsetfilecon (SSDATA (encoded_absname),
- context_str (parsed_con));
+ fail = (lsetfilecon (SSDATA (encoded_absname),
+ context_str (parsed_con))
+ != 0);
/* See http://debbugs.gnu.org/11245 for ENOTSUP. */
if (fail && errno != ENOTSUP)
report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil));
@@ -3004,7 +2999,7 @@ DEFUN ("default-file-modes", Fdefault_file_modes, Sdefault_file_modes, 0, 0, 0,
The value is an integer. */)
(void)
{
- int realmask;
+ mode_t realmask;
Lisp_Object value;
BLOCK_INPUT;
@@ -3246,29 +3241,29 @@ variable `last-coding-system-used' to the coding system actually used. */)
struct stat st;
int file_status;
EMACS_TIME mtime;
- register int fd;
+ int fd;
ptrdiff_t inserted = 0;
- int nochange = 0;
- register ptrdiff_t how_much;
+ bool nochange = 0;
+ ptrdiff_t how_much;
off_t beg_offset, end_offset;
- register int unprocessed;
+ int unprocessed;
ptrdiff_t count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
Lisp_Object handler, val, insval, orig_filename, old_undo;
Lisp_Object p;
ptrdiff_t total = 0;
- int not_regular = 0;
+ bool not_regular = 0;
int save_errno = 0;
char read_buf[READ_BUF_SIZE];
struct coding_system coding;
char buffer[1 << 14];
- int replace_handled = 0;
- int set_coding_system = 0;
+ bool replace_handled = 0;
+ bool set_coding_system = 0;
Lisp_Object coding_system;
- int read_quit = 0;
+ bool read_quit = 0;
Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark;
- int we_locked_file = 0;
- int deferred_remove_unwind_protect = 0;
+ bool we_locked_file = 0;
+ bool deferred_remove_unwind_protect = 0;
if (current_buffer->base_buffer && ! NILP (visit))
error ("Cannot do file visiting in an indirect buffer");
@@ -3569,9 +3564,9 @@ variable `last-coding-system-used' to the coding system actually used. */)
ptrdiff_t same_at_end = ZV_BYTE;
ptrdiff_t overlap;
/* There is still a possibility we will find the need to do code
- conversion. If that happens, we set this variable to 1 to
+ conversion. If that happens, set this variable to
give up on handling REPLACE in the optimized way. */
- int giveup_match_end = 0;
+ bool giveup_match_end = 0;
if (beg_offset != 0)
{
@@ -4427,8 +4422,8 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
If it is not set locally, we anyway have to convert EOL
format if the default value of `buffer-file-coding-system'
tells that it is not Unix-like (LF only) format. */
- int using_default_coding = 0;
- int force_raw_text = 0;
+ bool using_default_coding = 0;
+ bool force_raw_text = 0;
val = BVAR (current_buffer, buffer_file_coding_system);
if (NILP (val)
@@ -4537,8 +4532,8 @@ This calls `write-region-annotate-functions' at the start, and
`write-region-post-annotation-function' at the end. */)
(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;
+ int desc;
+ bool ok;
int save_errno = 0;
const char *fn;
struct stat st;
@@ -4548,8 +4543,8 @@ This calls `write-region-annotate-functions' at the start, and
Lisp_Object visit_file;
Lisp_Object annotations;
Lisp_Object encoded_filename;
- int visiting = (EQ (visit, Qt) || STRINGP (visit));
- int quietly = !NILP (visit);
+ bool visiting = (EQ (visit, Qt) || STRINGP (visit));
+ bool quietly = !NILP (visit);
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
struct buffer *given_buffer;
struct coding_system coding;
@@ -4713,37 +4708,27 @@ This calls `write-region-annotate-functions' at the start, and
UNGCPRO;
- failure = 0;
immediate_quit = 1;
if (STRINGP (start))
- {
- failure = 0 > a_write (desc, start, 0, SCHARS (start),
- &annotations, &coding);
- save_errno = errno;
- }
+ ok = a_write (desc, start, 0, SCHARS (start), &annotations, &coding);
else if (XINT (start) != XINT (end))
- {
- failure = 0 > a_write (desc, Qnil,
- XINT (start), XINT (end) - XINT (start),
- &annotations, &coding);
- save_errno = errno;
- }
+ ok = a_write (desc, Qnil, XINT (start), XINT (end) - XINT (start),
+ &annotations, &coding);
else
{
- /* If file was empty, still need to write the annotations */
+ /* If file was empty, still need to write the annotations. */
coding.mode |= CODING_MODE_LAST_BLOCK;
- failure = 0 > a_write (desc, Qnil, XINT (end), 0, &annotations, &coding);
- save_errno = errno;
+ ok = a_write (desc, Qnil, XINT (end), 0, &annotations, &coding);
}
+ save_errno = errno;
- if (CODING_REQUIRE_FLUSHING (&coding)
- && !(coding.mode & CODING_MODE_LAST_BLOCK)
- && ! failure)
+ if (ok && CODING_REQUIRE_FLUSHING (&coding)
+ && !(coding.mode & CODING_MODE_LAST_BLOCK))
{
/* We have to flush out a data. */
coding.mode |= CODING_MODE_LAST_BLOCK;
- failure = 0 > e_write (desc, Qnil, 1, 1, &coding);
+ ok = e_write (desc, Qnil, 1, 1, &coding);
save_errno = errno;
}
@@ -4760,13 +4745,13 @@ This calls `write-region-annotate-functions' at the start, and
ignore EINVAL which happens when fsync is not supported on this
file. */
if (errno != EINTR && errno != EINVAL)
- failure = 1, save_errno = errno;
+ ok = 0, save_errno = errno;
}
#endif
/* NFS can report a write failure now. */
if (emacs_close (desc) < 0)
- failure = 1, save_errno = errno;
+ ok = 0, save_errno = errno;
stat (fn, &st);
@@ -4803,7 +4788,7 @@ This calls `write-region-annotate-functions' at the start, and
current_buffer->modtime_size = st.st_size;
}
- if (failure)
+ if (! ok)
error ("IO error writing %s: %s", SDATA (filename),
emacs_strerror (save_errno));
@@ -4859,7 +4844,8 @@ build_annotations (Lisp_Object start, Lisp_Object end)
Lisp_Object p, res;
struct gcpro gcpro1, gcpro2;
Lisp_Object original_buffer;
- int i, used_global = 0;
+ int i;
+ bool used_global = 0;
XSETBUFFER (original_buffer, current_buffer);
@@ -4939,11 +4925,11 @@ build_annotations (Lisp_Object start, Lisp_Object end)
We modify *ANNOT by discarding elements as we use them up.
- The return value is negative in case of system call failure. */
+ Return true if successful. */
-static int
+static bool
a_write (int desc, Lisp_Object string, ptrdiff_t pos,
- register ptrdiff_t nchars, Lisp_Object *annot,
+ ptrdiff_t nchars, Lisp_Object *annot,
struct coding_system *coding)
{
Lisp_Object tem;
@@ -4965,29 +4951,29 @@ a_write (int desc, Lisp_Object string, ptrdiff_t pos,
/* Output buffer text up to the next annotation's position. */
if (nextpos > pos)
{
- if (0 > e_write (desc, string, pos, nextpos, coding))
- return -1;
+ if (!e_write (desc, string, pos, nextpos, coding))
+ return 0;
pos = nextpos;
}
/* Output the annotation. */
tem = Fcdr (Fcar (*annot));
if (STRINGP (tem))
{
- if (0 > e_write (desc, tem, 0, SCHARS (tem), coding))
- return -1;
+ if (!e_write (desc, tem, 0, SCHARS (tem), coding))
+ return 0;
}
*annot = Fcdr (*annot);
}
- return 0;
+ return 1;
}
/* Write text in the range START and END into descriptor DESC,
encoding them with coding system CODING. If STRING is nil, START
and END are character positions of the current buffer, else they
- are indexes to the string STRING. */
+ are indexes to the string STRING. Return true if successful. */
-static int
+static bool
e_write (int desc, Lisp_Object string, ptrdiff_t start, ptrdiff_t end,
struct coding_system *coding)
{
@@ -5056,12 +5042,12 @@ e_write (int desc, Lisp_Object string, ptrdiff_t start, ptrdiff_t end,
coding->produced);
if (coding->produced)
- return -1;
+ return 0;
}
start += coding->consumed_char;
}
- return 0;
+ return 1;
}
DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime,
@@ -5300,12 +5286,12 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
{
struct buffer *old = current_buffer, *b;
Lisp_Object tail, buf, hook;
- int auto_saved = 0;
+ bool auto_saved = 0;
int do_handled_files;
Lisp_Object oquit;
FILE *stream = NULL;
ptrdiff_t count = SPECPDL_INDEX ();
- int orig_minibuffer_auto_raise = minibuffer_auto_raise;
+ bool orig_minibuffer_auto_raise = minibuffer_auto_raise;
bool old_message_p = 0;
struct gcpro gcpro1, gcpro2;
@@ -5452,7 +5438,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
if (!auto_saved && NILP (no_message))
message1 ("Auto-saving...");
internal_condition_case (auto_save_1, Qt, auto_save_error);
- auto_saved++;
+ auto_saved = 1;
BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b);
XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
set_buffer_internal (old);
diff --git a/src/filelock.c b/src/filelock.c
index d21d8e7ba0..17f3f25324 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/stat.h>
#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
@@ -100,10 +99,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Return the time of the last system boot. */
static time_t boot_time;
-static int boot_time_initialized;
+static bool boot_time_initialized;
#ifdef BOOT_TIME
-static void get_boot_time_1 (const char *, int);
+static void get_boot_time_1 (const char *, bool);
#endif
static time_t
@@ -170,7 +169,7 @@ get_boot_time (void)
{
char cmd_string[sizeof WTMP_FILE ".19.gz"];
Lisp_Object tempname, filename;
- int delete_flag = 0;
+ bool delete_flag = 0;
filename = Qnil;
@@ -225,13 +224,13 @@ get_boot_time (void)
If FILENAME is zero, use the same file as before;
if no FILENAME has ever been specified, this is the utmp file.
- Use the newest reboot record if NEWEST is nonzero,
+ Use the newest reboot record if NEWEST,
the first reboot record otherwise.
Ignore all reboot records on or before BOOT_TIME.
Success is indicated by setting BOOT_TIME to a larger value. */
void
-get_boot_time_1 (const char *filename, int newest)
+get_boot_time_1 (const char *filename, bool newest)
{
struct utmp ut, *utp;
int desc;
@@ -331,11 +330,11 @@ fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
}
/* Lock the lock file named LFNAME.
- If FORCE is nonzero, we do so even if it is already locked.
- Return 1 if successful, 0 if not. */
+ If FORCE, do so even if it is already locked.
+ Return true if successful. */
-static int
-lock_file_1 (char *lfname, int force)
+static bool
+lock_file_1 (char *lfname, bool force)
{
int err;
int symlink_errno;
@@ -370,9 +369,9 @@ lock_file_1 (char *lfname, int force)
return err == 0;
}
-/* Return 1 if times A and B are no more than one second apart. */
+/* Return true if times A and B are no more than one second apart. */
-static int
+static bool
within_one_second (time_t a, time_t b)
{
return (a - b >= -1 && a - b <= 1);
@@ -491,7 +490,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
static int
lock_if_free (lock_info_type *clasher, register char *lfname)
{
- while (lock_file_1 (lfname, 0) == 0)
+ while (! lock_file_1 (lfname, 0))
{
int locker;
diff --git a/src/firstfile.c b/src/firstfile.c
index 84511cfe0a..444fb71b55 100644
--- a/src/firstfile.c
+++ b/src/firstfile.c
@@ -27,7 +27,6 @@ static char _my_begbss[1];
char * my_begbss_static = _my_begbss;
/* Add a dummy reference to ensure emacs.obj is linked in. */
-extern int initialized;
-static int * dummy = &initialized;
+extern int main (int, char **);
+static int (*dummy) (int, char **) = main;
#endif
-
diff --git a/src/floatfns.c b/src/floatfns.c
index cad071f1e1..4fe209fcb6 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -22,171 +22,32 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
-/* ANSI C requires only these float functions:
- acos, asin, atan, atan2, ceil, cos, cosh, exp, fabs, floor, fmod,
- frexp, ldexp, log, log10, modf, pow, sin, sinh, sqrt, tan, tanh.
-
- Define HAVE_INVERSE_HYPERBOLIC if you have acosh, asinh, and atanh.
- Define HAVE_CBRT if you have cbrt.
- Define HAVE_RINT if you have a working rint.
- If you don't define these, then the appropriate routines will be simulated.
-
- Define HAVE_MATHERR if on a system supporting the SysV matherr callback.
- (This should happen automatically.)
-
- Define FLOAT_CHECK_ERRNO if the float library routines set errno.
- This has no effect if HAVE_MATHERR is defined.
-
- Define FLOAT_CATCH_SIGILL if the float library routines signal SIGILL.
- (What systems actually do this? Please let us know.)
-
- Define FLOAT_CHECK_DOMAIN if the float library doesn't handle errors by
- either setting errno, or signaling SIGFPE/SIGILL. Otherwise, domain and
- range checking will happen before calling the float routines. This has
- no effect if HAVE_MATHERR is defined (since matherr will be called when
- a domain error occurs.)
+/* C89 requires only the following math.h functions, and Emacs omits
+ the starred functions since we haven't found a use for them:
+ acos, asin, atan, atan2, ceil, cos, *cosh, exp, fabs, floor, fmod,
+ frexp, ldexp, log, log10, *modf, pow, sin, *sinh, sqrt, tan, *tanh.
*/
#include <config.h>
-#include <signal.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "syssignal.h"
#include <float.h>
-/* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */
-#ifndef IEEE_FLOATING_POINT
#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
&& FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)
#define IEEE_FLOATING_POINT 1
#else
#define IEEE_FLOATING_POINT 0
#endif
-#endif
#include <math.h>
-/* This declaration is omitted on some systems, like Ultrix. */
-#if !defined (HPUX) && defined (HAVE_LOGB) && !defined (logb)
-extern double logb (double);
-#endif /* not HPUX and HAVE_LOGB and no logb macro */
-
-#if defined (DOMAIN) && defined (SING) && defined (OVERFLOW)
- /* If those are defined, then this is probably a `matherr' machine. */
-# ifndef HAVE_MATHERR
-# define HAVE_MATHERR
-# endif
-#endif
-
-#ifdef NO_MATHERR
-#undef HAVE_MATHERR
+#ifndef isfinite
+# define isfinite(x) ((x) - (x) == 0)
#endif
-
-#ifdef HAVE_MATHERR
-# ifdef FLOAT_CHECK_ERRNO
-# undef FLOAT_CHECK_ERRNO
-# endif
-# ifdef FLOAT_CHECK_DOMAIN
-# undef FLOAT_CHECK_DOMAIN
-# endif
-#endif
-
-#ifndef NO_FLOAT_CHECK_ERRNO
-#define FLOAT_CHECK_ERRNO
-#endif
-
-#ifdef FLOAT_CHECK_ERRNO
-# include <errno.h>
-#endif
-
-#ifdef FLOAT_CATCH_SIGILL
-static void float_error ();
-#endif
-
-/* Nonzero while executing in floating point.
- This tells float_error what to do. */
-
-static int in_float;
-
-/* If an argument is out of range for a mathematical function,
- here is the actual argument value to use in the error message.
- These variables are used only across the floating point library call
- so there is no need to staticpro them. */
-
-static Lisp_Object float_error_arg, float_error_arg2;
-
-static const char *float_error_fn_name;
-
-/* Evaluate the floating point expression D, recording NUM
- as the original argument for error messages.
- D is normally an assignment expression.
- Handle errors which may result in signals or may set errno.
-
- Note that float_error may be declared to return void, so you can't
- just cast the zero after the colon to (void) to make the types
- check properly. */
-
-#ifdef FLOAT_CHECK_ERRNO
-#define IN_FLOAT(d, name, num) \
- do { \
- float_error_arg = num; \
- float_error_fn_name = name; \
- in_float = 1; errno = 0; (d); in_float = 0; \
- switch (errno) { \
- case 0: break; \
- case EDOM: domain_error (float_error_fn_name, float_error_arg); \
- case ERANGE: range_error (float_error_fn_name, float_error_arg); \
- default: arith_error (float_error_fn_name, float_error_arg); \
- } \
- } while (0)
-#define IN_FLOAT2(d, name, num, num2) \
- do { \
- float_error_arg = num; \
- float_error_arg2 = num2; \
- float_error_fn_name = name; \
- in_float = 1; errno = 0; (d); in_float = 0; \
- switch (errno) { \
- case 0: break; \
- case EDOM: domain_error (float_error_fn_name, float_error_arg); \
- case ERANGE: range_error (float_error_fn_name, float_error_arg); \
- default: arith_error (float_error_fn_name, float_error_arg); \
- } \
- } while (0)
-#else
-#define IN_FLOAT(d, name, num) (in_float = 1, (d), in_float = 0)
-#define IN_FLOAT2(d, name, num, num2) (in_float = 1, (d), in_float = 0)
-#endif
-
-/* Convert float to Lisp_Int if it fits, else signal a range error
- using the given arguments. */
-#define FLOAT_TO_INT(x, i, name, num) \
- do \
- { \
- if (FIXNUM_OVERFLOW_P (x)) \
- range_error (name, num); \
- XSETINT (i, (EMACS_INT)(x)); \
- } \
- while (0)
-#define FLOAT_TO_INT2(x, i, name, num1, num2) \
- do \
- { \
- if (FIXNUM_OVERFLOW_P (x)) \
- range_error2 (name, num1, num2); \
- XSETINT (i, (EMACS_INT)(x)); \
- } \
- while (0)
-
-#define arith_error(op,arg) \
- xsignal2 (Qarith_error, build_string ((op)), (arg))
-#define range_error(op,arg) \
- xsignal2 (Qrange_error, build_string ((op)), (arg))
-#define range_error2(op,a1,a2) \
- xsignal3 (Qrange_error, build_string ((op)), (a1), (a2))
-#define domain_error(op,arg) \
- xsignal2 (Qdomain_error, build_string ((op)), (arg))
-#ifdef FLOAT_CHECK_DOMAIN
-#define domain_error2(op,a1,a2) \
- xsignal3 (Qdomain_error, build_string ((op)), (a1), (a2))
+#ifndef isnan
+# define isnan(x) ((x) != (x))
#endif
/* Extract a Lisp number as a `double', or signal an error. */
@@ -205,27 +66,19 @@ extract_float (Lisp_Object num)
DEFUN ("acos", Facos, Sacos, 1, 1, 0,
doc: /* Return the inverse cosine of ARG. */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
-#ifdef FLOAT_CHECK_DOMAIN
- if (d > 1.0 || d < -1.0)
- domain_error ("acos", arg);
-#endif
- IN_FLOAT (d = acos (d), "acos", arg);
+ d = acos (d);
return make_float (d);
}
DEFUN ("asin", Fasin, Sasin, 1, 1, 0,
doc: /* Return the inverse sine of ARG. */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
-#ifdef FLOAT_CHECK_DOMAIN
- if (d > 1.0 || d < -1.0)
- domain_error ("asin", arg);
-#endif
- IN_FLOAT (d = asin (d), "asin", arg);
+ d = asin (d);
return make_float (d);
}
@@ -235,56 +88,47 @@ 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. */)
- (register Lisp_Object y, Lisp_Object x)
+ (Lisp_Object y, Lisp_Object x)
{
double d = extract_float (y);
if (NILP (x))
- IN_FLOAT (d = atan (d), "atan", y);
+ d = atan (d);
else
{
double d2 = extract_float (x);
-
- IN_FLOAT2 (d = atan2 (d, d2), "atan", y, x);
+ d = atan2 (d, d2);
}
return make_float (d);
}
DEFUN ("cos", Fcos, Scos, 1, 1, 0,
doc: /* Return the cosine of ARG. */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
- IN_FLOAT (d = cos (d), "cos", arg);
+ d = cos (d);
return make_float (d);
}
DEFUN ("sin", Fsin, Ssin, 1, 1, 0,
doc: /* Return the sine of ARG. */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
- IN_FLOAT (d = sin (d), "sin", arg);
+ d = sin (d);
return make_float (d);
}
DEFUN ("tan", Ftan, Stan, 1, 1, 0,
doc: /* Return the tangent of ARG. */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
- double c = cos (d);
-#ifdef FLOAT_CHECK_DOMAIN
- if (c == 0.0)
- domain_error ("tan", arg);
-#endif
- IN_FLOAT (d = sin (d) / c, "tan", arg);
+ d = tan (d);
return make_float (d);
}
-#undef isnan
-#define isnan(x) ((x) != (x))
-
DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0,
doc: /* Return non nil iff argument X is a NaN. */)
(Lisp_Object x)
@@ -309,6 +153,7 @@ Cause an error if X1 or X2 is not a float. */)
return make_float (copysign (f1, f2));
}
+#endif
DEFUN ("frexp", Ffrexp, Sfrexp, 1, 1, 0,
doc: /* Get significand and exponent of a floating point number.
@@ -323,15 +168,9 @@ 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 exponent;
- double sgnfcand = frexp (f, &exponent);
- return Fcons (make_float (sgnfcand), make_number (exponent));
- }
+ int exponent;
+ double sgnfcand = frexp (f, &exponent);
+ return Fcons (make_float (sgnfcand), make_number (exponent));
}
DEFUN ("ldexp", Fldexp, Sldexp, 1, 2, 0,
@@ -343,138 +182,19 @@ Returns the floating point value resulting from multiplying SGNFCAND
CHECK_NUMBER (exponent);
return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exponent)));
}
-#endif
-
-#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. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
- IN_FLOAT (d = j0 (d), "bessel-j0", arg);
- return make_float (d);
-}
-
-DEFUN ("bessel-j1", Fbessel_j1, Sbessel_j1, 1, 1, 0,
- doc: /* Return the bessel function j1 of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
- IN_FLOAT (d = j1 (d), "bessel-j1", arg);
- return make_float (d);
-}
-
-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. */)
- (register Lisp_Object n, Lisp_Object arg)
-{
- int i1 = extract_float (n);
- double f2 = extract_float (arg);
-
- IN_FLOAT (f2 = jn (i1, f2), "bessel-jn", n);
- return make_float (f2);
-}
-
-DEFUN ("bessel-y0", Fbessel_y0, Sbessel_y0, 1, 1, 0,
- doc: /* Return the bessel function y0 of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
- IN_FLOAT (d = y0 (d), "bessel-y0", arg);
- return make_float (d);
-}
-
-DEFUN ("bessel-y1", Fbessel_y1, Sbessel_y1, 1, 1, 0,
- doc: /* Return the bessel function y1 of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
- IN_FLOAT (d = y1 (d), "bessel-y0", arg);
- return make_float (d);
-}
-
-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. */)
- (register Lisp_Object n, Lisp_Object arg)
-{
- int i1 = extract_float (n);
- double f2 = extract_float (arg);
-
- IN_FLOAT (f2 = yn (i1, f2), "bessel-yn", n);
- return make_float (f2);
-}
-
-#endif
-
-#if 0 /* Leave these out unless we see they are worth having. */
-
-DEFUN ("erf", Ferf, Serf, 1, 1, 0,
- doc: /* Return the mathematical error function of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
- IN_FLOAT (d = erf (d), "erf", arg);
- return make_float (d);
-}
-
-DEFUN ("erfc", Ferfc, Serfc, 1, 1, 0,
- doc: /* Return the complementary error function of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
- IN_FLOAT (d = erfc (d), "erfc", arg);
- return make_float (d);
-}
-
-DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0,
- doc: /* Return the log gamma of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
- IN_FLOAT (d = lgamma (d), "log-gamma", arg);
- return make_float (d);
-}
-
-DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0,
- doc: /* Return the cube root of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
-#ifdef HAVE_CBRT
- IN_FLOAT (d = cbrt (d), "cube-root", arg);
-#else
- if (d >= 0.0)
- IN_FLOAT (d = pow (d, 1.0/3.0), "cube-root", arg);
- else
- IN_FLOAT (d = -pow (-d, 1.0/3.0), "cube-root", arg);
-#endif
- return make_float (d);
-}
-
-#endif
DEFUN ("exp", Fexp, Sexp, 1, 1, 0,
doc: /* Return the exponential base e of ARG. */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
-#ifdef FLOAT_CHECK_DOMAIN
- if (d > 709.7827) /* Assume IEEE doubles here */
- range_error ("exp", arg);
- else if (d < -709.0)
- return make_float (0.0);
- else
-#endif
- IN_FLOAT (d = exp (d), "exp", arg);
+ d = exp (d);
return make_float (d);
}
DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
doc: /* Return the exponential ARG1 ** ARG2. */)
- (register Lisp_Object arg1, Lisp_Object arg2)
+ (Lisp_Object arg1, Lisp_Object arg2)
{
double f1, f2, f3;
@@ -503,159 +223,48 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
}
f1 = FLOATP (arg1) ? XFLOAT_DATA (arg1) : XINT (arg1);
f2 = FLOATP (arg2) ? XFLOAT_DATA (arg2) : XINT (arg2);
- /* Really should check for overflow, too */
- if (f1 == 0.0 && f2 == 0.0)
- f1 = 1.0;
-#ifdef FLOAT_CHECK_DOMAIN
- else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor (f2)))
- domain_error2 ("expt", arg1, arg2);
-#endif
- IN_FLOAT2 (f3 = pow (f1, f2), "expt", arg1, arg2);
- /* Check for overflow in the result. */
- if (f1 != 0.0 && f3 == 0.0)
- range_error ("expt", arg1);
+ f3 = pow (f1, f2);
return make_float (f3);
}
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. */)
- (register Lisp_Object arg, Lisp_Object base)
+ (Lisp_Object arg, Lisp_Object base)
{
double d = extract_float (arg);
-#ifdef FLOAT_CHECK_DOMAIN
- if (d <= 0.0)
- domain_error2 ("log", arg, base);
-#endif
if (NILP (base))
- IN_FLOAT (d = log (d), "log", arg);
+ d = log (d);
else
{
double b = extract_float (base);
-#ifdef FLOAT_CHECK_DOMAIN
- if (b <= 0.0 || b == 1.0)
- domain_error2 ("log", arg, base);
-#endif
if (b == 10.0)
- IN_FLOAT2 (d = log10 (d), "log", arg, base);
+ d = log10 (d);
else
- IN_FLOAT2 (d = log (d) / log (b), "log", arg, base);
+ d = log (d) / log (b);
}
return make_float (d);
}
DEFUN ("log10", Flog10, Slog10, 1, 1, 0,
doc: /* Return the logarithm base 10 of ARG. */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
-#ifdef FLOAT_CHECK_DOMAIN
- if (d <= 0.0)
- domain_error ("log10", arg);
-#endif
- IN_FLOAT (d = log10 (d), "log10", arg);
+ d = log10 (d);
return make_float (d);
}
DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0,
doc: /* Return the square root of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
-#ifdef FLOAT_CHECK_DOMAIN
- if (d < 0.0)
- domain_error ("sqrt", arg);
-#endif
- IN_FLOAT (d = sqrt (d), "sqrt", arg);
- return make_float (d);
-}
-
-#if 0 /* Not clearly worth adding. */
-
-DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0,
- doc: /* Return the inverse hyperbolic cosine of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
-#ifdef FLOAT_CHECK_DOMAIN
- if (d < 1.0)
- domain_error ("acosh", arg);
-#endif
-#ifdef HAVE_INVERSE_HYPERBOLIC
- IN_FLOAT (d = acosh (d), "acosh", arg);
-#else
- IN_FLOAT (d = log (d + sqrt (d*d - 1.0)), "acosh", arg);
-#endif
- return make_float (d);
-}
-
-DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0,
- doc: /* Return the inverse hyperbolic sine of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
-#ifdef HAVE_INVERSE_HYPERBOLIC
- IN_FLOAT (d = asinh (d), "asinh", arg);
-#else
- IN_FLOAT (d = log (d + sqrt (d*d + 1.0)), "asinh", arg);
-#endif
- return make_float (d);
-}
-
-DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0,
- doc: /* Return the inverse hyperbolic tangent of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
-#ifdef FLOAT_CHECK_DOMAIN
- if (d >= 1.0 || d <= -1.0)
- domain_error ("atanh", arg);
-#endif
-#ifdef HAVE_INVERSE_HYPERBOLIC
- IN_FLOAT (d = atanh (d), "atanh", arg);
-#else
- IN_FLOAT (d = 0.5 * log ((1.0 + d) / (1.0 - d)), "atanh", arg);
-#endif
- return make_float (d);
-}
-
-DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0,
- doc: /* Return the hyperbolic cosine of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
-#ifdef FLOAT_CHECK_DOMAIN
- if (d > 710.0 || d < -710.0)
- range_error ("cosh", arg);
-#endif
- IN_FLOAT (d = cosh (d), "cosh", arg);
- return make_float (d);
-}
-
-DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0,
- doc: /* Return the hyperbolic sine of ARG. */)
- (register Lisp_Object arg)
-{
- double d = extract_float (arg);
-#ifdef FLOAT_CHECK_DOMAIN
- if (d > 710.0 || d < -710.0)
- range_error ("sinh", arg);
-#endif
- IN_FLOAT (d = sinh (d), "sinh", arg);
- return make_float (d);
-}
-
-DEFUN ("tanh", Ftanh, Stanh, 1, 1, 0,
- doc: /* Return the hyperbolic tangent of ARG. */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
- IN_FLOAT (d = tanh (d), "tanh", arg);
+ d = sqrt (d);
return make_float (d);
}
-#endif
DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
doc: /* Return the absolute value of ARG. */)
@@ -694,38 +303,15 @@ This is the same as the exponent of a float. */)
if (f == 0.0)
value = MOST_NEGATIVE_FIXNUM;
- else
+ else if (isfinite (f))
{
-#ifdef HAVE_LOGB
- IN_FLOAT (value = logb (f), "logb", arg);
-#else
-#ifdef HAVE_FREXP
int ivalue;
- IN_FLOAT (frexp (f, &ivalue), "logb", arg);
+ frexp (f, &ivalue);
value = ivalue - 1;
-#else
- int i;
- double d;
- if (f < 0.0)
- f = -f;
- value = -1;
- while (f < 0.5)
- {
- for (i = 1, d = 0.5; d * d >= f; i += i)
- d *= d;
- f /= d;
- value -= i;
- }
- while (f >= 1.0)
- {
- for (i = 1, d = 2.0; d * d <= f; i += i)
- d *= d;
- f /= d;
- value += i;
- }
-#endif
-#endif
}
+ else
+ value = MOST_POSITIVE_FIXNUM;
+
XSETINT (val, value);
return val;
}
@@ -756,8 +342,10 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
if (! IEEE_FLOATING_POINT && f2 == 0)
xsignal0 (Qarith_error);
- IN_FLOAT2 (f1 = (*double_round) (f1 / f2), name, arg, divisor);
- FLOAT_TO_INT2 (f1, arg, name, arg, divisor);
+ f1 = (*double_round) (f1 / f2);
+ if (FIXNUM_OVERFLOW_P (f1))
+ xsignal3 (Qrange_error, build_string (name), arg, divisor);
+ arg = make_number (f1);
return arg;
}
@@ -773,10 +361,10 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor,
if (FLOATP (arg))
{
- double d;
-
- IN_FLOAT (d = (*double_round) (XFLOAT_DATA (arg)), name, arg);
- FLOAT_TO_INT (d, arg, name, arg);
+ double d = (*double_round) (XFLOAT_DATA (arg));
+ if (FIXNUM_OVERFLOW_P (d))
+ xsignal2 (Qrange_error, build_string (name), arg);
+ arg = make_number (d);
}
return arg;
@@ -893,125 +481,57 @@ fmod_float (Lisp_Object x, Lisp_Object y)
f1 = FLOATP (x) ? XFLOAT_DATA (x) : XINT (x);
f2 = FLOATP (y) ? XFLOAT_DATA (y) : XINT (y);
- if (! IEEE_FLOATING_POINT && f2 == 0)
- xsignal0 (Qarith_error);
+ f1 = fmod (f1, f2);
/* If the "remainder" comes out with the wrong sign, fix it. */
- IN_FLOAT2 ((f1 = fmod (f1, f2),
- f1 = (f2 < 0 ? f1 > 0 : f1 < 0) ? f1 + f2 : f1),
- "mod", x, y);
+ if (f2 < 0 ? 0 < f1 : f1 < 0)
+ f1 += f2;
+
return make_float (f1);
}
-/* It's not clear these are worth adding. */
-
DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0,
doc: /* Return the smallest integer no less than ARG, as a float.
\(Round toward +inf.\) */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
- IN_FLOAT (d = ceil (d), "fceiling", arg);
+ d = ceil (d);
return make_float (d);
}
DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0,
doc: /* Return the largest integer no greater than ARG, as a float.
\(Round towards -inf.\) */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
- IN_FLOAT (d = floor (d), "ffloor", arg);
+ d = floor (d);
return make_float (d);
}
DEFUN ("fround", Ffround, Sfround, 1, 1, 0,
doc: /* Return the nearest integer to ARG, as a float. */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
- IN_FLOAT (d = emacs_rint (d), "fround", arg);
+ d = emacs_rint (d);
return make_float (d);
}
DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0,
doc: /* Truncate a floating point number to an integral float value.
Rounds the value toward zero. */)
- (register Lisp_Object arg)
+ (Lisp_Object arg)
{
double d = extract_float (arg);
if (d >= 0.0)
- IN_FLOAT (d = floor (d), "ftruncate", arg);
+ d = floor (d);
else
- IN_FLOAT (d = ceil (d), "ftruncate", arg);
+ d = ceil (d);
return make_float (d);
}
-#ifdef FLOAT_CATCH_SIGILL
-static void
-float_error (int signo)
-{
- if (! in_float)
- fatal_error_signal (signo);
-
-#ifdef BSD_SYSTEM
- sigsetmask (SIGEMPTYMASK);
-#else
- /* Must reestablish handler each time it is called. */
- signal (SIGILL, float_error);
-#endif /* BSD_SYSTEM */
-
- SIGNAL_THREAD_CHECK (signo);
- in_float = 0;
-
- xsignal1 (Qarith_error, float_error_arg);
-}
-
-/* Another idea was to replace the library function `infnan'
- where SIGILL is signaled. */
-
-#endif /* FLOAT_CATCH_SIGILL */
-
-#ifdef HAVE_MATHERR
-int
-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"))
- name = "expt";
-
- args
- = Fcons (build_string (name),
- Fcons (make_float (x->arg1),
- ((!strcmp (name, "log") || !strcmp (name, "pow"))
- ? Fcons (make_float (x->arg2), Qnil)
- : Qnil)));
- switch (x->type)
- {
- case DOMAIN: xsignal (Qdomain_error, args); break;
- case SING: xsignal (Qsingularity_error, args); break;
- case OVERFLOW: xsignal (Qoverflow_error, args); break;
- case UNDERFLOW: xsignal (Qunderflow_error, args); break;
- default: xsignal (Qarith_error, args); break;
- }
- return (1); /* don't set errno or print a message */
-}
-#endif /* HAVE_MATHERR */
-
-void
-init_floatfns (void)
-{
-#ifdef FLOAT_CATCH_SIGILL
- signal (SIGILL, float_error);
-#endif
- in_float = 0;
-}
-
void
syms_of_floatfns (void)
{
@@ -1024,27 +544,9 @@ syms_of_floatfns (void)
defsubr (&Sisnan);
#ifdef HAVE_COPYSIGN
defsubr (&Scopysign);
+#endif
defsubr (&Sfrexp);
defsubr (&Sldexp);
-#endif
-#if 0
- defsubr (&Sacosh);
- defsubr (&Sasinh);
- defsubr (&Satanh);
- defsubr (&Scosh);
- defsubr (&Ssinh);
- defsubr (&Stanh);
- defsubr (&Sbessel_y0);
- defsubr (&Sbessel_y1);
- defsubr (&Sbessel_yn);
- defsubr (&Sbessel_j0);
- defsubr (&Sbessel_j1);
- defsubr (&Sbessel_jn);
- defsubr (&Serf);
- defsubr (&Serfc);
- defsubr (&Slog_gamma);
- defsubr (&Scube_root);
-#endif
defsubr (&Sfceiling);
defsubr (&Sffloor);
defsubr (&Sfround);
diff --git a/src/fns.c b/src/fns.c
index 2dee851579..42c4f817f2 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <time.h>
-#include <setjmp.h>
#include <intprops.h>
@@ -51,11 +50,7 @@ static Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper;
static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512;
-static int internal_equal (Lisp_Object , Lisp_Object, int, int);
-
-#ifndef HAVE_UNISTD_H
-extern long time ();
-#endif
+static bool internal_equal (Lisp_Object, Lisp_Object, int, bool);
DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
doc: /* Return the argument unchanged. */)
@@ -356,7 +351,7 @@ Symbols are also allowed; their print names are used instead. */)
}
static Lisp_Object concat (ptrdiff_t nargs, Lisp_Object *args,
- enum Lisp_Type target_type, int last_special);
+ enum Lisp_Type target_type, bool last_special);
/* ARGSUSED */
Lisp_Object
@@ -454,19 +449,19 @@ struct textprop_rec
static Lisp_Object
concat (ptrdiff_t nargs, Lisp_Object *args,
- enum Lisp_Type target_type, int last_special)
+ enum Lisp_Type target_type, bool last_special)
{
Lisp_Object val;
- register Lisp_Object tail;
- register Lisp_Object this;
+ Lisp_Object tail;
+ Lisp_Object this;
ptrdiff_t toindex;
ptrdiff_t toindex_byte = 0;
- register EMACS_INT result_len;
- register EMACS_INT result_len_byte;
+ EMACS_INT result_len;
+ EMACS_INT result_len_byte;
ptrdiff_t argnum;
Lisp_Object last_tail;
Lisp_Object prev;
- int some_multibyte;
+ bool some_multibyte;
/* When we make a multibyte string, we can't copy text properties
while concatenating each string because the length of resulting
string can't be decided until we finish the whole concatenation.
@@ -1531,11 +1526,14 @@ The value is actually the first element of LIST whose cdr equals KEY. */)
}
DEFUN ("delq", Fdelq, Sdelq, 2, 2, 0,
- doc: /* Delete by side effect any occurrences of ELT as a member of LIST.
-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'. */)
+ doc: /* Delete members of LIST which are `eq' to ELT, and return the result.
+More precisely, this function skips any members `eq' to ELT at the
+front of LIST, then removes members `eq' to ELT from the remaining
+sublist by modifying its list structure, then returns the resulting
+list.
+
+Write `(setq foo (delq element foo))' to be sure of correctly changing
+the value of a list `foo'. */)
(register Lisp_Object elt, Lisp_Object list)
{
register Lisp_Object tail, prev;
@@ -1563,13 +1561,19 @@ to be sure of changing the value of `foo'. */)
}
DEFUN ("delete", Fdelete, Sdelete, 2, 2, 0,
- doc: /* Delete by side effect any occurrences of ELT as a member of SEQ.
-SEQ must be a list, a vector, or a string.
-The modified SEQ is returned. Comparison is done with `equal'.
-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'. */)
+ doc: /* Delete members of SEQ which are `equal' to ELT, and return the result.
+SEQ must be a sequence (i.e. a list, a vector, or a string).
+The return value is a sequence of the same type.
+
+If SEQ is a list, this behaves like `delq', except that it compares
+with `equal' instead of `eq'. In particular, it may remove elements
+by altering the list structure.
+
+If SEQ is not a list, deletion is never performed destructively;
+instead this function creates and returns a new vector or string.
+
+Write `(setq foo (delete element foo))' to be sure of correctly
+changing the value of a sequence `foo'. */)
(Lisp_Object elt, Lisp_Object seq)
{
if (VECTORP (seq))
@@ -1992,10 +1996,10 @@ of strings. (`equal' ignores text properties.) */)
/* DEPTH is current depth of recursion. Signal an error if it
gets too deep.
- PROPS, if non-nil, means compare string text properties too. */
+ PROPS means compare string text properties too. */
-static int
-internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int props)
+static bool
+internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props)
{
if (depth > 200)
error ("Stack overflow in equal");
@@ -2593,9 +2597,9 @@ Normally the return value is FEATURE.
The normal messages at start and end of loading FILENAME are suppressed. */)
(Lisp_Object feature, Lisp_Object filename, Lisp_Object noerror)
{
- register Lisp_Object tem;
+ Lisp_Object tem;
struct gcpro gcpro1, gcpro2;
- int from_file = load_in_progress;
+ bool from_file = load_in_progress;
CHECK_SYMBOL (feature);
@@ -2921,8 +2925,8 @@ static const short base64_char_to_value[128] =
base64 characters. */
-static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, int, int);
-static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, int,
+static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, bool, bool);
+static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, bool,
ptrdiff_t *);
DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region,
@@ -2957,7 +2961,7 @@ into shorter lines. */)
encoded, length, NILP (no_line_break),
!NILP (BVAR (current_buffer, enable_multibyte_characters)));
if (encoded_length > allength)
- abort ();
+ emacs_abort ();
if (encoded_length < 0)
{
@@ -3013,7 +3017,7 @@ into shorter lines. */)
encoded, length, NILP (no_line_break),
STRING_MULTIBYTE (string));
if (encoded_length > allength)
- abort ();
+ emacs_abort ();
if (encoded_length < 0)
{
@@ -3030,7 +3034,7 @@ into shorter lines. */)
static ptrdiff_t
base64_encode_1 (const char *from, char *to, ptrdiff_t length,
- int line_break, int multibyte)
+ bool line_break, bool multibyte)
{
int counter = 0;
ptrdiff_t i = 0;
@@ -3137,7 +3141,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */
ptrdiff_t old_pos = PT;
ptrdiff_t decoded_length;
ptrdiff_t inserted_chars;
- int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+ bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
USE_SAFE_ALLOCA;
validate_region (&beg, &end);
@@ -3158,7 +3162,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */
decoded, length,
multibyte, &inserted_chars);
if (decoded_length > allength)
- abort ();
+ emacs_abort ();
if (decoded_length < 0)
{
@@ -3208,7 +3212,7 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
decoded_length = base64_decode_1 (SSDATA (string), decoded, length,
0, NULL);
if (decoded_length > length)
- abort ();
+ emacs_abort ();
else if (decoded_length >= 0)
decoded_string = make_unibyte_string (decoded, decoded_length);
else
@@ -3222,13 +3226,13 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
}
/* Base64-decode the data at FROM of LENGTH bytes into TO. If
- MULTIBYTE is nonzero, the decoded result should be in multibyte
+ MULTIBYTE, the decoded result should be in multibyte
form. If NCHARS_RETURN is not NULL, store the number of produced
characters in *NCHARS_RETURN. */
static ptrdiff_t
base64_decode_1 (const char *from, char *to, ptrdiff_t length,
- int multibyte, ptrdiff_t *nchars_return)
+ bool multibyte, ptrdiff_t *nchars_return)
{
ptrdiff_t i = 0; /* Used inside READ_QUADRUPLET_BYTE */
char *e = to;
@@ -3344,7 +3348,7 @@ static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value;
static struct Lisp_Hash_Table *check_hash_table (Lisp_Object);
static ptrdiff_t get_key_arg (Lisp_Object, ptrdiff_t, Lisp_Object *, char *);
static void maybe_resize_hash_table (struct Lisp_Hash_Table *);
-static int sweep_weak_table (struct Lisp_Hash_Table *, int);
+static bool sweep_weak_table (struct Lisp_Hash_Table *, bool);
@@ -3436,10 +3440,10 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max)
***********************************************************************/
/* Compare KEY1 which has hash code HASH1 and KEY2 with hash code
- HASH2 in hash table H using `eql'. Value is non-zero if KEY1 and
+ HASH2 in hash table H using `eql'. Value is true if KEY1 and
KEY2 are the same. */
-static int
+static bool
cmpfn_eql (struct Lisp_Hash_Table *h,
Lisp_Object key1, EMACS_UINT hash1,
Lisp_Object key2, EMACS_UINT hash2)
@@ -3451,10 +3455,10 @@ cmpfn_eql (struct Lisp_Hash_Table *h,
/* Compare KEY1 which has hash code HASH1 and KEY2 with hash code
- HASH2 in hash table H using `equal'. Value is non-zero if KEY1 and
+ HASH2 in hash table H using `equal'. Value is true if KEY1 and
KEY2 are the same. */
-static int
+static bool
cmpfn_equal (struct Lisp_Hash_Table *h,
Lisp_Object key1, EMACS_UINT hash1,
Lisp_Object key2, EMACS_UINT hash2)
@@ -3464,10 +3468,10 @@ cmpfn_equal (struct Lisp_Hash_Table *h,
/* Compare KEY1 which has hash code HASH1, and KEY2 with hash code
- HASH2 in hash table H using H->user_cmp_function. Value is non-zero
+ HASH2 in hash table H using H->user_cmp_function. Value is true
if KEY1 and KEY2 are the same. */
-static int
+static bool
cmpfn_user_defined (struct Lisp_Hash_Table *h,
Lisp_Object key1, EMACS_UINT hash1,
Lisp_Object key2, EMACS_UINT hash2)
@@ -3675,7 +3679,7 @@ copy_hash_table (struct Lisp_Hash_Table *h1)
h2 = allocate_hash_table ();
next = h2->header.next.vector;
- memcpy (h2, h1, sizeof *h2);
+ *h2 = *h1;
h2->header.next.vector = next;
h2->key_and_value = Fcopy_sequence (h1->key_and_value);
h2->hash = Fcopy_sequence (h1->hash);
@@ -3927,16 +3931,16 @@ hash_clear (struct Lisp_Hash_Table *h)
Weak Hash Tables
************************************************************************/
-/* Sweep weak hash table H. REMOVE_ENTRIES_P non-zero means remove
+/* Sweep weak hash table H. REMOVE_ENTRIES_P means remove
entries from the table that don't survive the current GC.
- REMOVE_ENTRIES_P zero means mark entries that are in use. Value is
- non-zero if anything was marked. */
+ !REMOVE_ENTRIES_P means mark entries that are in use. Value is
+ true if anything was marked. */
-static int
-sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
+static bool
+sweep_weak_table (struct Lisp_Hash_Table *h, bool remove_entries_p)
{
ptrdiff_t bucket, n;
- int marked;
+ bool marked;
n = ASIZE (h->index) & ~ARRAY_MARK_FLAG;
marked = 0;
@@ -3953,7 +3957,7 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
ptrdiff_t i = XFASTINT (idx);
bool key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i));
bool value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i));
- int remove_p;
+ bool remove_p;
if (EQ (h->weak, Qkey))
remove_p = !key_known_to_survive_p;
@@ -3964,7 +3968,7 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
else if (EQ (h->weak, Qkey_and_value))
remove_p = !(key_known_to_survive_p && value_known_to_survive_p);
else
- abort ();
+ emacs_abort ();
next = HASH_NEXT (h, i);
@@ -4026,7 +4030,7 @@ void
sweep_weak_hash_tables (void)
{
struct Lisp_Hash_Table *h, *used, *next;
- int marked;
+ bool marked;
/* Mark all keys and values that are in use. Keep on marking until
there is no more change. This is necessary for cases like
@@ -4260,7 +4264,7 @@ sxhash (Lisp_Object obj, int depth)
break;
default:
- abort ();
+ emacs_abort ();
}
return hash;
@@ -4678,7 +4682,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
coding_system = Vcoding_system_for_write;
else
{
- int force_raw_text = 0;
+ bool force_raw_text = 0;
coding_system = BVAR (XBUFFER (object), buffer_file_coding_system);
if (NILP (coding_system)
diff --git a/src/font.c b/src/font.c
index c775b56caa..629e8bb977 100644
--- a/src/font.c
+++ b/src/font.c
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <float.h>
#include <stdio.h>
-#include <setjmp.h>
#include <c-ctype.h>
@@ -216,13 +215,12 @@ static int num_font_drivers;
/* Return a Lispy value of a font property value at STR and LEN bytes.
- If STR is "*", return nil.
- If FORCE_SYMBOL is zero and all characters in STR are digits,
- return an integer. Otherwise, return a symbol interned from
- STR. */
+ If STR is "*", return nil. If FORCE_SYMBOL, or if STR does not
+ consist entirely of one or more digits, return a symbol interned
+ from STR. Otherwise, return an integer. */
Lisp_Object
-font_intern_prop (const char *str, ptrdiff_t len, int force_symbol)
+font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol)
{
ptrdiff_t i;
Lisp_Object tem;
@@ -306,7 +304,8 @@ font_pixel_size (FRAME_PTR f, Lisp_Object spec)
VAL is an integer. */
int
-font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror)
+font_style_to_value (enum font_property_index prop, Lisp_Object val,
+ bool noerror)
{
Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX);
int len;
@@ -385,7 +384,8 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror
}
Lisp_Object
-font_style_symbolic (Lisp_Object font, enum font_property_index prop, int for_face)
+font_style_symbolic (Lisp_Object font, enum font_property_index prop,
+ bool for_face)
{
Lisp_Object val = AREF (font, prop);
Lisp_Object table, elt;
@@ -1101,7 +1101,7 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font)
}
else
{
- int wild_card_found = 0;
+ bool wild_card_found = 0;
Lisp_Object prop[XLFD_LAST_INDEX];
if (FONT_ENTITY_P (font))
@@ -1337,7 +1337,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font)
}
else if (*p == '-')
{
- int decimal = 0, size_found = 1;
+ bool decimal = 0, size_found = 1;
for (q = p + 1; *q && *q != ':'; q++)
if (! c_isdigit (*q))
{
@@ -1938,7 +1938,7 @@ generate_otf_features (Lisp_Object spec, char *features)
{
Lisp_Object val;
char *p;
- int asterisk;
+ bool asterisk;
p = features;
*p = '\0';
@@ -2302,11 +2302,12 @@ font_update_sort_order (int *order)
}
}
-static int
-font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object features, Lisp_Object table)
+static bool
+font_check_otf_features (Lisp_Object script, Lisp_Object langsys,
+ Lisp_Object features, Lisp_Object table)
{
Lisp_Object val;
- int negative;
+ bool negative;
table = assq_no_quit (script, table);
if (NILP (table))
@@ -2342,7 +2343,7 @@ font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object fe
/* Check if OTF_CAPABILITY satisfies SPEC (otf-spec). */
-static int
+static bool
font_check_otf (Lisp_Object spec, Lisp_Object otf_capability)
{
Lisp_Object script, langsys = Qnil, gsub = Qnil, gpos = Qnil;
@@ -2376,7 +2377,7 @@ font_check_otf (Lisp_Object spec, Lisp_Object otf_capability)
/* Check if FONT (font-entity or font-object) matches with the font
specification SPEC. */
-int
+bool
font_match_p (Lisp_Object spec, Lisp_Object font)
{
Lisp_Object prop[FONT_SPEC_MAX], *props;
@@ -2694,7 +2695,7 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec)
Lisp_Object ftype, val;
Lisp_Object list = Qnil;
int size;
- int need_filtering = 0;
+ bool need_filtering = 0;
int i;
eassert (FONT_SPEC_P (spec));
@@ -3036,15 +3037,14 @@ font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs,
{
Lisp_Object font_entity;
Lisp_Object prefer;
- int result, i;
+ int i;
FRAME_PTR f = XFRAME (frame);
if (NILP (XCDR (entities))
&& ASIZE (XCAR (entities)) == 1)
{
font_entity = AREF (XCAR (entities), 0);
- if (c < 0
- || (result = font_has_char (f, font_entity, c)) > 0)
+ if (c < 0 || font_has_char (f, font_entity, c) > 0)
return font_entity;
return Qnil;
}
@@ -3618,7 +3618,7 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w,
Lisp_Object string)
{
FRAME_PTR f;
- int multibyte;
+ bool multibyte;
Lisp_Object font_object;
multibyte = (NILP (string)
@@ -4295,12 +4295,15 @@ to get the correct visual image of character sequences set in the
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. */)
+created glyph-string. Otherwise, the value is nil.
+
+See the documentation of `composition-get-gstring' for the format of
+GSTRING. */)
(Lisp_Object gstring)
{
struct font *font;
Lisp_Object font_object, n, glyph;
- ptrdiff_t i, j, from, to;
+ ptrdiff_t i, from, to;
if (! composition_gstring_p (gstring))
signal_error ("Invalid glyph-string: ", gstring);
@@ -4326,44 +4329,42 @@ created glyph-string. Otherwise, the value is nil. */)
if (XINT (n) < LGSTRING_GLYPH_LEN (gstring))
LGSTRING_SET_GLYPH (gstring, XINT (n), Qnil);
+ /* Check FROM_IDX and TO_IDX of each GLYPH in GSTRING to assure that
+ GLYPHS covers all characters (except for the last few ones) in
+ GSTRING. More formally, provided that NCHARS is the number of
+ characters in GSTRING and GLYPHS[i] is the ith glyph, FROM_IDX
+ and TO_IDX of each glyph must satisfy these conditions:
+
+ GLYPHS[0].FROM_IDX == 0
+ GLYPHS[i].FROM_IDX <= GLYPHS[i].TO_IDX
+ if (GLYPHS[i].FROM_IDX == GLYPHS[i-1].FROM_IDX)
+ ;; GLYPHS[i] and GLYPHS[i-1] belongs to the same grapheme cluster
+ GLYPHS[i].TO_IDX == GLYPHS[i-1].TO_IDX
+ else
+ ;; Be sure to cover all characters.
+ GLYPHS[i].FROM_IDX == GLYPHS[i-1].TO_IDX + 1 */
glyph = LGSTRING_GLYPH (gstring, 0);
from = LGLYPH_FROM (glyph);
to = LGLYPH_TO (glyph);
- for (i = 1, j = 0; i < LGSTRING_GLYPH_LEN (gstring); i++)
+ if (from != 0 || to < from)
+ goto shaper_error;
+ for (i = 1; i < LGSTRING_GLYPH_LEN (gstring); i++)
{
- Lisp_Object this = LGSTRING_GLYPH (gstring, i);
-
- if (NILP (this))
+ glyph = LGSTRING_GLYPH (gstring, i);
+ if (NILP (glyph))
break;
- if (NILP (LGLYPH_ADJUSTMENT (this)))
- {
- if (j < i - 1)
- for (; j < i; j++)
- {
- glyph = LGSTRING_GLYPH (gstring, j);
- LGLYPH_SET_FROM (glyph, from);
- LGLYPH_SET_TO (glyph, to);
- }
- from = LGLYPH_FROM (this);
- to = LGLYPH_TO (this);
- j = i;
- }
- else
- {
- if (from > LGLYPH_FROM (this))
- from = LGLYPH_FROM (this);
- if (to < LGLYPH_TO (this))
- to = LGLYPH_TO (this);
- }
+ if (! (LGLYPH_FROM (glyph) <= LGLYPH_TO (glyph)
+ && (LGLYPH_FROM (glyph) == from
+ ? LGLYPH_TO (glyph) == to
+ : LGLYPH_FROM (glyph) == to + 1)))
+ goto shaper_error;
+ from = LGLYPH_FROM (glyph);
+ to = LGLYPH_TO (glyph);
}
- if (j < i - 1)
- for (; j < i; j++)
- {
- glyph = LGSTRING_GLYPH (gstring, j);
- LGLYPH_SET_FROM (glyph, from);
- LGLYPH_SET_TO (glyph, to);
- }
return composition_gstring_put_cache (gstring, XINT (n));
+
+ shaper_error:
+ return Qnil;
}
DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs,
diff --git a/src/font.h b/src/font.h
index 5ed9affa9e..71cb26ccfd 100644
--- a/src/font.h
+++ b/src/font.h
@@ -320,19 +320,10 @@ struct font
negative if that information is not in the font. */
int underline_position;
- /* 1 if `vertical-centering-font-regexp' matches this font name.
+ /* True if `vertical-centering-font-regexp' matches this font name.
In this case, we render characters at vertical center positions
of lines. */
- int vertical_centering;
-
- /* Encoding type of the font. The value is one of
- 0, 1, 2, or 3:
- 0: code points 0x20..0x7F or 0x2020..0x7F7F are used
- 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used
- 2: code points 0x20A0..0x7FFF are used
- 3: code points 0xA020..0xFF7F are used
- If the member `font_encoder' is not NULL, this member is ignored. */
- unsigned char encoding_type;
+ bool vertical_centering;
/* The baseline position of a font is normally `ascent' value of the
font. However, there exist many fonts which don't set `ascent' to
@@ -506,9 +497,9 @@ struct font_driver
/* Symbol indicating the type of the font-driver. */
Lisp_Object type;
- /* 1 iff the font's foundry, family, and adstyle names are case
+ /* True iff the font's foundry, family, and adstyle names are case
sensitive. */
- int case_sensitive;
+ bool case_sensitive;
/* Return a cache of font-entities on frame F. The cache must be a
cons whose cdr part is the actual cache area. */
@@ -592,11 +583,11 @@ struct font_driver
/* 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). */
+ position of frame F with S->FACE and S->GC. If WITH_BACKGROUND,
+ fill the background in advance. It is assured that WITH_BACKGROUND
+ is false when (FROM > 0 || TO < S->nchars). */
int (*draw) (struct glyph_string *s, int from, int to,
- int x, int y, int with_background);
+ int x, int y, bool with_background);
/* Optional.
Store bitmap data for glyph-code CODE of FONT in BITMAP. It is
@@ -648,7 +639,7 @@ struct font_driver
short, return -1. */
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);
+ Lisp_Object gstring_out, int idx, bool alternate_subst);
/* Optional.
Make the font driver ready for frame F. Usually this function
@@ -699,9 +690,9 @@ struct font_driver
Return non-zero if FONT_OBJECT can be used as a (cached) font
for ENTITY on frame F. */
- int (*cached_font_ok) (struct frame *f,
- Lisp_Object font_object,
- Lisp_Object entity);
+ bool (*cached_font_ok) (struct frame *f,
+ Lisp_Object font_object,
+ Lisp_Object entity);
};
@@ -711,9 +702,9 @@ struct font_driver
struct font_driver_list
{
- /* 1 iff this driver is currently used. It is ignored in the global
+ /* True iff this driver is currently used. It is ignored in the global
font driver list.*/
- int on;
+ bool on;
/* Pointer to the font driver. */
struct font_driver *driver;
/* Pointer to the next element of the chain. */
@@ -744,12 +735,12 @@ 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);
+ Lisp_Object name, bool noerror);
extern Lisp_Object font_style_symbolic (Lisp_Object font,
enum font_property_index prop,
- int for_face);
+ bool for_face);
-extern int font_match_p (Lisp_Object spec, Lisp_Object font);
+extern bool font_match_p (Lisp_Object spec, Lisp_Object font);
extern Lisp_Object font_list_entities (Lisp_Object frame,
Lisp_Object spec);
@@ -774,7 +765,7 @@ extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec);
extern Lisp_Object font_open_by_name (FRAME_PTR f, Lisp_Object name);
extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len,
- int force_symbol);
+ bool force_symbol);
extern void font_update_sort_order (int *order);
extern void font_parse_family_registry (Lisp_Object family,
@@ -817,6 +808,7 @@ extern struct font_driver xfont_driver;
extern void syms_of_xfont (void);
extern void syms_of_ftxfont (void);
#ifdef HAVE_XFT
+extern Lisp_Object Qxft;
extern struct font_driver xftfont_driver;
extern void syms_of_xftfont (void);
#elif defined HAVE_FREETYPE
diff --git a/src/fontset.c b/src/fontset.c
index 783f99c210..7295951bc2 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -26,7 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "blockinput.h"
@@ -185,21 +184,12 @@ void (*check_window_system_func) (void);
/* Prototype declarations for static functions. */
-static void 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);
-static void set_fontset_font (Lisp_Object, Lisp_Object);
-/* Return 1 if ID is a valid fontset id, else return 0.
+/* Return true if ID is a valid fontset id.
Optimized away if ENABLE_CHECKING is not defined. */
-static int
+static bool
fontset_id_valid_p (int id)
{
return (id >= 0 && id < ASIZE (Vfontset_table) - 1);
@@ -413,7 +403,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font)
Lisp_Object vec, font_object;
int size;
int i;
- int score_changed = 0;
+ bool score_changed = 0;
if (font)
XSETFONT (font_object, font);
@@ -544,10 +534,11 @@ fontset_get_font_group (Lisp_Object fontset, int c)
ID is a charset-id that must be preferred, or -1 meaning no
preference.
- If FALLBACK is nonzero, search only fallback fonts. */
+ If FALLBACK, search only fallback fonts. */
static Lisp_Object
-fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fallback)
+fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id,
+ bool fallback)
{
Lisp_Object vec, font_group;
int i, charset_matched = 0, found_index;
@@ -919,11 +910,11 @@ free_face_fontset (FRAME_PTR f, struct face *face)
#if 0
-/* Return 1 if FACE is suitable for displaying character C.
- Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P
+/* Return true if FACE is suitable for displaying character C.
+ Called from the macro FACE_SUITABLE_FOR_CHAR_P
when C is not an ASCII character. */
-int
+bool
face_suitable_for_char_p (struct face *face, int c)
{
Lisp_Object fontset, rfont_def;
@@ -1470,7 +1461,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
Lisp_Object range_list;
struct charset *charset = NULL;
Lisp_Object fontname;
- int ascii_changed = 0;
+ bool ascii_changed = 0;
fontset = check_fontset_name (name, &frame);
diff --git a/src/frame.c b/src/frame.c
index aa1508e6d2..73e46eff00 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -24,7 +24,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <errno.h>
#include <limits.h>
-#include <setjmp.h>
#include <c-ctype.h>
@@ -214,7 +213,7 @@ See also `frame-live-p'. */)
case output_ns:
return Qns;
default:
- abort ();
+ emacs_abort ();
}
}
@@ -620,7 +619,7 @@ affects all frames on the same terminal device. */)
#ifdef MSDOS
if (sf->output_method != output_msdos_raw
&& sf->output_method != output_termcap)
- abort ();
+ emacs_abort ();
#else /* not MSDOS */
#ifdef WINDOWSNT /* This should work now! */
@@ -767,7 +766,7 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
Lisp_Object focus;
if (!FRAMEP (XCAR (tail)))
- abort ();
+ emacs_abort ();
focus = FRAME_FOCUS_FRAME (XFRAME (XCAR (tail)));
@@ -897,7 +896,7 @@ next_frame (Lisp_Object frame, Lisp_Object minibuf)
/* There must always be at least one frame in Vframe_list. */
if (! CONSP (Vframe_list))
- abort ();
+ emacs_abort ();
/* If this frame is dead, it won't be in Vframe_list, and we'll loop
forever. Forestall that. */
@@ -975,7 +974,7 @@ prev_frame (Lisp_Object frame, Lisp_Object minibuf)
/* There must always be at least one frame in Vframe_list. */
if (! CONSP (Vframe_list))
- abort ();
+ emacs_abort ();
prev = Qnil;
for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
@@ -984,7 +983,7 @@ prev_frame (Lisp_Object frame, Lisp_Object minibuf)
f = XCAR (tail);
if (!FRAMEP (f))
- abort ();
+ emacs_abort ();
if (EQ (frame, f) && !NILP (prev))
return prev;
@@ -1299,6 +1298,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
structures can still refer to it. */
fset_menu_bar_vector (f, Qnil);
+ /* If FRAME's buffer lists contains killed
+ buffers, this helps GC to reclaim them. */
+ fset_buffer_list (f, Qnil);
+ fset_buried_buffer_list (f, Qnil);
+
free_font_driver_list (f);
xfree (f->namebuf);
xfree (f->decode_mode_spec_buffer);
@@ -1385,7 +1389,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
this = XCAR (frames);
if (!FRAMEP (this))
- abort ();
+ emacs_abort ();
f1 = XFRAME (this);
if (kb == FRAME_KBOARD (f1))
@@ -1421,7 +1425,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
this = XCAR (frames);
if (!FRAMEP (this))
- abort ();
+ emacs_abort ();
f1 = XFRAME (this);
/* Consider only frames on the same kboard
@@ -1447,7 +1451,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
that is prohibited at the top; you can't delete surrogate
minibuffer frames. */
if (NILP (frame_with_minibuf))
- abort ();
+ emacs_abort ();
kset_default_minibuffer_frame (kb, frame_with_minibuf);
}
@@ -2108,7 +2112,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
swap_in_global_binding (sym);
break;
}
- default: abort ();
+ default: emacs_abort ();
}
}
@@ -3835,7 +3839,7 @@ x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param,
}
default:
- abort ();
+ emacs_abort ();
}
}
else
diff --git a/src/frame.h b/src/frame.h
index 2e0bcee432..1184545d2e 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -81,9 +81,6 @@ enum fullscreen_type
#define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel)
#define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel)
-struct terminal;
-
-struct font_driver_list;
struct frame
{
@@ -981,7 +978,7 @@ extern Lisp_Object selected_frame;
((FRAMEP (selected_frame) \
&& FRAME_LIVE_P (XFRAME (selected_frame))) \
? XFRAME (selected_frame) \
- : (abort (), (struct frame *) 0))
+ : (emacs_abort (), (struct frame *) 0))
/***********************************************************************
diff --git a/src/fringe.c b/src/fringe.c
index 97d03a2bfa..6e6deeddb0 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -18,7 +18,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "frame.h"
@@ -659,7 +658,14 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o
{
/* If W has a vertical border to its left, don't draw over it. */
wd -= ((!WINDOW_LEFTMOST_P (w)
- && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
+ && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)
+ /* But don't reduce the fringe width if the window
+ has a left margin, because that means we are not
+ in danger of drawing over the vertical border,
+ and OTOH leaving out that one pixel leaves behind
+ traces of the cursor, if it was in column zero
+ before drawing non-empty margin area. */
+ && NILP (w->left_margin_cols))
? 1 : 0);
p.bx = x - wd;
p.nx = wd;
diff --git a/src/ftfont.c b/src/ftfont.c
index e16f967f59..f07ad6f33c 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -21,8 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
-
#include <fontconfig/fontconfig.h>
#include <fontconfig/fcfreetype.h>
@@ -45,7 +43,7 @@ static Lisp_Object Qfreetype;
static Lisp_Object Qmonospace, Qsans_serif, Qserif, Qmono, Qsans, Qsans__serif;
/* Flag to tell if FcInit is already called or not. */
-static int fc_initialized;
+static bool fc_initialized;
/* Handle to a FreeType library instance. */
static FT_Library ft_library;
@@ -65,7 +63,7 @@ struct ftfont_info
#ifdef HAVE_LIBOTF
/* The following four members must be here in this order to be
compatible with struct xftfont_info (in xftfont.c). */
- int maybe_otf; /* Flag to tell if this may be OTF or not. */
+ bool maybe_otf; /* Flag to tell if this may be OTF or not. */
OTF *otf;
#endif /* HAVE_LIBOTF */
FT_Size ft_size;
@@ -543,9 +541,9 @@ struct font_driver ftfont_driver =
/* We can't draw a text without device dependent functions. */
NULL, /* draw */
ftfont_get_bitmap,
- NULL, /* get_bitmap */
NULL, /* free_bitmap */
NULL, /* get_outline */
+ NULL, /* free_outline */
ftfont_anchor_point,
#ifdef HAVE_LIBOTF
ftfont_otf_capability,
@@ -661,7 +659,8 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec)
{
struct OpenTypeSpec *spec = malloc (sizeof *spec);
Lisp_Object val;
- int i, j, negative;
+ int i, j;
+ bool negative;
if (! spec)
return NULL;
@@ -1185,7 +1184,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
FT_Size ft_size;
FT_UInt size;
Lisp_Object val, filename, idx, cache, font_object;
- int scalable;
+ bool scalable;
int spacing;
char name[256];
int i, len;
@@ -1243,7 +1242,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
ftfont_info->ft_size = ft_face->size;
ftfont_info->index = XINT (idx);
#ifdef HAVE_LIBOTF
- ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT;
+ ftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0;
ftfont_info->otf = NULL;
#endif /* HAVE_LIBOTF */
/* This means that there's no need of transformation. */
@@ -1392,7 +1391,8 @@ ftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct
struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
FT_Face ft_face = ftfont_info->ft_size->face;
int width = 0;
- int i, first;
+ int i;
+ bool first;
if (ftfont_info->ft_size != ft_face->size)
FT_Activate_Size (ftfont_info->ft_size);
@@ -1630,7 +1630,7 @@ ftfont_get_metrics (MFLTFont *font, MFLTGlyphString *gstring,
FT_Glyph_Metrics *m;
if (FT_Load_Glyph (ft_face, g->code, FT_LOAD_DEFAULT) != 0)
- abort ();
+ emacs_abort ();
m = &ft_face->glyph->metrics;
if (flt_font_ft->matrix)
{
@@ -1682,10 +1682,12 @@ ftfont_check_otf (MFLTFont *font, MFLTOtfSpec *spec)
struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font;
OTF *otf = flt_font_ft->otf;
OTF_Tag *tags;
- int i, n, negative;
+ int i, n;
+ bool negative;
if (FEATURE_ANY (0) && FEATURE_ANY (1))
- /* Return 1 iff any of GSUB or GPOS support the script (and language). */
+ /* Return true iff any of GSUB or GPOS support the script (and
+ language). */
return (otf
&& (OTF_check_features (otf, 0, spec->script, spec->langsys,
NULL, 0) > 0
@@ -2390,7 +2392,7 @@ ftfont_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, MFLTGlyphString *in,
static MFLTGlyphString gstring;
-static int m17n_flt_initialized;
+static bool m17n_flt_initialized;
static Lisp_Object
ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
@@ -2400,7 +2402,7 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
ptrdiff_t i;
struct MFLTFontFT flt_font_ft;
MFLT *flt = NULL;
- int with_variation_selector = 0;
+ bool with_variation_selector = 0;
if (! m17n_flt_initialized)
{
@@ -2421,7 +2423,7 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
break;
c = LGLYPH_CHAR (g);
if (CHAR_VARIATION_SELECTOR_P (c))
- with_variation_selector++;
+ with_variation_selector = 1;
}
len = i;
diff --git a/src/ftxfont.c b/src/ftxfont.c
index 6ebe0798b4..466250bd43 100644
--- a/src/ftxfont.c
+++ b/src/ftxfont.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <X11/Xlib.h>
#include "lisp.h"
@@ -43,14 +42,6 @@ static
#endif
struct font_driver ftxfont_driver;
-/* Prototypes for helper function. */
-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_background (FRAME_PTR, struct font *, GC,
- int, int, int);
-
struct ftxfont_frame_data
{
/* Background and foreground colors. */
@@ -143,7 +134,9 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba
}
static int
-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)
+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, bool flush)
{
struct font_bitmap bitmap;
unsigned char *b;
@@ -232,13 +225,6 @@ ftxfont_draw_background (FRAME_PTR f, struct font *font, GC gc, int x, int y,
XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground);
}
-/* Prototypes for font-driver methods. */
-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);
-
static Lisp_Object
ftxfont_list (Lisp_Object frame, Lisp_Object spec)
{
@@ -280,7 +266,8 @@ ftxfont_close (FRAME_PTR f, struct font *font)
}
static int
-ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background)
+ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y,
+ bool with_background)
{
FRAME_PTR f = s->f;
struct face *face = s->face;
diff --git a/src/gnutls.c b/src/gnutls.c
index a2573f6bd9..1c4693aee3 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -18,7 +18,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <errno.h>
-#include <setjmp.h>
#include "lisp.h"
#include "process.h"
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 939e472d6d..1eb4b2cabd 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -21,9 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef USE_GTK
#include <float.h>
-#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
#include <c-ctype.h>
@@ -254,7 +252,7 @@ void
free_widget_value (widget_value *wv)
{
if (wv->free_list)
- abort ();
+ emacs_abort ();
if (malloc_cpt > 25)
{
@@ -1979,7 +1977,10 @@ xg_get_file_name (FRAME_PTR f,
/* I really don't know why this is needed, but without this the GLIBC add on
library linuxthreads hangs when the Gnome file chooser backend creates
threads. */
- sigblock (sigmask (__SIGRTMIN));
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, __SIGRTMIN);
+ pthread_sigmask (SIG_BLOCK, &blocked, 0);
#endif /* HAVE_PTHREAD */
#ifdef HAVE_GTK_FILE_SELECTION_NEW
@@ -2001,7 +2002,7 @@ xg_get_file_name (FRAME_PTR f,
filesel_done = xg_dialog_run (f, w);
#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
- sigunblock (sigmask (__SIGRTMIN));
+ pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
#endif
if (filesel_done == GTK_RESPONSE_OK)
@@ -2019,11 +2020,6 @@ xg_get_file_name (FRAME_PTR f,
#if USE_NEW_GTK_FONT_CHOOSER
-extern Lisp_Object Qxft, Qnormal;
-extern Lisp_Object Qextra_light, Qlight, Qsemi_light, Qsemi_bold;
-extern Lisp_Object Qbold, Qextra_bold, Qultra_bold;
-extern Lisp_Object Qoblique, Qitalic;
-
#define XG_WEIGHT_TO_SYMBOL(w) \
(w <= PANGO_WEIGHT_THIN ? Qextra_light \
: w <= PANGO_WEIGHT_ULTRALIGHT ? Qlight \
@@ -2043,6 +2039,7 @@ extern Lisp_Object Qoblique, Qitalic;
static char *x_last_font_name;
+extern Lisp_Object Qxft;
/* Pop up a GTK font selector and return the name of the font the user
selects, as a C string. The returned font name follows GTK's own
@@ -2061,7 +2058,10 @@ xg_get_font (FRAME_PTR f, const char *default_name)
Lisp_Object font = Qnil;
#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
- sigblock (sigmask (__SIGRTMIN));
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, __SIGRTMIN);
+ pthread_sigmask (SIG_BLOCK, &blocked, 0);
#endif /* HAVE_PTHREAD */
w = gtk_font_chooser_dialog_new
@@ -2090,7 +2090,7 @@ xg_get_font (FRAME_PTR f, const char *default_name)
done = xg_dialog_run (f, w);
#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
- sigunblock (sigmask (__SIGRTMIN));
+ pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
#endif
if (done == GTK_RESPONSE_OK)
@@ -3523,7 +3523,7 @@ xg_store_widget_in_map (GtkWidget *w)
}
/* Should never end up here */
- abort ();
+ emacs_abort ();
}
/* Remove pointer at IDX from id_to_widget.
@@ -4091,7 +4091,7 @@ xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data)
else
{
fprintf (stderr, "internal error: GTK_IMAGE_PIXBUF failed\n");
- abort ();
+ emacs_abort ();
}
}
else if (store_type == GTK_IMAGE_ICON_NAME)
@@ -4106,7 +4106,7 @@ xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data)
else
{
fprintf (stderr, "internal error: store_type is %d\n", store_type);
- abort ();
+ emacs_abort ();
}
}
if (wmenuimage)
diff --git a/src/image.c b/src/image.c
index b5a2e0328e..a562868d94 100644
--- a/src/image.c
+++ b/src/image.c
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <math.h>
#include <unistd.h>
#ifdef HAVE_PNG
@@ -575,7 +574,6 @@ static int x_build_heuristic_mask (struct frame *, struct image *,
Lisp_Object);
#ifdef WINDOWSNT
extern Lisp_Object Vlibrary_cache;
-
#define CACHE_IMAGE_TYPE(type, status) \
do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0)
#else
@@ -600,7 +598,7 @@ define_image_type (struct image_type *type, int loaded)
/* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
The initialized data segment is read-only. */
struct image_type *p = xmalloc (sizeof *p);
- memcpy (p, type, sizeof *p);
+ *p = *type;
p->next = image_types;
image_types = p;
success = Qt;
@@ -847,7 +845,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
break;
default:
- abort ();
+ emacs_abort ();
break;
}
@@ -5528,15 +5526,24 @@ init_png_functions (Lisp_Object libraries)
#endif /* WINDOWSNT */
+/* Possibly inefficient/inexact substitutes for _setjmp and _longjmp.
+ Do not use sys_setjmp, as PNG supports only jmp_buf. The _longjmp
+ substitute may munge the signal mask, but that should be OK here.
+ MinGW (MS-Windows) uses _setjmp and defines setjmp to _setjmp in
+ the system header setjmp.h; don't mess up that. */
+#ifndef HAVE__SETJMP
+# define _setjmp(j) setjmp (j)
+# define _longjmp longjmp
+#endif
#if (PNG_LIBPNG_VER < 10500)
-#define PNG_LONGJMP(ptr) (longjmp ((ptr)->jmpbuf, 1))
+#define PNG_LONGJMP(ptr) (_longjmp ((ptr)->jmpbuf, 1))
#define PNG_JMPBUF(ptr) ((ptr)->jmpbuf)
#else
/* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908) */
#define PNG_LONGJMP(ptr) (fn_png_longjmp ((ptr), 1))
#define PNG_JMPBUF(ptr) \
- (*fn_png_set_longjmp_fn ((ptr), longjmp, sizeof (jmp_buf)))
+ (*fn_png_set_longjmp_fn ((ptr), _longjmp, sizeof (jmp_buf)))
#endif
/* Error and warning handlers installed when the PNG library
@@ -5605,20 +5612,31 @@ png_read_from_file (png_structp png_ptr, png_bytep data, png_size_t length)
/* Load PNG image IMG for use on frame F. Value is non-zero if
successful. */
+struct png_load_context
+{
+ /* These are members so that longjmp doesn't munge local variables. */
+ png_struct *png_ptr;
+ png_info *info_ptr;
+ png_info *end_info;
+ FILE *fp;
+ png_byte *pixels;
+ png_byte **rows;
+};
+
static int
-png_load (struct frame *f, struct image *img)
+png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
{
Lisp_Object file, specified_file;
Lisp_Object specified_data;
int x, y;
ptrdiff_t i;
XImagePtr ximg, mask_img = NULL;
- png_struct *png_ptr = NULL;
+ png_struct *png_ptr;
png_info *info_ptr = NULL, *end_info = NULL;
- FILE *volatile fp = NULL;
+ FILE *fp = NULL;
png_byte sig[8];
- png_byte * volatile pixels = NULL;
- png_byte ** volatile rows = NULL;
+ png_byte *pixels = NULL;
+ png_byte **rows = NULL;
png_uint_32 width, height;
int bit_depth, color_type, interlace_type;
png_byte channels;
@@ -5685,41 +5703,47 @@ png_load (struct frame *f, struct image *img)
png_ptr = fn_png_create_read_struct (PNG_LIBPNG_VER_STRING,
NULL, my_png_error,
my_png_warning);
- if (!png_ptr)
+ if (png_ptr)
{
- if (fp) fclose (fp);
- return 0;
+ info_ptr = fn_png_create_info_struct (png_ptr);
+ end_info = fn_png_create_info_struct (png_ptr);
}
- info_ptr = fn_png_create_info_struct (png_ptr);
- if (!info_ptr)
+ c->png_ptr = png_ptr;
+ c->info_ptr = info_ptr;
+ c->end_info = end_info;
+ c->fp = fp;
+ c->pixels = pixels;
+ c->rows = rows;
+
+ if (! (info_ptr && end_info))
{
- fn_png_destroy_read_struct (&png_ptr, NULL, NULL);
- if (fp) fclose (fp);
- return 0;
+ fn_png_destroy_read_struct (&c->png_ptr, &c->info_ptr, &c->end_info);
+ png_ptr = 0;
}
-
- end_info = fn_png_create_info_struct (png_ptr);
- if (!end_info)
+ if (! png_ptr)
{
- fn_png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
if (fp) fclose (fp);
return 0;
}
/* Set error jump-back. We come back here when the PNG library
detects an error. */
- if (setjmp (PNG_JMPBUF (png_ptr)))
+ if (_setjmp (PNG_JMPBUF (png_ptr)))
{
error:
- if (png_ptr)
- fn_png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
- xfree (pixels);
- xfree (rows);
- if (fp) fclose (fp);
+ if (c->png_ptr)
+ fn_png_destroy_read_struct (&c->png_ptr, &c->info_ptr, &c->end_info);
+ xfree (c->pixels);
+ xfree (c->rows);
+ if (c->fp)
+ fclose (c->fp);
return 0;
}
+ /* Silence a bogus diagnostic; see GCC bug 54561. */
+ IF_LINT (fp = c->fp);
+
/* Read image info. */
if (!NILP (specified_data))
fn_png_set_read_fn (png_ptr, (void *) &tbr, png_read_from_memory);
@@ -5835,8 +5859,8 @@ png_load (struct frame *f, struct image *img)
if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *rows < height
|| min (PTRDIFF_MAX, SIZE_MAX) / sizeof *pixels / height < row_bytes)
memory_full (SIZE_MAX);
- pixels = xmalloc (sizeof *pixels * row_bytes * height);
- rows = xmalloc (height * sizeof *rows);
+ c->pixels = pixels = xmalloc (sizeof *pixels * row_bytes * height);
+ c->rows = rows = xmalloc (height * sizeof *rows);
for (i = 0; i < height; ++i)
rows[i] = pixels + i * row_bytes;
@@ -5846,7 +5870,7 @@ png_load (struct frame *f, struct image *img)
if (fp)
{
fclose (fp);
- fp = NULL;
+ c->fp = NULL;
}
/* Create an image and pixmap serving as mask if the PNG image
@@ -5921,7 +5945,7 @@ png_load (struct frame *f, struct image *img)
#endif /* COLOR_TABLE_SUPPORT */
/* Clean up. */
- fn_png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
+ fn_png_destroy_read_struct (&c->png_ptr, &c->info_ptr, &c->end_info);
xfree (rows);
xfree (pixels);
@@ -5950,6 +5974,13 @@ png_load (struct frame *f, struct image *img)
return 1;
}
+static int
+png_load (struct frame *f, struct image *img)
+{
+ struct png_load_context c;
+ return png_load_body (f, img, &c);
+}
+
#else /* HAVE_PNG */
#ifdef HAVE_NS
@@ -6125,7 +6156,20 @@ jpeg_resync_to_restart_wrapper (j_decompress_ptr cinfo, int desired)
struct my_jpeg_error_mgr
{
struct jpeg_error_mgr pub;
- jmp_buf setjmp_buffer;
+ sys_jmp_buf setjmp_buffer;
+
+ /* The remaining members are so that longjmp doesn't munge local
+ variables. */
+ struct jpeg_decompress_struct cinfo;
+ enum
+ {
+ MY_JPEG_ERROR_EXIT,
+ MY_JPEG_INVALID_IMAGE_SIZE,
+ MY_JPEG_CANNOT_CREATE_X
+ } failure_code;
+#ifdef lint
+ FILE *fp;
+#endif
};
@@ -6133,7 +6177,8 @@ static _Noreturn void
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);
+ mgr->failure_code = MY_JPEG_ERROR_EXIT;
+ sys_longjmp (mgr->setjmp_buffer, 1);
}
@@ -6201,7 +6246,7 @@ our_memory_skip_input_data (j_decompress_ptr cinfo, long int num_bytes)
reading the image. */
static void
-jpeg_memory_src (j_decompress_ptr cinfo, JOCTET *data, unsigned int len)
+jpeg_memory_src (j_decompress_ptr cinfo, JOCTET *data, ptrdiff_t len)
{
struct jpeg_source_mgr *src;
@@ -6339,17 +6384,15 @@ jpeg_file_src (j_decompress_ptr cinfo, FILE *fp)
from the JPEG lib. */
static int
-jpeg_load (struct frame *f, struct image *img)
+jpeg_load_body (struct frame *f, struct image *img,
+ struct my_jpeg_error_mgr *mgr)
{
- struct jpeg_decompress_struct cinfo;
- struct my_jpeg_error_mgr mgr;
Lisp_Object file, specified_file;
Lisp_Object specified_data;
- FILE * volatile fp = NULL;
+ FILE *fp = NULL;
JSAMPARRAY buffer;
int row_stride, x, y;
XImagePtr ximg = NULL;
- int rc;
unsigned long *colors;
int width, height;
@@ -6379,26 +6422,37 @@ jpeg_load (struct frame *f, struct image *img)
return 0;
}
+ IF_LINT (mgr->fp = fp);
+
/* Customize libjpeg's error handling to call my_error_exit when an
error is detected. This function will perform a longjmp. */
- cinfo.err = fn_jpeg_std_error (&mgr.pub);
- mgr.pub.error_exit = my_error_exit;
-
- if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
+ mgr->cinfo.err = fn_jpeg_std_error (&mgr->pub);
+ mgr->pub.error_exit = my_error_exit;
+ if (sys_setjmp (mgr->setjmp_buffer))
{
- if (rc == 1)
+ switch (mgr->failure_code)
{
- /* Called from my_error_exit. Display a JPEG error. */
- char buf[JMSG_LENGTH_MAX];
- cinfo.err->format_message ((j_common_ptr) &cinfo, buf);
- image_error ("Error reading JPEG image `%s': %s", img->spec,
- build_string (buf));
+ case MY_JPEG_ERROR_EXIT:
+ {
+ char buf[JMSG_LENGTH_MAX];
+ mgr->cinfo.err->format_message ((j_common_ptr) &mgr->cinfo, buf);
+ image_error ("Error reading JPEG image `%s': %s", img->spec,
+ build_string (buf));
+ break;
+ }
+
+ case MY_JPEG_INVALID_IMAGE_SIZE:
+ image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ break;
+
+ case MY_JPEG_CANNOT_CREATE_X:
+ break;
}
/* Close the input file and destroy the JPEG object. */
if (fp)
- fclose ((FILE *) fp);
- fn_jpeg_destroy_decompress (&cinfo);
+ fclose (fp);
+ fn_jpeg_destroy_decompress (&mgr->cinfo);
/* If we already have an XImage, free that. */
x_destroy_x_image (ximg);
@@ -6408,46 +6462,52 @@ jpeg_load (struct frame *f, struct image *img)
return 0;
}
+ /* Silence a bogus diagnostic; see GCC bug 54561. */
+ IF_LINT (fp = mgr->fp);
+
/* Create the JPEG decompression object. Let it read from fp.
Read the JPEG image header. */
- fn_jpeg_CreateDecompress (&cinfo, JPEG_LIB_VERSION, sizeof (cinfo));
+ fn_jpeg_CreateDecompress (&mgr->cinfo, JPEG_LIB_VERSION, sizeof *&mgr->cinfo);
if (NILP (specified_data))
- jpeg_file_src (&cinfo, (FILE *) fp);
+ jpeg_file_src (&mgr->cinfo, fp);
else
- jpeg_memory_src (&cinfo, SDATA (specified_data),
+ jpeg_memory_src (&mgr->cinfo, SDATA (specified_data),
SBYTES (specified_data));
- fn_jpeg_read_header (&cinfo, 1);
+ fn_jpeg_read_header (&mgr->cinfo, 1);
/* Customize decompression so that color quantization will be used.
Start decompression. */
- cinfo.quantize_colors = 1;
- fn_jpeg_start_decompress (&cinfo);
- width = img->width = cinfo.output_width;
- height = img->height = cinfo.output_height;
+ mgr->cinfo.quantize_colors = 1;
+ fn_jpeg_start_decompress (&mgr->cinfo);
+ width = img->width = mgr->cinfo.output_width;
+ height = img->height = mgr->cinfo.output_height;
if (!check_image_size (f, width, height))
{
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
- longjmp (mgr.setjmp_buffer, 2);
+ mgr->failure_code = MY_JPEG_INVALID_IMAGE_SIZE;
+ sys_longjmp (mgr->setjmp_buffer, 1);
}
/* Create X image and pixmap. */
if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
- longjmp (mgr.setjmp_buffer, 2);
+ {
+ mgr->failure_code = MY_JPEG_CANNOT_CREATE_X;
+ sys_longjmp (mgr->setjmp_buffer, 1);
+ }
/* Allocate colors. When color quantization is used,
- cinfo.actual_number_of_colors has been set with the number of
- colors generated, and cinfo.colormap is a two-dimensional array
- of color indices in the range 0..cinfo.actual_number_of_colors.
+ mgr->cinfo.actual_number_of_colors has been set with the number of
+ colors generated, and mgr->cinfo.colormap is a two-dimensional array
+ of color indices in the range 0..mgr->cinfo.actual_number_of_colors.
No more than 255 colors will be generated. */
{
int i, ir, ig, ib;
- if (cinfo.out_color_components > 2)
+ if (mgr->cinfo.out_color_components > 2)
ir = 0, ig = 1, ib = 2;
- else if (cinfo.out_color_components > 1)
+ else if (mgr->cinfo.out_color_components > 1)
ir = 0, ig = 1, ib = 0;
else
ir = 0, ig = 0, ib = 0;
@@ -6457,15 +6517,15 @@ jpeg_load (struct frame *f, struct image *img)
a default color, and we don't have to care about which colors
can be freed safely, and which can't. */
init_color_table ();
- colors = alloca (cinfo.actual_number_of_colors * sizeof *colors);
+ colors = alloca (mgr->cinfo.actual_number_of_colors * sizeof *colors);
- for (i = 0; i < cinfo.actual_number_of_colors; ++i)
+ for (i = 0; i < mgr->cinfo.actual_number_of_colors; ++i)
{
/* Multiply RGB values with 255 because X expects RGB values
in the range 0..0xffff. */
- int r = cinfo.colormap[ir][i] << 8;
- int g = cinfo.colormap[ig][i] << 8;
- int b = cinfo.colormap[ib][i] << 8;
+ int r = mgr->cinfo.colormap[ir][i] << 8;
+ int g = mgr->cinfo.colormap[ig][i] << 8;
+ int b = mgr->cinfo.colormap[ib][i] << 8;
colors[i] = lookup_rgb_color (f, r, g, b);
}
@@ -6477,21 +6537,21 @@ jpeg_load (struct frame *f, struct image *img)
}
/* Read pixels. */
- row_stride = width * cinfo.output_components;
- buffer = cinfo.mem->alloc_sarray ((j_common_ptr) &cinfo, JPOOL_IMAGE,
- row_stride, 1);
+ row_stride = width * mgr->cinfo.output_components;
+ buffer = mgr->cinfo.mem->alloc_sarray ((j_common_ptr) &mgr->cinfo,
+ JPOOL_IMAGE, row_stride, 1);
for (y = 0; y < height; ++y)
{
- fn_jpeg_read_scanlines (&cinfo, buffer, 1);
- for (x = 0; x < cinfo.output_width; ++x)
+ fn_jpeg_read_scanlines (&mgr->cinfo, buffer, 1);
+ for (x = 0; x < mgr->cinfo.output_width; ++x)
XPutPixel (ximg, x, y, colors[buffer[0][x]]);
}
/* Clean up. */
- fn_jpeg_finish_decompress (&cinfo);
- fn_jpeg_destroy_decompress (&cinfo);
+ fn_jpeg_finish_decompress (&mgr->cinfo);
+ fn_jpeg_destroy_decompress (&mgr->cinfo);
if (fp)
- fclose ((FILE *) fp);
+ fclose (fp);
/* Maybe fill in the background field while we have ximg handy. */
if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
@@ -6504,6 +6564,13 @@ jpeg_load (struct frame *f, struct image *img)
return 1;
}
+static int
+jpeg_load (struct frame *f, struct image *img)
+{
+ struct my_jpeg_error_mgr mgr;
+ return jpeg_load_body (f, img, &mgr);
+}
+
#else /* HAVE_JPEG */
#ifdef HAVE_NS
diff --git a/src/indent.c b/src/indent.c
index 160b8c7479..053643e631 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
@@ -122,7 +121,7 @@ disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *w
int i;
if (widthtab->header.size != 256)
- abort ();
+ emacs_abort ();
for (i = 0; i < 256; i++)
if (character_width (i, disptab)
@@ -144,7 +143,7 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
bset_width_table (buf, Fmake_vector (make_number (256), make_number (0)));
widthtab = XVECTOR (BVAR (buf, width_table));
if (widthtab->header.size != 256)
- abort ();
+ emacs_abort ();
for (i = 0; i < 256; i++)
XSETFASTINT (widthtab->contents[i], character_width (i, disptab));
diff --git a/src/insdel.c b/src/insdel.c
index da258c19a1..87010cd825 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
#include <intprops.h>
@@ -69,13 +68,13 @@ check_markers (void)
for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
{
if (tail->buffer->text != current_buffer->text)
- abort ();
+ emacs_abort ();
if (tail->charpos > Z)
- abort ();
+ emacs_abort ();
if (tail->bytepos > Z_BYTE)
- abort ();
+ emacs_abort ();
if (multibyte && ! CHAR_HEAD_P (FETCH_BYTE (tail->bytepos)))
- abort ();
+ emacs_abort ();
}
}
@@ -808,7 +807,7 @@ insert_1_both (const char *string,
#ifdef BYTE_COMBINING_DEBUG
if (count_combining_before (string, nbytes, PT, PT_BYTE)
|| count_combining_after (string, nbytes, PT, PT_BYTE))
- abort ();
+ emacs_abort ();
#endif
/* Record deletion of the surrounding text that combines with
@@ -840,8 +839,7 @@ insert_1_both (const char *string,
PT + nchars, PT_BYTE + nbytes,
before_markers);
- if (buffer_intervals (current_buffer))
- offset_intervals (current_buffer, PT, nchars);
+ offset_intervals (current_buffer, PT, nchars);
if (!inherit && buffer_intervals (current_buffer))
set_text_properties (make_number (PT), make_number (PT + nchars),
@@ -943,7 +941,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
the text that has been stored by copy_text. */
if (count_combining_before (GPT_ADDR, outgoing_nbytes, PT, PT_BYTE)
|| count_combining_after (GPT_ADDR, outgoing_nbytes, PT, PT_BYTE))
- abort ();
+ emacs_abort ();
#endif
record_insert (PT, nchars);
@@ -1126,7 +1124,7 @@ insert_from_buffer_1 (struct buffer *buf,
the text that has been stored by copy_text. */
if (count_combining_before (GPT_ADDR, outgoing_nbytes, PT, PT_BYTE)
|| count_combining_after (GPT_ADDR, outgoing_nbytes, PT, PT_BYTE))
- abort ();
+ emacs_abort ();
#endif
record_insert (PT, nchars);
@@ -1153,8 +1151,7 @@ insert_from_buffer_1 (struct buffer *buf,
PT_BYTE + outgoing_nbytes,
0);
- if (buffer_intervals (current_buffer))
- offset_intervals (current_buffer, PT, nchars);
+ offset_intervals (current_buffer, PT, nchars);
/* Get the intervals for the part of the string we are inserting. */
intervals = buffer_intervals (buf);
@@ -1187,7 +1184,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
#ifdef BYTE_COMBINING_DEBUG
if (count_combining_before (GPT_ADDR, len_byte, from, from_byte)
|| count_combining_after (GPT_ADDR, len_byte, from, from_byte))
- abort ();
+ emacs_abort ();
#endif
if (STRINGP (prev_text))
@@ -1222,8 +1219,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
else if (len < nchars_del)
adjust_overlays_for_delete (from, nchars_del - len);
- if (buffer_intervals (current_buffer))
- offset_intervals (current_buffer, from, len - nchars_del);
+ offset_intervals (current_buffer, from, len - nchars_del);
if (from < PT)
adjust_point (len - nchars_del, len_byte - nbytes_del);
@@ -1370,7 +1366,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
the text that has been stored by copy_text. */
if (count_combining_before (GPT_ADDR, outgoing_insbytes, from, from_byte)
|| count_combining_after (GPT_ADDR, outgoing_insbytes, from, from_byte))
- abort ();
+ emacs_abort ();
#endif
if (! EQ (BVAR (current_buffer, undo_list), Qt))
@@ -1394,16 +1390,16 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
eassert (GPT <= GPT_BYTE);
- /* Adjust the overlay center as needed. This must be done after
- adjusting the markers that bound the overlays. */
- adjust_overlays_for_delete (from, nchars_del);
- adjust_overlays_for_insert (from, inschars);
-
/* Adjust markers for the deletion and the insertion. */
if (markers)
adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
inschars, outgoing_insbytes);
+ /* Adjust the overlay center as needed. This must be done after
+ adjusting the markers that bound the overlays. */
+ adjust_overlays_for_delete (from, nchars_del);
+ adjust_overlays_for_insert (from, inschars);
+
offset_intervals (current_buffer, from, inschars - nchars_del);
/* Get the intervals for the part of the string we are inserting--
@@ -1496,7 +1492,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
the text that has been stored by copy_text. */
if (count_combining_before (GPT_ADDR, insbytes, from, from_byte)
|| count_combining_after (GPT_ADDR, insbytes, from, from_byte))
- abort ();
+ emacs_abort ();
#endif
GAP_SIZE -= insbytes;
@@ -1510,6 +1506,12 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
eassert (GPT <= GPT_BYTE);
+ /* Adjust markers for the deletion and the insertion. */
+ if (markers
+ && ! (nchars_del == 1 && inschars == 1 && nbytes_del == insbytes))
+ adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
+ inschars, insbytes);
+
/* Adjust the overlay center as needed. This must be done after
adjusting the markers that bound the overlays. */
if (nchars_del != inschars)
@@ -1518,12 +1520,6 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
adjust_overlays_for_delete (from + inschars, nchars_del);
}
- /* Adjust markers for the deletion and the insertion. */
- if (markers
- && ! (nchars_del == 1 && inschars == 1 && nbytes_del == insbytes))
- adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
- inschars, insbytes);
-
offset_intervals (current_buffer, from, inschars - nchars_del);
/* Relocate point as if it were a marker. */
@@ -1704,7 +1700,7 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
#ifdef BYTE_COMBINING_DEBUG
if (count_combining_before (BUF_BYTE_ADDRESS (current_buffer, to_byte),
Z_BYTE - to_byte, from, from_byte))
- abort ();
+ emacs_abort ();
#endif
if (ret_string || ! EQ (BVAR (current_buffer, undo_list), Qt))
@@ -2107,7 +2103,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
non-nil, and insertion calls a file handler (e.g. through
lock_file) which scribbles into a temp file -- cyd */
if (!BUFFERP (combine_after_change_buffer)
- || NILP (BVAR (XBUFFER (combine_after_change_buffer), name)))
+ || !BUFFER_LIVE_P (XBUFFER (combine_after_change_buffer)))
{
combine_after_change_list = Qnil;
return Qnil;
diff --git a/src/intervals.c b/src/intervals.c
index 49d61b2f9b..584ee1e923 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -41,7 +41,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define INTERVALS_INLINE EXTERN_INLINE
-#include <setjmp.h>
#include <intprops.h>
#include "lisp.h"
#include "intervals.h"
@@ -199,13 +198,13 @@ intervals_equal (INTERVAL i0, INTERVAL i1)
i0_sym = XCAR (i0_cdr);
i0_cdr = XCDR (i0_cdr);
if (!CONSP (i0_cdr))
- return 0; /* abort (); */
+ return 0;
i1_val = i1->plist;
while (CONSP (i1_val) && !EQ (XCAR (i1_val), i0_sym))
{
i1_val = XCDR (i1_val);
if (!CONSP (i1_val))
- return 0; /* abort (); */
+ return 0;
i1_val = XCDR (i1_val);
}
@@ -223,7 +222,7 @@ intervals_equal (INTERVAL i0, INTERVAL i1)
i1_cdr = XCDR (i1_cdr);
if (!CONSP (i1_cdr))
- return 0; /* abort (); */
+ return 0;
i1_cdr = XCDR (i1_cdr);
}
@@ -674,8 +673,7 @@ find_interval (register INTERVAL tree, register ptrdiff_t position)
eassert (relative_position <= TOTAL_LENGTH (tree));
- if (!handling_signal)
- tree = balance_possible_root_interval (tree);
+ tree = balance_possible_root_interval (tree);
while (1)
{
@@ -1253,7 +1251,7 @@ delete_interval (register INTERVAL i)
else if (STRINGP (owner))
set_string_intervals (owner, parent);
else
- abort ();
+ emacs_abort ();
return;
}
@@ -1408,7 +1406,7 @@ offset_intervals (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length)
start, length);
else
{
- IF_LINT (if (length < - TYPE_MAXIMUM (ptrdiff_t)) abort ();)
+ lint_assume (- TYPE_MAXIMUM (ptrdiff_t) <= length);
adjust_intervals_for_deletion (buffer, start, -length);
}
}
@@ -1468,7 +1466,7 @@ merge_interval_right (register INTERVAL i)
/* This must be the rightmost or last interval and cannot
be merged right. The caller should have known. */
- abort ();
+ emacs_abort ();
}
/* Merge interval I with its lexicographic predecessor. The resulting
@@ -1524,7 +1522,7 @@ merge_interval_left (register INTERVAL i)
/* This must be the leftmost or first interval and cannot
be merged left. The caller should have known. */
- abort ();
+ emacs_abort ();
}
/* Create a copy of SOURCE but with the default value of UP. */
@@ -2170,7 +2168,7 @@ get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val,
else if (STRINGP (object))
i = find_interval (string_intervals (object), pos);
else
- abort ();
+ emacs_abort ();
if (!i || (i->position + LENGTH (i) <= pos))
return 0;
@@ -2209,7 +2207,7 @@ get_local_map (register ptrdiff_t position, register struct buffer *buffer,
/* Perhaps we should just change `position' to the limit. */
if (position > BUF_ZV (buffer) || position < BUF_BEGV (buffer))
- abort ();
+ emacs_abort ();
/* Ignore narrowing, so that a local map continues to be valid even if
the visible region contains no characters and hence no properties. */
diff --git a/src/keyboard.c b/src/keyboard.c
index 992d1a97b3..451ffd9d60 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -21,9 +21,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define KEYBOARD_INLINE EXTERN_INLINE
-#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "termchar.h"
#include "termopts.h"
@@ -57,6 +56,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/ioctl.h>
#endif /* not MSDOS */
+#if defined USABLE_FIONREAD && defined USG5_4
+# include <sys/filio.h>
+#endif
+
#include "syssignal.h"
#include <sys/types.h>
@@ -81,9 +84,7 @@ int interrupt_input_pending;
pending_atimers separately, to reduce code size. So, any code that
changes interrupt_input_pending or pending_atimers should update
this too. */
-#ifdef SYNC_INPUT
int pending_signals;
-#endif
#define KBD_BUFFER_SIZE 4096
@@ -142,7 +143,7 @@ static ptrdiff_t before_command_echo_length;
/* For longjmp to where kbd input is being done. */
-static jmp_buf getcjmp;
+static sys_jmp_buf getcjmp;
/* True while doing kbd input. */
int waiting_for_input;
@@ -386,19 +387,6 @@ int interrupt_input;
/* Nonzero while interrupts are temporarily deferred during redisplay. */
int interrupts_deferred;
-/* Allow configure to inhibit use of FIONREAD. */
-#ifdef BROKEN_FIONREAD
-#undef FIONREAD
-#endif
-
-/* We are unable to use interrupts if FIONREAD is not available,
- so flush SIGIO so we won't try. */
-#if !defined (FIONREAD)
-#ifdef SIGIO
-#undef SIGIO
-#endif
-#endif
-
/* 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. */
#if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_ASYNC_EVENTS)
@@ -444,14 +432,13 @@ static Lisp_Object modify_event_symbol (ptrdiff_t, int, Lisp_Object,
Lisp_Object *, ptrdiff_t);
static Lisp_Object make_lispy_switch_frame (Lisp_Object);
static int help_char_p (Lisp_Object);
-static void save_getcjmp (jmp_buf);
-static void restore_getcjmp (jmp_buf);
+static void save_getcjmp (sys_jmp_buf);
+static void restore_getcjmp (sys_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 void interrupt_signal (int signalnum);
-#ifdef SIGIO
-static void input_available_signal (int signo);
+#ifdef USABLE_SIGIO
+static void deliver_input_available_signal (int signo);
#endif
static void handle_interrupt (void);
static _Noreturn void quit_throw_to_read_char (int);
@@ -459,7 +446,7 @@ static void process_special_events (void);
static void timer_start_idle (void);
static void timer_stop_idle (void);
static void timer_resume_idle (void);
-static void handle_user_signal (int);
+static void deliver_user_signal (int);
static char *find_user_signal_name (int);
static int store_user_signal_events (void);
@@ -1023,7 +1010,7 @@ restore_kboard_configuration (Lisp_Object was_locked)
pop_kboard ();
/* The pop should not change the kboard. */
if (single_kboard && current_kboard != prev)
- abort ();
+ emacs_abort ();
}
return Qnil;
}
@@ -1315,7 +1302,7 @@ usage: (track-mouse BODY...) */)
If ignore_mouse_drag_p is non-zero, ignore (implicit) mouse movement
after resizing the tool-bar window. */
-#if !defined HAVE_WINDOW_SYSTEM
+#if !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS
static
#endif
int ignore_mouse_drag_p;
@@ -2021,17 +2008,9 @@ static struct atimer *poll_timer;
void
poll_for_input_1 (void)
{
-/* Tell ns_read_socket() it is being called asynchronously so it can avoid
- doing anything dangerous. */
-#ifdef HAVE_NS
- ++handling_signal;
-#endif
if (interrupt_input_blocked == 0
&& !waiting_for_input)
read_avail_input (0);
-#ifdef HAVE_NS
- --handling_signal;
-#endif
}
/* Timer callback function for poll_timer. TIMER is equal to
@@ -2042,12 +2021,8 @@ poll_for_input (struct atimer *timer)
{
if (poll_suppress_count == 0)
{
-#ifdef SYNC_INPUT
interrupt_input_pending = 1;
pending_signals = 1;
-#else
- poll_for_input_1 ();
-#endif
}
}
@@ -2326,8 +2301,8 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
{
volatile Lisp_Object c;
ptrdiff_t jmpcount;
- jmp_buf local_getcjmp;
- jmp_buf save_jump;
+ sys_jmp_buf local_getcjmp;
+ sys_jmp_buf save_jump;
volatile int key_already_recorded = 0;
Lisp_Object tem, save;
volatile Lisp_Object previous_echo_area_message;
@@ -2368,15 +2343,6 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
goto reread_first;
}
- if (unread_command_char != -1)
- {
- XSETINT (c, unread_command_char);
- unread_command_char = -1;
-
- reread = 1;
- goto reread_first;
- }
-
if (CONSP (Vunread_command_events))
{
int was_disabled = 0;
@@ -2561,7 +2527,6 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
&& !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event)
/* Don't bring up a menu if we already have another event. */
&& NILP (Vunread_command_events)
- && unread_command_char < 0
&& !detect_input_pending_run_timers (0))
{
c = read_char_minibuf_menu_prompt (commandflag, nmaps, maps);
@@ -2583,7 +2548,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
it *must not* be in effect when we call redisplay. */
jmpcount = SPECPDL_INDEX ();
- if (_setjmp (local_getcjmp))
+ if (sys_setjmp (local_getcjmp))
{
/* Handle quits while reading the keyboard. */
/* We must have saved the outer value of getcjmp here,
@@ -2605,13 +2570,13 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
Lisp_Object last = KVAR (kb, kbd_queue);
/* We shouldn't get here if we were in single-kboard mode! */
if (single_kboard)
- abort ();
+ emacs_abort ();
if (CONSP (last))
{
while (CONSP (XCDR (last)))
last = XCDR (last);
if (!NILP (XCDR (last)))
- abort ();
+ emacs_abort ();
}
if (!CONSP (last))
kset_kbd_queue (kb, Fcons (c, Qnil));
@@ -2697,8 +2662,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
&& !EQ (XCAR (prev_event), Qmenu_bar)
&& !EQ (XCAR (prev_event), Qtool_bar)
/* Don't bring up a menu if we already have another event. */
- && NILP (Vunread_command_events)
- && unread_command_char < 0)
+ && NILP (Vunread_command_events))
{
c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu);
@@ -2784,7 +2748,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
if (current_kboard->kbd_queue_has_data)
{
if (!CONSP (KVAR (current_kboard, kbd_queue)))
- abort ();
+ emacs_abort ();
c = XCAR (KVAR (current_kboard, kbd_queue));
kset_kbd_queue (current_kboard,
XCDR (KVAR (current_kboard, kbd_queue)));
@@ -2851,7 +2815,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
while (CONSP (XCDR (last)))
last = XCDR (last);
if (!NILP (XCDR (last)))
- abort ();
+ emacs_abort ();
}
if (!CONSP (last))
kset_kbd_queue (kb, Fcons (c, Qnil));
@@ -3416,13 +3380,13 @@ record_char (Lisp_Object c)
See read_process_output. */
static void
-save_getcjmp (jmp_buf temp)
+save_getcjmp (sys_jmp_buf temp)
{
memcpy (temp, getcjmp, sizeof getcjmp);
}
static void
-restore_getcjmp (jmp_buf temp)
+restore_getcjmp (sys_jmp_buf temp)
{
memcpy (getcjmp, temp, sizeof getcjmp);
}
@@ -3560,7 +3524,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
struct input_event *hold_quit)
{
if (event->kind == NO_EVENT)
- abort ();
+ emacs_abort ();
if (hold_quit && hold_quit->kind != NO_EVENT)
return;
@@ -3604,7 +3568,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
if (hold_quit)
{
- memcpy (hold_quit, event, sizeof (*event));
+ *hold_quit = *event;
return;
}
@@ -3659,10 +3623,8 @@ kbd_buffer_store_event_hold (register struct input_event *event,
/* 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
+ ignore_sigio ();
stop_polling ();
}
#endif /* subprocesses */
@@ -3681,7 +3643,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
if (immediate_quit && NILP (Vinhibit_quit))
{
immediate_quit = 0;
- sigfree ();
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
QUIT;
}
}
@@ -3831,10 +3793,14 @@ kbd_buffer_get_event (KBOARD **kbp,
/* Start reading input again because we have processed enough to
be able to accept new events again. */
unhold_keyboard_input ();
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
if (!noninteractive)
- signal (SIGIO, input_available_signal);
-#endif /* SIGIO */
+ {
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_input_available_signal);
+ sigaction (SIGIO, &action, 0);
+ }
+#endif
start_polling ();
}
#endif /* subprocesses */
@@ -3876,10 +3842,9 @@ kbd_buffer_get_event (KBOARD **kbp,
/* One way or another, wait until input is available; then, if
interrupt handlers have not read it, read it now. */
-/* Note SIGIO has been undef'd if FIONREAD is missing. */
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
gobble_input (0);
-#endif /* SIGIO */
+#endif
if (kbd_fetch_ptr != kbd_store_ptr)
break;
#if defined (HAVE_MOUSE) || defined (HAVE_GPM)
@@ -3955,7 +3920,7 @@ kbd_buffer_get_event (KBOARD **kbp,
#else
/* We're getting selection request events, but we don't have
a window system. */
- abort ();
+ emacs_abort ();
#endif
}
@@ -4131,7 +4096,7 @@ kbd_buffer_get_event (KBOARD **kbp,
*used_mouse_menu = 1;
#endif
#ifdef HAVE_NS
- /* certain system events are non-key events */
+ /* Certain system events are non-key events. */
if (used_mouse_menu
&& event->kind == NS_NONKEY_EVENT)
*used_mouse_menu = 1;
@@ -4159,7 +4124,7 @@ kbd_buffer_get_event (KBOARD **kbp,
so x remains nil. */
x = Qnil;
- /* XXX Can f or mouse_position_hook be NULL here? */
+ /* XXX Can f or mouse_position_hook be NULL here? */
if (f && FRAME_TERMINAL (f)->mouse_position_hook)
(*FRAME_TERMINAL (f)->mouse_position_hook) (&f, 0, &bar_window,
&part, &x, &y, &t);
@@ -4192,7 +4157,7 @@ kbd_buffer_get_event (KBOARD **kbp,
else
/* We were promised by the above while loop that there was
something for us to read! */
- abort ();
+ emacs_abort ();
input_pending = readable_events (0);
@@ -4261,7 +4226,7 @@ process_special_events (void)
#else
/* We're getting selection request events, but we don't have
a window system. */
- abort ();
+ emacs_abort ();
#endif
}
}
@@ -4351,7 +4316,7 @@ decode_timer (Lisp_Object timer, EMACS_TIME *result)
if (! NILP (vector[0]))
return 0;
- return decode_time_components (vector[1], vector[2], vector[3], vector[4],
+ return decode_time_components (vector[1], vector[2], vector[3], vector[8],
result, 0);
}
@@ -4553,7 +4518,7 @@ in the same style as (current-time).
The value when Emacs is not idle is nil.
-NSEC is a multiple of the system clock resolution. */)
+PSEC is a multiple of the system clock resolution. */)
(void)
{
if (EMACS_TIME_VALID_P (timer_idleness_start_time))
@@ -5614,7 +5579,7 @@ make_lispy_event (struct input_event *event)
else if (FRAMEP (event->frame_or_window))
f = XFRAME (event->frame_or_window);
else
- abort ();
+ emacs_abort ();
if (FRAME_WINDOW_P (f))
fuzz = double_click_fuzz;
@@ -5721,7 +5686,7 @@ make_lispy_event (struct input_event *event)
else
/* Every mouse event should either have the down_modifier or
the up_modifier set. */
- abort ();
+ emacs_abort ();
{
/* Get the symbol we should use for the mouse click. */
@@ -5782,7 +5747,7 @@ make_lispy_event (struct input_event *event)
else if (FRAMEP (event->frame_or_window))
fr = XFRAME (event->frame_or_window);
else
- abort ();
+ emacs_abort ();
fuzz = FRAME_WINDOW_P (fr)
? double_click_fuzz : double_click_fuzz / 8;
@@ -5802,7 +5767,7 @@ make_lispy_event (struct input_event *event)
else
/* Every wheel event should either have the down_modifier or
the up_modifier set. */
- abort ();
+ emacs_abort ();
if (event->kind == HORIZ_WHEEL_EVENT)
symbol_num += 2;
@@ -5971,7 +5936,7 @@ make_lispy_event (struct input_event *event)
{
char *name = find_user_signal_name (event->code);
if (!name)
- abort ();
+ emacs_abort ();
return intern (name);
}
@@ -6052,7 +6017,7 @@ make_lispy_event (struct input_event *event)
/* The 'kind' field of the event is something we don't recognize. */
default:
- abort ();
+ emacs_abort ();
}
}
@@ -6229,7 +6194,7 @@ apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_
/* Only the event queue may use the `up' modifier; it should always
be turned into a click or drag event before presented to lisp code. */
if (modifiers & up_modifier)
- abort ();
+ emacs_abort ();
if (modifiers & alt_modifier) { *p++ = 'A'; *p++ = '-'; }
if (modifiers & ctrl_modifier) { *p++ = 'C'; *p++ = '-'; }
@@ -6324,7 +6289,7 @@ parse_modifiers (Lisp_Object symbol)
Qnil);
if (modifiers & ~INTMASK)
- abort ();
+ emacs_abort ();
XSETFASTINT (mask, modifiers);
elements = Fcons (unmodified, Fcons (mask, Qnil));
@@ -6778,13 +6743,15 @@ get_input_pending (int *addr, int flags)
void
gobble_input (int expected)
{
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
if (interrupt_input)
{
- SIGMASKTYPE mask;
- mask = sigblock (sigmask (SIGIO));
+ sigset_t blocked, procmask;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGIO);
+ pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
read_avail_input (expected);
- sigsetmask (mask);
+ pthread_sigmask (SIG_SETMASK, &procmask, 0);
}
else
#ifdef POLL_FOR_INPUT
@@ -6793,10 +6760,12 @@ gobble_input (int expected)
it's always set. */
if (!interrupt_input && poll_suppress_count == 0)
{
- SIGMASKTYPE mask;
- mask = sigblock (sigmask (SIGALRM));
+ sigset_t blocked, procmask;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGALRM);
+ pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
read_avail_input (expected);
- sigsetmask (mask);
+ pthread_sigmask (SIG_SETMASK, &procmask, 0);
}
else
#endif
@@ -6829,13 +6798,15 @@ record_asynch_buffer_change (void)
return;
/* Make sure no interrupt happens while storing the event. */
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
if (interrupt_input)
{
- SIGMASKTYPE mask;
- mask = sigblock (sigmask (SIGIO));
+ sigset_t blocked, procmask;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGIO);
+ pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
kbd_buffer_store_event (&event);
- sigsetmask (mask);
+ pthread_sigmask (SIG_SETMASK, &procmask, 0);
}
else
#endif
@@ -7001,7 +6972,7 @@ tty_read_avail_input (struct terminal *terminal,
if (terminal->type != output_termcap
&& terminal->type != output_msdos_raw)
- abort ();
+ emacs_abort ();
/* XXX I think the following code should be moved to separate hook
functions in system-dependent files. */
@@ -7053,7 +7024,7 @@ tty_read_avail_input (struct terminal *terminal,
#endif /* HAVE_GPM */
/* Determine how many characters we should *try* to read. */
-#ifdef FIONREAD
+#ifdef USABLE_FIONREAD
/* Find out how much input is available. */
if (ioctl (fileno (tty->input), FIONREAD, &n_to_read) < 0)
{
@@ -7066,14 +7037,12 @@ tty_read_avail_input (struct terminal *terminal,
return 0;
if (n_to_read > sizeof cbuf)
n_to_read = sizeof cbuf;
-#else /* no FIONREAD */
-#if defined (USG) || defined (CYGWIN)
+#elif defined USG || defined CYGWIN
/* Read some input if available, but don't wait. */
n_to_read = sizeof cbuf;
fcntl (fileno (tty->input), F_SETFL, O_NDELAY);
#else
- you lose;
-#endif
+# error "Cannot read without possibly delaying"
#endif
#ifdef subprocesses
@@ -7122,7 +7091,7 @@ tty_read_avail_input (struct terminal *terminal,
#endif
);
-#ifndef FIONREAD
+#ifndef USABLE_FIONREAD
#if defined (USG) || defined (CYGWIN)
fcntl (fileno (tty->input), F_SETFL, 0);
#endif /* USG or CYGWIN */
@@ -7193,19 +7162,12 @@ tty_read_avail_input (struct terminal *terminal,
return nread;
}
-#if defined SYNC_INPUT || defined SIGIO
static void
handle_async_input (void)
{
interrupt_input_pending = 0;
-#ifdef SYNC_INPUT
pending_signals = pending_atimers;
-#endif
-/* Tell ns_read_socket() it is being called asynchronously so it can avoid
- doing anything dangerous. */
-#ifdef HAVE_NS
- ++handling_signal;
-#endif
+
while (1)
{
int nread;
@@ -7216,13 +7178,8 @@ handle_async_input (void)
if (nread <= 0)
break;
}
-#ifdef HAVE_NS
- --handling_signal;
-#endif
}
-#endif /* SYNC_INPUT || SIGIO */
-#ifdef SYNC_INPUT
void
process_pending_signals (void)
{
@@ -7230,33 +7187,25 @@ process_pending_signals (void)
handle_async_input ();
do_pending_atimers ();
}
-#endif
-#ifdef SIGIO /* for entire page */
-/* Note SIGIO has been undef'd if FIONREAD is missing. */
+#ifdef USABLE_SIGIO
static void
-input_available_signal (int signo)
+handle_input_available_signal (int sig)
{
- /* Must preserve main program's value of errno. */
- int old_errno = errno;
- SIGNAL_THREAD_CHECK (signo);
-
-#ifdef SYNC_INPUT
interrupt_input_pending = 1;
pending_signals = 1;
-#endif
if (input_available_clear_time)
*input_available_clear_time = make_emacs_time (0, 0);
+}
-#ifndef SYNC_INPUT
- handle_async_input ();
-#endif
-
- errno = old_errno;
+static void
+deliver_input_available_signal (int sig)
+{
+ handle_on_main_thread (sig, handle_input_available_signal);
}
-#endif /* SIGIO */
+#endif /* USABLE_SIGIO */
/* Send ourselves a SIGIO.
@@ -7267,7 +7216,7 @@ input_available_signal (int signo)
void
reinvoke_input_signal (void)
{
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
handle_async_input ();
#endif
}
@@ -7296,6 +7245,7 @@ static struct user_signal_info *user_signals = NULL;
void
add_user_signal (int sig, const char *name)
{
+ struct sigaction action;
struct user_signal_info *p;
for (p = user_signals; p; p = p->next)
@@ -7310,18 +7260,16 @@ add_user_signal (int sig, const char *name)
p->next = user_signals;
user_signals = p;
- signal (sig, handle_user_signal);
+ emacs_sigaction_init (&action, deliver_user_signal);
+ sigaction (sig, &action, 0);
}
static void
handle_user_signal (int sig)
{
- int old_errno = errno;
struct user_signal_info *p;
const char *special_event_name = NULL;
- SIGNAL_THREAD_CHECK (sig);
-
if (SYMBOLP (Vdebug_on_event))
special_event_name = SSDATA (SYMBOL_NAME (Vdebug_on_event));
@@ -7342,7 +7290,7 @@ handle_user_signal (int sig)
}
p->npending++;
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
if (interrupt_input)
kill (getpid (), SIGIO);
else
@@ -7355,8 +7303,12 @@ handle_user_signal (int sig)
}
break;
}
+}
- errno = old_errno;
+static void
+deliver_user_signal (int sig)
+{
+ handle_on_main_thread (sig, handle_user_signal);
}
static char *
@@ -7381,7 +7333,7 @@ store_user_signal_events (void)
for (p = user_signals; p; p = p->next)
if (p->npending > 0)
{
- SIGMASKTYPE mask;
+ sigset_t blocked, procmask;
if (nstored == 0)
{
@@ -7391,7 +7343,10 @@ store_user_signal_events (void)
}
nstored += p->npending;
- mask = sigblock (sigmask (p->sig));
+ sigemptyset (&blocked);
+ sigaddset (&blocked, p->sig);
+ pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
+
do
{
buf.code = p->sig;
@@ -7399,7 +7354,8 @@ store_user_signal_events (void)
p->npending--;
}
while (p->npending > 0);
- sigsetmask (mask);
+
+ pthread_sigmask (SIG_SETMASK, &procmask, 0);
}
return nstored;
@@ -10438,7 +10394,7 @@ clear_input_pending (void)
int
requeued_events_pending_p (void)
{
- return (!NILP (Vunread_command_events) || unread_command_char != -1);
+ return (!NILP (Vunread_command_events));
}
@@ -10448,7 +10404,7 @@ 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
+ if (!NILP (Vunread_command_events)
|| !NILP (Vunread_post_input_method_events)
|| !NILP (Vunread_input_method_events))
return (Qt);
@@ -10636,7 +10592,6 @@ Also end any kbd macro being defined. */)
update_mode_lines++;
Vunread_command_events = Qnil;
- unread_command_char = -1;
discard_tty_input ();
@@ -10776,17 +10731,10 @@ clear_waiting_for_input (void)
Otherwise, tell QUIT to kill Emacs. */
static void
-interrupt_signal (int signalnum) /* If we don't have an argument, some */
- /* compilers complain in signal calls. */
+handle_interrupt_signal (int sig)
{
- /* Must preserve main program's value of errno. */
- int old_errno = errno;
- struct terminal *terminal;
-
- SIGNAL_THREAD_CHECK (signalnum);
-
/* See if we have an active terminal on our controlling tty. */
- terminal = get_named_tty ("/dev/tty");
+ struct terminal *terminal = get_named_tty ("/dev/tty");
if (!terminal)
{
/* If there are no frames there, let's pretend that we are a
@@ -10807,10 +10755,15 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */
handle_interrupt ();
}
+}
- errno = old_errno;
+static void
+deliver_interrupt_signal (int sig)
+{
+ handle_on_main_thread (sig, handle_interrupt_signal);
}
+
/* If Emacs is stuck because `inhibit-quit' is true, then keep track
of the number of times C-g has been requested. If C-g is pressed
enough times, then quit anyway. See bug#6585. */
@@ -10840,7 +10793,10 @@ handle_interrupt (void)
/* If SIGINT isn't blocked, don't let us be interrupted by
another SIGINT, it might be harmful due to non-reentrancy
in I/O functions. */
- sigblock (sigmask (SIGINT));
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGINT);
+ pthread_sigmask (SIG_BLOCK, &blocked, 0);
fflush (stdout);
reset_all_sys_modes ();
@@ -10902,7 +10858,7 @@ handle_interrupt (void)
#endif /* not MSDOS */
fflush (stdout);
if (((c = getchar ()) & ~040) == 'Y')
- abort ();
+ emacs_abort ();
while (c != '\n') c = getchar ();
#ifdef MSDOS
printf ("\r\nContinuing...\r\n");
@@ -10911,7 +10867,7 @@ handle_interrupt (void)
#endif /* not MSDOS */
fflush (stdout);
init_all_sys_modes ();
- sigfree ();
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
}
else
{
@@ -10924,7 +10880,7 @@ handle_interrupt (void)
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
immediate_quit = 0;
- sigfree ();
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
saved = gl_state;
GCPRO4 (saved.object, saved.global_code,
saved.current_syntax_table, saved.old_prop);
@@ -10969,13 +10925,12 @@ quit_throw_to_read_char (int from_signal)
if (!from_signal && EQ (Vquit_flag, Qkill_emacs))
Fkill_emacs (Qnil);
- sigfree ();
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
/* Prevent another signal from doing this before we finish. */
clear_waiting_for_input ();
input_pending = 0;
Vunread_command_events = Qnil;
- unread_command_char = -1;
#if 0 /* Currently, sit_for is called from read_char without turning
off polling. And that can call set_waiting_for_input.
@@ -10983,7 +10938,7 @@ quit_throw_to_read_char (int from_signal)
#ifdef POLL_FOR_INPUT
/* May be > 1 if in recursive minibuffer. */
if (poll_suppress_count == 0)
- abort ();
+ emacs_abort ();
#endif
#endif
if (FRAMEP (internal_last_event_frame)
@@ -10991,7 +10946,7 @@ quit_throw_to_read_char (int from_signal)
do_switch_frame (make_lispy_switch_frame (internal_last_event_frame),
0, 0, Qnil);
- _longjmp (getcjmp, 1);
+ sys_longjmp (getcjmp, 1);
}
DEFUN ("set-input-interrupt-mode", Fset_input_interrupt_mode,
@@ -11004,8 +10959,7 @@ See also `current-input-mode'. */)
(Lisp_Object interrupt)
{
int new_interrupt_input;
-#ifdef SIGIO
-/* Note SIGIO has been undef'd if FIONREAD is missing. */
+#ifdef USABLE_SIGIO
#ifdef HAVE_X_WINDOWS
if (x_display_list != NULL)
{
@@ -11016,9 +10970,9 @@ See also `current-input-mode'. */)
else
#endif /* HAVE_X_WINDOWS */
new_interrupt_input = !NILP (interrupt);
-#else /* not SIGIO */
+#else /* not USABLE_SIGIO */
new_interrupt_input = 0;
-#endif /* not SIGIO */
+#endif /* not USABLE_SIGIO */
if (new_interrupt_input != interrupt_input)
{
@@ -11341,7 +11295,7 @@ delete_kboard (KBOARD *kb)
for (kbp = &all_kboards; *kbp != kb; kbp = &(*kbp)->next_kboard)
if (*kbp == NULL)
- abort ();
+ emacs_abort ();
*kbp = kb->next_kboard;
/* Prevent a dangling reference to KB. */
@@ -11352,7 +11306,7 @@ delete_kboard (KBOARD *kb)
current_kboard = FRAME_KBOARD (XFRAME (selected_frame));
single_kboard = 0;
if (current_kboard == kb)
- abort ();
+ emacs_abort ();
}
wipe_kboard (kb);
@@ -11362,12 +11316,11 @@ delete_kboard (KBOARD *kb)
void
init_keyboard (void)
{
- /* This is correct before outermost invocation of the editor loop */
+ /* This is correct before outermost invocation of the editor loop. */
command_loop_level = -1;
immediate_quit = 0;
quit_char = Ctl ('g');
Vunread_command_events = Qnil;
- unread_command_char = -1;
timer_idleness_start_time = invalid_emacs_time ();
total_keys = 0;
recent_keys_index = 0;
@@ -11379,9 +11332,7 @@ init_keyboard (void)
input_pending = 0;
interrupt_input_blocked = 0;
interrupt_input_pending = 0;
-#ifdef SYNC_INPUT
pending_signals = 0;
-#endif
/* This means that command_loop_1 won't try to select anything the first
time through. */
@@ -11404,18 +11355,23 @@ init_keyboard (void)
SIGINT. There is special code in interrupt_signal to exit
Emacs on SIGINT when there are no termcap frames on the
controlling terminal. */
- signal (SIGINT, interrupt_signal);
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_interrupt_signal);
+ sigaction (SIGINT, &action, 0);
#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);
+ sigaction (SIGQUIT, &action, 0);
#endif /* not DOS_NT */
}
-/* Note SIGIO has been undef'd if FIONREAD is missing. */
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
if (!noninteractive)
- signal (SIGIO, input_available_signal);
-#endif /* SIGIO */
+ {
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_input_available_signal);
+ sigaction (SIGIO, &action, 0);
+ }
+#endif
/* Use interrupt input by default, if it works and noninterrupt input
has deficiencies. */
@@ -11426,7 +11382,7 @@ init_keyboard (void)
interrupt_input = 0;
#endif
- sigfree ();
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
dribble = 0;
if (keyboard_init_hook)
@@ -11694,9 +11650,6 @@ as they will already have been added once as they were read for the first time.
An element of the form (t . EVENT) forces EVENT to be added to that list. */);
Vunread_command_events = Qnil;
- DEFVAR_INT ("unread-command-char", unread_command_char,
- doc: /* If not -1, an object to be read as next command input event. */);
-
DEFVAR_LISP ("unread-post-input-method-events", Vunread_post_input_method_events,
doc: /* List of events to be processed as input by input methods.
These events are processed before `unread-command-events'
diff --git a/src/keyboard.h b/src/keyboard.h
index 69fa533fd0..3939747abf 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -469,7 +469,7 @@ extern int waiting_for_input;
happens. */
extern EMACS_TIME *input_available_clear_time;
-#if defined HAVE_WINDOW_SYSTEM
+#if defined HAVE_WINDOW_SYSTEM && !defined USE_GTK && !defined HAVE_NS
extern int ignore_mouse_drag_p;
#endif
diff --git a/src/keymap.c b/src/keymap.c
index 85c384b818..66fb52061f 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -40,7 +40,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "commands.h"
#include "character.h"
@@ -2923,7 +2923,7 @@ You type Translation\n\
char *title, *p;
if (!SYMBOLP (modes[i]))
- abort ();
+ emacs_abort ();
p = title = alloca (42 + SCHARS (SYMBOL_NAME (modes[i])));
*p++ = '\f';
diff --git a/src/lisp.h b/src/lisp.h
index b906e4a1df..3a473a60b4 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef EMACS_LISP_H
#define EMACS_LISP_H
+#include <setjmp.h>
#include <stdalign.h>
#include <stdarg.h>
#include <stdbool.h>
@@ -325,7 +326,7 @@ enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 1 };
typedef EMACS_INT Lisp_Object;
#define XLI(o) (o)
#define XIL(i) (i)
-#define LISP_MAKE_RVALUE(o) (0+(o))
+#define LISP_MAKE_RVALUE(o) (0 + (o))
#define LISP_INITIALLY_ZERO 0
enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 0 };
#endif /* CHECK_LISP_OBJECT_TYPE */
@@ -417,9 +418,9 @@ enum lsb_bits
#define XINT(a) (XLI (a) >> INTTYPEBITS)
#define XUINT(a) ((EMACS_UINT) XLI (a) >> INTTYPEBITS)
#define make_number(N) XIL ((EMACS_INT) (N) << INTTYPEBITS)
-#define XSET(var, type, ptr) \
+#define make_lisp_ptr(ptr, type) \
(eassert (XTYPE (XIL ((intptr_t) (ptr))) == 0), /* Check alignment. */ \
- (var) = XIL ((type) | (intptr_t) (ptr)))
+ XIL ((type) | (intptr_t) (ptr)))
#define XPNTR(a) ((intptr_t) (XLI (a) & ~TYPEMASK))
#define XUNTAG(a, type) ((intptr_t) (XLI (a) - (type)))
@@ -444,13 +445,13 @@ static EMACS_INT const VALMASK
#define XUINT(a) ((EMACS_UINT) (XLI (a) & INTMASK))
#define make_number(N) XIL ((EMACS_INT) (N) & INTMASK)
-#define XSET(var, type, ptr) \
- ((var) = XIL ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \
- + ((intptr_t) (ptr) & VALMASK)))
+#define make_lisp_ptr(ptr, type) \
+ (XIL ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \
+ + ((intptr_t) (ptr) & VALMASK)))
#if DATA_SEG_BITS
/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
- which were stored in a Lisp_Object */
+ which were stored in a Lisp_Object. */
#define XPNTR(a) ((uintptr_t) ((XLI (a) & VALMASK)) | DATA_SEG_BITS))
#else
#define XPNTR(a) ((uintptr_t) (XLI (a) & VALMASK))
@@ -554,16 +555,16 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
/* Construct a Lisp_Object from a value or address. */
-#define XSETINT(a, b) (a) = make_number (b)
-#define XSETCONS(a, b) XSET (a, Lisp_Cons, b)
-#define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, b)
-#define XSETSTRING(a, b) XSET (a, Lisp_String, b)
-#define XSETSYMBOL(a, b) XSET (a, Lisp_Symbol, b)
-#define XSETFLOAT(a, b) XSET (a, Lisp_Float, b)
+#define XSETINT(a, b) ((a) = make_number (b))
+#define XSETCONS(a, b) ((a) = make_lisp_ptr (b, Lisp_Cons))
+#define XSETVECTOR(a, b) ((a) = make_lisp_ptr (b, Lisp_Vectorlike))
+#define XSETSTRING(a, b) ((a) = make_lisp_ptr (b, Lisp_String))
+#define XSETSYMBOL(a, b) ((a) = make_lisp_ptr (b, Lisp_Symbol))
+#define XSETFLOAT(a, b) ((a) = make_lisp_ptr (b, Lisp_Float))
/* Misc types. */
-#define XSETMISC(a, b) XSET (a, Lisp_Misc, b)
+#define XSETMISC(a, b) ((a) = make_lisp_ptr (b, Lisp_Misc))
#define XSETMARKER(a, b) (XSETMISC (a, b), XMISCTYPE (a) = Lisp_Misc_Marker)
/* Pseudovector types. */
@@ -909,14 +910,6 @@ enum
(ASCII_CHAR_P (IDX) ? CHAR_TABLE_REF_ASCII ((CT), (IDX)) \
: char_table_ref ((CT), (IDX)))
-/* Almost equivalent to Faref (CT, IDX). However, if the result is
- not a character, return IDX.
-
- For these characters, do not check validity of CT
- and do not follow parent. */
-#define CHAR_TABLE_TRANSLATE(CT, IDX) \
- char_table_translate (CT, IDX)
-
/* Equivalent to Faset (CT, IDX, VAL) with optimization for ASCII and
8-bit European characters. Do not check validity of CT. */
#define CHAR_TABLE_SET(CT, IDX, VAL) \
@@ -1205,9 +1198,9 @@ struct Lisp_Hash_Table
struct Lisp_Hash_Table *next_weak;
/* C function to compare two keys. */
- int (*cmpfn) (struct Lisp_Hash_Table *,
- Lisp_Object, EMACS_UINT,
- Lisp_Object, EMACS_UINT);
+ bool (*cmpfn) (struct Lisp_Hash_Table *,
+ Lisp_Object, EMACS_UINT,
+ Lisp_Object, EMACS_UINT);
/* C function to compute hash code. */
EMACS_UINT (*hashfn) (struct Lisp_Hash_Table *, Lisp_Object);
@@ -1627,7 +1620,7 @@ typedef struct {
int mouse_face_image_state;
} Mouse_HLInfo;
-/* Data type checking */
+/* Data type checking. */
#define NILP(x) EQ (x, Qnil)
@@ -1971,7 +1964,25 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
static struct Lisp_Kboard_Objfwd ko_fwd; \
defvar_kboard (&ko_fwd, lname, offsetof (KBOARD, vname ## _)); \
} while (0)
-
+
+/* Save and restore the instruction and environment pointers,
+ without affecting the signal mask. */
+
+#ifdef HAVE__SETJMP
+typedef jmp_buf sys_jmp_buf;
+# define sys_setjmp(j) _setjmp (j)
+# define sys_longjmp(j, v) _longjmp (j, v)
+#elif defined HAVE_SIGSETJMP
+typedef sigjmp_buf sys_jmp_buf;
+# define sys_setjmp(j) sigsetjmp (j, 0)
+# define sys_longjmp(j, v) siglongjmp (j, v)
+#else
+/* A platform that uses neither _longjmp nor siglongjmp; assume
+ longjmp does not affect the sigmask. */
+typedef jmp_buf sys_jmp_buf;
+# define sys_setjmp(j) setjmp (j)
+# define sys_longjmp(j, v) longjmp (j, v)
+#endif
/* Structure for recording Lisp call stack for backtrace purposes. */
@@ -2000,7 +2011,7 @@ struct specbinding
{
Lisp_Object symbol, old_value;
specbinding_func func;
- Lisp_Object unused; /* Dividing by 16 is faster than by 12 */
+ Lisp_Object unused; /* Dividing by 16 is faster than by 12. */
};
extern struct specbinding *specpdl;
@@ -2009,7 +2020,10 @@ extern ptrdiff_t specpdl_size;
#define SPECPDL_INDEX() (specpdl_ptr - specpdl)
-/* Everything needed to describe an active condition case. */
+/* Everything needed to describe an active condition case.
+
+ Members are volatile if their values need to survive _longjmp when
+ a 'struct handler' is a local variable. */
struct handler
{
/* The handler clauses and variable from the condition-case form. */
@@ -2020,10 +2034,12 @@ struct handler
error: handle all conditions, and errors can run the debugger
or display a backtrace. */
Lisp_Object handler;
- Lisp_Object var;
+
+ Lisp_Object volatile var;
+
/* Fsignal stores here the condition-case clause that applies,
and Fcondition_case thus knows which clause to run. */
- Lisp_Object chosen_clause;
+ Lisp_Object volatile chosen_clause;
/* Used to effect the longjump out to the handler. */
struct catchtag *tag;
@@ -2049,19 +2065,21 @@ struct handler
of the catch form.
All the other members are concerned with restoring the interpreter
- state. */
+ state.
+ Members are volatile if their values need to survive _longjmp when
+ a 'struct catchtag' is a local variable. */
struct catchtag
{
Lisp_Object tag;
- Lisp_Object val;
- struct catchtag *next;
+ Lisp_Object volatile val;
+ struct catchtag *volatile next;
struct gcpro *gcpro;
- jmp_buf jmp;
+ sys_jmp_buf jmp;
struct backtrace *backlist;
struct handler *handlerlist;
EMACS_INT lisp_eval_depth;
- ptrdiff_t pdlcount;
+ ptrdiff_t volatile pdlcount;
int poll_suppress_count;
int interrupt_input_blocked;
struct byte_stack *byte_stack;
@@ -2089,22 +2107,16 @@ extern char *stack_bottom;
If quit-flag is set to `kill-emacs' the SIGINT handler has received
a request to exit Emacs when it is safe to do. */
-#ifdef SYNC_INPUT
extern void process_pending_signals (void);
extern int pending_signals;
-#define ELSE_PENDING_SIGNALS \
- else if (pending_signals) \
- process_pending_signals ();
-#else /* not SYNC_INPUT */
-#define ELSE_PENDING_SIGNALS
-#endif /* not SYNC_INPUT */
extern void process_quit_flag (void);
#define QUIT \
do { \
if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
process_quit_flag (); \
- ELSE_PENDING_SIGNALS \
+ else if (pending_signals) \
+ process_pending_signals (); \
} while (0)
@@ -2288,7 +2300,7 @@ extern int gcpro_level;
#define UNGCPRO \
((--gcpro_level != gcpro1.level) \
- ? (abort (), 0) \
+ ? (emacs_abort (), 0) \
: ((gcprolist = gcpro1.next), 0))
#endif /* DEBUG_GCPRO */
@@ -2567,8 +2579,7 @@ extern Lisp_Object Qchar_table_p, Qvector_or_char_table_p;
extern Lisp_Object Qcdr;
-extern Lisp_Object Qrange_error, Qdomain_error, Qsingularity_error;
-extern Lisp_Object Qoverflow_error, Qunderflow_error;
+extern Lisp_Object Qrange_error, Qoverflow_error;
extern Lisp_Object Qfloatp;
extern Lisp_Object Qnumberp, Qnumber_or_marker_p;
@@ -2579,10 +2590,10 @@ extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
EXFUN (Fbyteorder, 0) ATTRIBUTE_CONST;
-/* Defined in frame.c */
+/* Defined in frame.c. */
extern Lisp_Object Qframep;
-/* Defined in data.c */
+/* Defined in data.c. */
extern Lisp_Object indirect_function (Lisp_Object);
extern Lisp_Object find_symbol_value (Lisp_Object);
@@ -2629,7 +2640,7 @@ extern void swap_in_global_binding (struct Lisp_Symbol *);
extern void syms_of_cmds (void);
extern void keys_of_cmds (void);
-/* Defined in coding.c */
+/* Defined in coding.c. */
extern Lisp_Object Qcharset;
extern Lisp_Object detect_coding_system (const unsigned char *, ptrdiff_t,
ptrdiff_t, bool, bool, Lisp_Object);
@@ -2637,7 +2648,7 @@ extern void init_coding (void);
extern void init_coding_once (void);
extern void syms_of_coding (void);
-/* Defined in character.c */
+/* Defined in character.c. */
EXFUN (Fmax_char, 0) ATTRIBUTE_CONST;
extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t);
extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t);
@@ -2645,21 +2656,21 @@ extern int multibyte_char_to_unibyte (int) ATTRIBUTE_CONST;
extern int multibyte_char_to_unibyte_safe (int) ATTRIBUTE_CONST;
extern void syms_of_character (void);
-/* Defined in charset.c */
+/* Defined in charset.c. */
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 */
+/* Defined in composite.c. */
extern void syms_of_composite (void);
-/* Defined in syntax.c */
+/* Defined in syntax.c. */
extern void init_syntax_once (void);
extern void syms_of_syntax (void);
-/* Defined in fns.c */
+/* Defined in fns.c. */
extern Lisp_Object QCrehash_size, QCrehash_threshold;
enum { NEXT_ALMOST_PRIME_LIMIT = 11 };
EXFUN (Fidentity, 1) ATTRIBUTE_CONST;
@@ -2693,13 +2704,12 @@ extern Lisp_Object string_to_multibyte (Lisp_Object);
extern Lisp_Object string_make_unibyte (Lisp_Object);
extern void syms_of_fns (void);
-/* Defined in floatfns.c */
+/* Defined in floatfns.c. */
extern double extract_float (Lisp_Object);
-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 */
+/* Defined in fringe.c. */
extern void syms_of_fringe (void);
extern void init_fringe (void);
#ifdef HAVE_WINDOW_SYSTEM
@@ -2707,13 +2717,13 @@ extern void mark_fringe_data (void);
extern void init_fringe_once (void);
#endif /* HAVE_WINDOW_SYSTEM */
-/* Defined in image.c */
+/* Defined in image.c. */
extern Lisp_Object QCascent, QCmargin, QCrelief;
extern Lisp_Object QCconversion;
extern int x_bitmap_mask (struct frame *, ptrdiff_t);
extern void syms_of_image (void);
-/* Defined in insdel.c */
+/* Defined in insdel.c. */
extern Lisp_Object Qinhibit_modification_hooks;
extern void move_gap (ptrdiff_t);
extern void move_gap_both (ptrdiff_t, ptrdiff_t);
@@ -2759,7 +2769,7 @@ extern void replace_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
const char *, ptrdiff_t, ptrdiff_t, bool);
extern void syms_of_insdel (void);
-/* Defined in dispnew.c */
+/* Defined in dispnew.c. */
#if (defined PROFILING \
&& (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__))
_Noreturn void __executable_start (void);
@@ -2770,7 +2780,7 @@ extern Lisp_Object sit_for (Lisp_Object, bool, int);
extern void init_display (void);
extern void syms_of_display (void);
-/* Defined in xdisp.c */
+/* Defined in xdisp.c. */
extern Lisp_Object Qinhibit_point_motion_hooks;
extern Lisp_Object Qinhibit_redisplay, Qdisplay;
extern Lisp_Object Qmenu_bar_update_hook;
@@ -2821,17 +2831,15 @@ extern Lisp_Object safe_eval (Lisp_Object);
extern int pos_visible_p (struct window *, ptrdiff_t, int *,
int *, int *, int *, int *, int *);
-/* Defined in xsettings.c */
+/* Defined in xsettings.c. */
extern void syms_of_xsettings (void);
/* Defined in vm-limit.c. */
extern void memory_warnings (void *, void (*warnfun) (const char *));
-/* Defined in alloc.c */
+/* Defined in alloc.c. */
extern void check_pure_size (void);
extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT);
-extern void reset_malloc_hooks (void);
-extern void uninterrupt_malloc (void);
extern void malloc_warning (const char *);
extern _Noreturn void memory_full (size_t);
extern _Noreturn void buffer_memory_full (ptrdiff_t);
@@ -2930,7 +2938,7 @@ extern void check_cons_list (void);
#endif
#ifdef REL_ALLOC
-/* Defined in ralloc.c */
+/* Defined in ralloc.c. */
extern void *r_alloc (void **, size_t);
extern void r_alloc_free (void **);
extern void *r_re_alloc (void **, size_t);
@@ -2938,7 +2946,7 @@ extern void r_alloc_reset_variable (void **, void **);
extern void r_alloc_inhibit_buffer_relocation (int);
#endif
-/* Defined in chartab.c */
+/* Defined in chartab.c. */
extern Lisp_Object copy_char_table (Lisp_Object);
extern Lisp_Object char_table_ref (Lisp_Object, int);
extern Lisp_Object char_table_ref_and_range (Lisp_Object, int,
@@ -2956,7 +2964,7 @@ extern void map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Ob
extern Lisp_Object uniprop_table (Lisp_Object);
extern void syms_of_chartab (void);
-/* Defined in print.c */
+/* Defined in print.c. */
extern Lisp_Object Vprin1_to_string_buffer;
extern void debug_print (Lisp_Object) EXTERNALLY_VISIBLE;
extern Lisp_Object Qstandard_output;
@@ -2973,7 +2981,7 @@ enum FLOAT_TO_STRING_BUFSIZE { FLOAT_TO_STRING_BUFSIZE = 350 };
extern int float_to_string (char *, double);
extern void syms_of_print (void);
-/* Defined in doprnt.c */
+/* Defined in doprnt.c. */
extern ptrdiff_t doprnt (char *, ptrdiff_t, const char *, const char *,
va_list);
extern ptrdiff_t esprintf (char *, char const *, ...)
@@ -2988,6 +2996,7 @@ extern ptrdiff_t evxprintf (char **, ptrdiff_t *, char const *, ptrdiff_t,
/* Defined in lread.c. */
extern Lisp_Object Qvariable_documentation, Qstandard_input;
extern Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction;
+extern Lisp_Object Qlexical_binding;
extern Lisp_Object check_obarray (Lisp_Object);
extern Lisp_Object intern_1 (const char *, ptrdiff_t);
extern Lisp_Object intern_c_string_1 (const char *, ptrdiff_t);
@@ -3021,12 +3030,11 @@ intern_c_string (const char *str)
/* Defined in eval.c. */
extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qmacro;
-extern Lisp_Object Qinhibit_quit, Qclosure;
+extern Lisp_Object Qinhibit_quit, Qinternal_interpreter_environment, Qclosure;
extern Lisp_Object Qand_rest;
extern Lisp_Object Vautoload_queue;
extern Lisp_Object Vsignaling_function;
extern Lisp_Object inhibit_lisp_code;
-extern int handling_signal;
#if BYTE_MARK_STACK
extern struct catchtag *catchlist;
extern struct handler *handlerlist;
@@ -3075,6 +3083,7 @@ extern _Noreturn void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
extern _Noreturn void verror (const char *, va_list)
ATTRIBUTE_FORMAT_PRINTF (1, 0);
extern Lisp_Object un_autoload (Lisp_Object);
+extern Lisp_Object call_debugger (Lisp_Object arg);
extern void init_eval_once (void);
extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object, ...);
extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object);
@@ -3137,7 +3146,7 @@ extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object,
extern Lisp_Object build_marker (struct buffer *, ptrdiff_t, ptrdiff_t);
extern void syms_of_marker (void);
-/* Defined in fileio.c */
+/* Defined in fileio.c. */
extern Lisp_Object Qfile_error;
extern Lisp_Object Qfile_exists_p;
@@ -3145,16 +3154,16 @@ extern Lisp_Object Qfile_directory_p;
extern Lisp_Object Qinsert_file_contents;
extern Lisp_Object Qfile_name_history;
extern Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
-EXFUN (Fread_file_name, 6); /* not a normal DEFUN */
+EXFUN (Fread_file_name, 6); /* Not a normal DEFUN. */
extern Lisp_Object close_file_unwind (Lisp_Object);
extern Lisp_Object restore_point_unwind (Lisp_Object);
extern _Noreturn void report_file_error (const char *, Lisp_Object);
-extern int internal_delete_file (Lisp_Object);
+extern void internal_delete_file (Lisp_Object);
extern void syms_of_fileio (void);
-extern Lisp_Object make_temp_name (Lisp_Object, int);
+extern Lisp_Object make_temp_name (Lisp_Object, bool);
extern Lisp_Object Qdelete_file;
-/* Defined in search.c */
+/* Defined in search.c. */
extern void shrink_regexp_cache (void);
extern void restore_search_regs (void);
extern void record_unwind_save_match_data (void);
@@ -3227,9 +3236,7 @@ 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);
-#ifdef SIGDANGER
extern void force_auto_save_soon (void);
-#endif
extern void init_keyboard (void);
extern void syms_of_keyboard (void);
extern void keys_of_keyboard (void);
@@ -3257,14 +3264,12 @@ extern void syms_of_frame (void);
extern char **initial_argv;
extern int initial_argc;
#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
-extern int display_arg;
+extern bool display_arg;
#endif
extern Lisp_Object decode_env_path (const char *, const char *);
extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
extern Lisp_Object Qfile_name_handler_alist;
-#ifdef FLOAT_CATCH_SIGILL
-extern void fatal_error_signal (int);
-#endif
+extern _Noreturn void fatal_error_backtrace (int, int);
extern Lisp_Object Qkill_emacs;
#if HAVE_SETLOCALE
void fixup_locale (void);
@@ -3276,22 +3281,26 @@ void synchronize_system_time_locale (void);
#define synchronize_system_messages_locale()
#define synchronize_system_time_locale()
#endif
-void shut_down_emacs (int, int, Lisp_Object);
-/* Nonzero means don't do interactive redisplay and don't change tty modes. */
-extern int noninteractive;
+extern void shut_down_emacs (int, Lisp_Object);
-/* Nonzero means remove site-lisp directories from load-path. */
-extern int no_site_lisp;
+/* True means don't do interactive redisplay and don't change tty modes. */
+extern bool noninteractive;
+
+/* True means remove site-lisp directories from load-path. */
+extern bool no_site_lisp;
/* Pipe used to send exit notification to the daemon parent at
startup. */
extern int daemon_pipe[2];
#define IS_DAEMON (daemon_pipe[1] != 0)
-/* Nonzero means don't do use window-system-specific display code. */
-extern int inhibit_window_system;
-/* Nonzero means that a filter or a sentinel is running. */
-extern int running_asynch_code;
+/* True if handling a fatal error already. */
+extern bool fatal_error_in_progress;
+
+/* True means don't do use window-system-specific display code. */
+extern bool inhibit_window_system;
+/* True means that a filter or a sentinel is running. */
+extern bool running_asynch_code;
/* Defined in process.c. */
extern Lisp_Object QCtype, Qlocal;
@@ -3329,14 +3338,14 @@ extern void init_callproc (void);
extern void set_initial_environment (void);
extern void syms_of_callproc (void);
-/* Defined in doc.c */
+/* Defined in doc.c. */
extern Lisp_Object Qfunction_documentation;
extern Lisp_Object read_doc_string (Lisp_Object);
extern Lisp_Object get_doc_string (Lisp_Object, bool, bool);
extern void syms_of_doc (void);
extern int read_bytecode_char (bool);
-/* Defined in bytecode.c */
+/* Defined in bytecode.c. */
extern Lisp_Object Qbytecode;
extern void syms_of_bytecode (void);
extern struct byte_stack *byte_stack_list;
@@ -3347,12 +3356,12 @@ extern void unmark_byte_stack (void);
extern Lisp_Object exec_byte_code (Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object, ptrdiff_t, Lisp_Object *);
-/* Defined in macros.c */
+/* Defined in macros.c. */
extern Lisp_Object Qexecute_kbd_macro;
extern void init_macros (void);
extern void syms_of_macros (void);
-/* Defined in undo.c */
+/* Defined in undo.c. */
extern Lisp_Object Qapply;
extern Lisp_Object Qinhibit_read_only;
extern void truncate_undo_list (struct buffer *);
@@ -3365,7 +3374,7 @@ extern void record_property_change (ptrdiff_t, ptrdiff_t,
Lisp_Object, Lisp_Object,
Lisp_Object);
extern void syms_of_undo (void);
-/* Defined in textprop.c */
+/* 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;
@@ -3373,19 +3382,19 @@ extern Lisp_Object Qminibuffer_prompt;
extern void report_interval_modification (Lisp_Object, Lisp_Object);
-/* Defined in menu.c */
+/* Defined in menu.c. */
extern void syms_of_menu (void);
-/* Defined in xmenu.c */
+/* Defined in xmenu.c. */
extern void syms_of_xmenu (void);
-/* Defined in termchar.h */
+/* Defined in termchar.h. */
struct tty_display_info;
-/* Defined in termhooks.h */
+/* Defined in termhooks.h. */
struct terminal;
-/* Defined in sysdep.c */
+/* Defined in sysdep.c. */
#ifndef HAVE_GET_CURRENT_DIR_NAME
extern char *get_current_dir_name (void);
#endif
@@ -3407,6 +3416,8 @@ extern int set_window_size (int, int, int);
extern EMACS_INT get_random (void);
extern void seed_random (void *, ptrdiff_t);
extern void init_random (void);
+extern void emacs_backtrace (int);
+extern _Noreturn void emacs_abort (void) NO_INLINE;
extern int emacs_open (const char *, int, int);
extern int emacs_close (int);
extern ptrdiff_t emacs_read (int, char *, ptrdiff_t);
@@ -3420,45 +3431,45 @@ extern void unlock_file (Lisp_Object);
extern void unlock_buffer (struct buffer *);
extern void syms_of_filelock (void);
-/* Defined in sound.c */
+/* Defined in sound.c. */
extern void syms_of_sound (void);
-/* Defined in category.c */
+/* Defined in category.c. */
extern void init_category_once (void);
extern Lisp_Object char_category_set (int);
extern void syms_of_category (void);
-/* Defined in ccl.c */
+/* Defined in ccl.c. */
extern void syms_of_ccl (void);
-/* Defined in dired.c */
+/* Defined in dired.c. */
extern void syms_of_dired (void);
extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
Lisp_Object, Lisp_Object,
bool, Lisp_Object);
-/* Defined in term.c */
+/* Defined in term.c. */
extern int *char_ins_del_vector;
extern void syms_of_term (void);
extern _Noreturn void fatal (const char *msgid, ...)
ATTRIBUTE_FORMAT_PRINTF (1, 2);
-/* Defined in terminal.c */
+/* Defined in terminal.c. */
extern void syms_of_terminal (void);
-/* Defined in font.c */
+/* Defined in font.c. */
extern void syms_of_font (void);
extern void init_font (void);
#ifdef HAVE_WINDOW_SYSTEM
-/* Defined in fontset.c */
+/* Defined in fontset.c. */
extern void syms_of_fontset (void);
-/* Defined in xfns.c, w32fns.c, or macfns.c */
+/* Defined in xfns.c, w32fns.c, or macfns.c. */
extern Lisp_Object Qfont_param;
#endif
-/* Defined in xfaces.c */
+/* Defined in xfaces.c. */
extern Lisp_Object Qdefault, Qtool_bar, Qfringe;
extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor;
extern Lisp_Object Qmode_line_inactive;
@@ -3466,31 +3477,34 @@ 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 Qextra_light, Qlight, Qsemi_light, Qsemi_bold;
+extern Lisp_Object Qbold, Qextra_bold, Qultra_bold;
+extern Lisp_Object Qoblique, Qitalic;
extern Lisp_Object Vface_alternative_font_family_alist;
extern Lisp_Object Vface_alternative_font_registry_alist;
extern void syms_of_xfaces (void);
#ifdef HAVE_X_WINDOWS
-/* Defined in xfns.c */
+/* Defined in xfns.c. */
extern void syms_of_xfns (void);
-/* Defined in xsmfns.c */
+/* Defined in xsmfns.c. */
extern void syms_of_xsmfns (void);
-/* Defined in xselect.c */
+/* Defined in xselect.c. */
extern void syms_of_xselect (void);
-/* Defined in xterm.c */
+/* Defined in xterm.c. */
extern void syms_of_xterm (void);
#endif /* HAVE_X_WINDOWS */
#ifdef HAVE_WINDOW_SYSTEM
-/* Defined in xterm.c, nsterm.m, w32term.c */
+/* Defined in xterm.c, nsterm.m, w32term.c. */
extern char *x_get_keysym_name (int);
#endif /* HAVE_WINDOW_SYSTEM */
#ifdef HAVE_LIBXML2
-/* Defined in xml.c */
+/* Defined in xml.c. */
extern void syms_of_xml (void);
extern void xml_cleanup_parser (void);
#endif
@@ -3501,20 +3515,20 @@ extern int have_menus_p (void);
#endif
#ifdef HAVE_DBUS
-/* Defined in dbusbind.c */
+/* Defined in dbusbind.c. */
void syms_of_dbusbind (void);
#endif
#ifdef DOS_NT
-/* Defined in msdos.c, w32.c */
+/* Defined in msdos.c, w32.c. */
extern char *emacs_root_dir (void);
#endif /* DOS_NT */
-/* Nonzero means Emacs has already been initialized.
+/* True means Emacs has already been initialized.
Used during startup to detect startup of dumped Emacs. */
-extern int initialized;
+extern bool initialized;
-extern int immediate_quit; /* Nonzero means ^G can quit instantly */
+extern int immediate_quit; /* Nonzero means ^G can quit instantly. */
extern void *xmalloc (size_t);
extern void *xzalloc (size_t);
@@ -3544,36 +3558,10 @@ extern void init_system_name (void);
#define make_fixnum_or_float(val) \
(FIXNUM_OVERFLOW_P (val) ? make_float (val) : make_number (val))
-
-/* Checks the `cycle check' variable CHECK to see if it indicates that
- EL is part of a cycle; CHECK must be either Qnil or a value returned
- by an earlier use of CYCLE_CHECK. SUSPICIOUS is the number of
- elements after which a cycle might be suspected; after that many
- elements, this macro begins consing in order to keep more precise
- track of elements.
-
- Returns nil if a cycle was detected, otherwise a new value for CHECK
- that includes EL.
-
- CHECK is evaluated multiple times, EL and SUSPICIOUS 0 or 1 times, so
- the caller should make sure that's ok. */
-
-#define CYCLE_CHECK(check, el, suspicious) \
- (NILP (check) \
- ? make_number (0) \
- : (INTEGERP (check) \
- ? (XFASTINT (check) < (suspicious) \
- ? make_number (XFASTINT (check) + 1) \
- : Fcons (el, Qnil)) \
- : (!NILP (Fmemq ((el), (check))) \
- ? Qnil \
- : Fcons ((el), (check)))))
-
-
/* SAFE_ALLOCA normally allocates memory on the stack, but if size is
larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */
-enum MAX_ALLOCA { MAX_ALLOCA = 16*1024 };
+enum MAX_ALLOCA { MAX_ALLOCA = 16 * 1024 };
extern Lisp_Object safe_alloca_unwind (Lisp_Object);
extern void *record_xmalloc (size_t);
diff --git a/src/lisp.mk b/src/lisp.mk
index 162d881991..3d60e07dea 100644
--- a/src/lisp.mk
+++ b/src/lisp.mk
@@ -65,6 +65,7 @@ lisp = \
$(lispsource)/format.elc \
$(lispsource)/bindings.elc \
$(lispsource)/files.elc \
+ $(lispsource)/emacs-lisp/macroexp.elc \
$(lispsource)/cus-face.elc \
$(lispsource)/faces.elc \
$(lispsource)/button.elc \
diff --git a/src/lread.c b/src/lread.c
index aa3e0cfc5b..08d5f97292 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -25,7 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/file.h>
#include <errno.h>
#include <limits.h> /* For CHAR_BIT. */
-#include <setjmp.h>
#include <stat-time.h>
#include "lisp.h"
#include "intervals.h"
@@ -50,7 +49,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif
#include <unistd.h>
-#include <math.h>
#ifdef HAVE_SETLOCALE
#include <locale.h>
@@ -89,8 +87,6 @@ static Lisp_Object Qget_emacs_mule_file_char;
static Lisp_Object Qload_force_doc_strings;
-extern Lisp_Object Qinternal_interpreter_environment;
-
static Lisp_Object Qload_in_progress;
/* The association list of objects read with the #n=object form.
@@ -1682,6 +1678,17 @@ readevalloop (Lisp_Object readcharfun,
int whole_buffer = 0;
/* 1 on the first time around. */
int first_sexp = 1;
+ Lisp_Object macroexpand = intern ("internal-macroexpand-for-load");
+
+ if (NILP (Ffboundp (macroexpand))
+ /* Don't macroexpand in .elc files, since it should have been done
+ already. We actually don't know whether we're in a .elc file or not,
+ so we use circumstancial evidence: .el files normally go through
+ Vload_source_file_function -> load-with-code-conversion
+ -> eval-buffer. */
+ || EQ (readcharfun, Qget_file_char)
+ || EQ (readcharfun, Qget_emacs_mule_file_char))
+ macroexpand = Qnil;
if (MARKERP (readcharfun))
{
@@ -1696,7 +1703,7 @@ readevalloop (Lisp_Object readcharfun,
/* We assume START is nil when input is not from a buffer. */
if (! NILP (start) && !b)
- abort ();
+ emacs_abort ();
specbind (Qstandard_input, readcharfun); /* GCPROs readcharfun. */
specbind (Qcurrent_load_list, Qnil);
@@ -1726,7 +1733,7 @@ readevalloop (Lisp_Object readcharfun,
{
ptrdiff_t count1 = SPECPDL_INDEX ();
- if (b != 0 && NILP (BVAR (b, name)))
+ if (b != 0 && !BUFFER_LIVE_P (b))
error ("Reading from killed buffer");
if (!NILP (start))
@@ -1811,6 +1818,8 @@ readevalloop (Lisp_Object readcharfun,
unbind_to (count1, Qnil);
/* Now eval what we just read. */
+ if (!NILP (macroexpand))
+ val = call1 (macroexpand, val);
val = eval_sub (val);
if (printflag)
@@ -3673,7 +3682,7 @@ intern_c_string_1 (const char *str, ptrdiff_t len)
/* Creating a non-pure string from a string literal not
implemented yet. We could just use make_string here and live
with the extra copy. */
- abort ();
+ emacs_abort ();
return Fintern (make_pure_c_string (str, len), obarray);
}
diff --git a/src/macros.c b/src/macros.c
index e81068181b..a507f12e34 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -19,7 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "macros.h"
#include "commands.h"
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index a8dcf5f2ae..24ecb2676d 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -482,7 +482,6 @@ WINDOW_H = $(SRC)/window.h \
$(BLD)/alloc.$(O) : \
$(SRC)/alloc.c \
$(SRC)/puresize.h \
- $(SRC)/syssignal.h \
$(SRC)/w32.h \
$(NT_INC)/unistd.h \
$(GNU_LIB)/verify.h \
@@ -1365,6 +1364,7 @@ $(BLD)/sysdep.$(O) : \
$(NT_INC)/sys/stat.h \
$(NT_INC)/unistd.h \
$(GNU_LIB)/allocator.h \
+ $(GNU_LIB)/execinfo.h \
$(GNU_LIB)/ignore-value.h \
$(GNU_LIB)/utimens.h \
$(BLOCKINPUT_H) \
diff --git a/src/marker.c b/src/marker.c
index 4ea06c7cd5..0c4e8cb3b5 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -18,7 +18,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
@@ -59,7 +59,7 @@ byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos)
bytepos - BUF_BEG_BYTE (b));
if (charpos - 1 != nchars)
- abort ();
+ emacs_abort ();
}
#else /* not MARKER_DEBUG */
@@ -67,7 +67,7 @@ byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos)
#define byte_char_debug_check(b, charpos, bytepos) do { } while (0)
#endif /* MARKER_DEBUG */
-
+
void
clear_charpos_cache (struct buffer *b)
{
@@ -142,7 +142,7 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
ptrdiff_t best_below, best_below_byte;
if (charpos < BUF_BEG (b) || charpos > BUF_Z (b))
- abort ();
+ emacs_abort ();
best_above = BUF_Z (b);
best_above_byte = BUF_Z_BYTE (b);
@@ -296,7 +296,7 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
ptrdiff_t best_below, best_below_byte;
if (bytepos < BUF_BEG_BYTE (b) || bytepos > BUF_Z_BYTE (b))
- abort ();
+ emacs_abort ();
best_above = BUF_Z (b);
best_above_byte = BUF_Z_BYTE (b);
@@ -407,7 +407,7 @@ Returns nil if MARKER points into a dead buffer. */)
does not preserve the buffer from being GC'd (it's weak), so
markers have to be unlinked from their buffer as soon as the buffer
is killed. */
- eassert (!NILP (BVAR (XBUFFER (buf), name)));
+ eassert (BUFFER_LIVE_P (XBUFFER (buf)));
return buf;
}
return Qnil;
@@ -462,13 +462,13 @@ live_buffer (Lisp_Object buffer)
if (NILP (buffer))
{
b = current_buffer;
- eassert (!NILP (BVAR (b, name)));
+ eassert (BUFFER_LIVE_P (b));
}
else
{
CHECK_BUFFER (buffer);
b = XBUFFER (buffer);
- if (NILP (BVAR (b, name)))
+ if (!BUFFER_LIVE_P (b))
b = NULL;
}
return b;
@@ -506,7 +506,7 @@ set_marker_internal (Lisp_Object marker, Lisp_Object position,
else
{
register ptrdiff_t charpos, bytepos;
-
+
CHECK_NUMBER_COERCE_MARKER (position);
charpos = clip_to_bounds (restricted ? BUF_BEGV (b) : BUF_BEG (b),
XINT (position),
@@ -570,8 +570,8 @@ set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer,
if (b)
{
- attach_marker
- (m, b,
+ attach_marker
+ (m, b,
clip_to_bounds (BUF_BEGV (b), charpos, BUF_ZV (b)),
clip_to_bounds (BUF_BEGV_BYTE (b), bytepos, BUF_ZV_BYTE (b)));
}
@@ -595,7 +595,7 @@ unchain_marker (register struct Lisp_Marker *marker)
register struct Lisp_Marker *tail, **prev;
/* No dead buffers here. */
- eassert (!NILP (BVAR (b, name)));
+ eassert (BUFFER_LIVE_P (b));
marker->buffer = NULL;
prev = &BUF_MARKERS (b);
@@ -605,12 +605,12 @@ unchain_marker (register struct Lisp_Marker *marker)
{
if (*prev == BUF_MARKERS (b))
{
- /* Deleting first marker from the buffer's chain. Crash
+ /* Deleting first marker from the buffer's chain. Crash
if new first marker in chain does not say it belongs
to the same buffer, or at least that they have the same
base buffer. */
if (tail->next && b->text != tail->next->buffer->text)
- abort ();
+ emacs_abort ();
}
*prev = tail->next;
/* We have removed the marker from the chain;
diff --git a/src/menu.c b/src/menu.c
index 336e1a9e31..31b96cf440 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <limits.h> /* for INT_MAX */
#include "lisp.h"
@@ -737,7 +736,7 @@ digest_single_submenu (int start, int end, int top_level_items)
/* All items should be contained in panes. */
if (panes_seen == 0)
- abort ();
+ emacs_abort ();
item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
@@ -811,7 +810,7 @@ digest_single_submenu (int start, int end, int top_level_items)
else if (EQ (type, QCtoggle))
wv->button_type = BUTTON_TYPE_TOGGLE;
else
- abort ();
+ emacs_abort ();
wv->selected = !NILP (selected);
if (! STRINGP (help))
diff --git a/src/minibuf.c b/src/minibuf.c
index 41cc48017e..8a1e0ddde8 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <errno.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "commands.h"
@@ -110,7 +109,7 @@ choose_minibuf_frame (void)
/* I don't think that any frames may validly have a null minibuffer
window anymore. */
if (NILP (sf->minibuffer_window))
- abort ();
+ emacs_abort ();
/* Under X, we come here with minibuf_window being the
minibuffer window of the unused termcap window created in
@@ -798,7 +797,7 @@ get_minibuffer (EMACS_INT depth)
Vminibuffer_list = nconc2 (Vminibuffer_list, tail);
}
buf = Fcar (tail);
- if (NILP (buf) || NILP (BVAR (XBUFFER (buf), name)))
+ if (NILP (buf) || !BUFFER_LIVE_P (XBUFFER (buf)))
{
buf = Fget_buffer_create
(make_formatted_string (name, " *Minibuf-%"pI"d*", depth));
@@ -1860,7 +1859,6 @@ the values STRING, PREDICATE and `lambda'. */)
}
static Lisp_Object Qmetadata;
-extern Lisp_Object Qbuffer;
DEFUN ("internal-complete-buffer", Finternal_complete_buffer, Sinternal_complete_buffer, 3, 3, 0,
doc: /* Perform completion on buffer names.
diff --git a/src/msdos.c b/src/msdos.c
index a214456d10..ed5d3240aa 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -796,7 +796,7 @@ IT_set_face (int face)
/* The default face for the frame should always be realized and
cached. */
if (!fp)
- abort ();
+ emacs_abort ();
}
screen_face = face;
fg = fp->foreground;
@@ -1029,7 +1029,6 @@ IT_clear_end_of_line (struct frame *f, int first_unused)
{
char *spaces, *sp;
int i, j, offset = 2 * (new_pos_X + screen_size_X * new_pos_Y);
- extern int fatal_error_in_progress;
struct tty_display_info *tty = FRAME_TTY (f);
if (new_pos_X >= first_unused || fatal_error_in_progress)
@@ -1394,7 +1393,7 @@ IT_insert_glyphs (struct frame *f, struct glyph *start, int len)
static void
IT_delete_glyphs (struct frame *f, int n)
{
- abort ();
+ emacs_abort ();
}
/* set-window-configuration on window.c needs this. */
@@ -3014,7 +3013,7 @@ XMenuAddPane (Display *foo, XMenu *menu, const char *txt, int enable)
const char *p;
if (!enable)
- abort ();
+ emacs_abort ();
IT_menu_make_room (menu);
menu->submenu[menu->count] = IT_menu_create ();
@@ -4120,7 +4119,7 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
FD_ZERO (efds);
if (nfds != 1)
- abort ();
+ emacs_abort ();
/* If we are looking only for the terminal, with no timeout,
just read it and wait -- that's more efficient. */
@@ -4215,26 +4214,8 @@ init_gettimeofday (void)
}
#endif
-#ifdef abort
-#undef abort
void
-dos_abort (char *file, int line)
-{
- char buffer1[200], buffer2[400];
- int i, j;
-
- sprintf (buffer1, "<EMACS FATAL ERROR IN %s LINE %d>", file, line);
- for (i = j = 0; buffer1[i]; i++) {
- buffer2[j++] = buffer1[i];
- buffer2[j++] = 0x70;
- }
- dosmemput (buffer2, j, (int)ScreenPrimary);
- ScreenSetCursor (2, 0);
- abort ();
-}
-#else
-void
-abort (void)
+emacs_abort (void)
{
dos_ttcooked ();
ScreenSetCursor (10, 0);
@@ -4250,7 +4231,6 @@ abort (void)
#endif /* __DJGPP_MINOR__ >= 2 */
exit (2);
}
-#endif
void
syms_of_msdos (void)
diff --git a/src/ns.mk b/src/ns.mk
deleted file mode 100644
index 77fbf5845d..0000000000
--- a/src/ns.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-### autodeps.mk --- src/Makefile fragment for GNU Emacs
-
-## Copyright (C) 2008-2012 Free Software Foundation, Inc.
-
-## This file is part of GNU Emacs.
-
-## GNU Emacs is free software: you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## GNU Emacs is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
-
-### 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
diff --git a/src/nsfns.m b/src/nsfns.m
index e8b5d22077..072005d2d3 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -30,9 +30,7 @@ GNUstep port and post-20 update by Adrian Robert ([email protected])
interpretation of even the system includes. */
#include <config.h>
-#include <signal.h>
#include <math.h>
-#include <setjmp.h>
#include <c-strcase.h>
#include "lisp.h"
@@ -1798,19 +1796,6 @@ terminate Emacs if we can't open the connection.
SSDATA (display));
}
- /* Register our external input/output types, used for determining
- applicable services and also drag/drop eligibility. */
- ns_send_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] retain];
- ns_return_types = [[NSArray arrayWithObjects: NSStringPboardType, nil]
- retain];
- ns_drag_types = [[NSArray arrayWithObjects:
- NSStringPboardType,
- NSTabularTextPboardType,
- NSFilenamesPboardType,
- NSURLPboardType,
- NSColorPboardType,
- NSFontPboardType, nil] retain];
-
return Qnil;
}
diff --git a/src/nsfont.m b/src/nsfont.m
index 412a6777c6..eba1eb0476 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -23,7 +23,6 @@ Author: Adrian Robert ([email protected])
/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "dispextern.h"
@@ -625,7 +624,7 @@ static unsigned int nsfont_encode_char (struct font *font, int c);
static int nsfont_text_extents (struct font *font, unsigned int *code,
int nglyphs, struct font_metrics *metrics);
static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
- int with_background);
+ bool with_background);
struct font_driver nsfont_driver =
{
@@ -833,7 +832,6 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
font = (struct font *) font_info;
font->pixel_size = [sfont pointSize];
font->driver = &nsfont_driver;
- font->encoding_type = FONT_ENCODING_NOT_DECIDED;
font->encoding_charset = -1;
font->repertory_charset = -1;
font->default_ascent = 0;
@@ -1042,12 +1040,12 @@ nsfont_text_extents (struct font *font, unsigned int *code, int nglyphs,
/* 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). */
+ position of frame F with S->FACE and S->GC. If WITH_BACKGROUND,
+ fill the background in advance. It is assured that WITH_BACKGROUND
+ is false when (FROM > 0 || TO < S->nchars). */
static int
nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
- int with_background)
+ bool with_background)
/* NOTE: focus and clip must be set
also, currently assumed (true in nsterm.m call) from ==0, to ==nchars */
{
@@ -1330,7 +1328,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block)
font_info->glyphs[block] = xmalloc (0x100 * sizeof (unsigned short));
if (!unichars || !(font_info->glyphs[block]))
- abort ();
+ emacs_abort ();
/* create a string containing all Unicode characters in this block */
for (idx = block<<8, i = 0; i < 0x100; idx++, i++)
@@ -1405,7 +1403,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics));
if (!(font_info->metrics[block]))
- abort ();
+ emacs_abort ();
metrics = font_info->metrics[block];
for (g = block<<8, i =0; i<0x100 && g < numGlyphs; g++, i++, metrics++)
diff --git a/src/nsimage.m b/src/nsimage.m
index 8a8a3ddaae..668664c7a2 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -28,7 +28,6 @@ GNUstep port and post-20 update by Adrian Robert ([email protected])
/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "dispextern.h"
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 9e29048621..907d3eac62 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -24,7 +24,6 @@ Carbon version by Yamamoto Mitsuharu. */
/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "window.h"
@@ -589,10 +588,7 @@ extern NSString *NSMenuDidBeginTrackingNotification;
From 10.6 on, we could also use -[NSMenu propertiesToUpdate]: In the
key press case, NSMenuPropertyItemImage (e.g.) won't be set.
*/
- if (trackingMenu == 0
- /* Also, don't try this if from an event picked up asynchronously,
- as lots of lisp evaluation happens in ns_update_menubar. */
- || handling_signal != 0)
+ if (trackingMenu == 0)
return;
/*fprintf (stderr, "Updating menu '%s'\n", [[self title] UTF8String]); NSLog (@"%@\n", event); */
ns_update_menubar (frame, 1, self);
@@ -948,7 +944,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
else if (EQ (type, QCradio))
wv->button_type = BUTTON_TYPE_RADIO;
else
- abort ();
+ emacs_abort ();
wv->selected = !NILP (selected);
diff --git a/src/nsselect.m b/src/nsselect.m
index e0bbfe5863..95bc1a9595 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -28,7 +28,6 @@ GNUstep port and post-20 update by Adrian Robert ([email protected])
/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "nsterm.h"
diff --git a/src/nsterm.h b/src/nsterm.h
index f0cae19300..f3adab883a 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -103,6 +103,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
- (void) setWindowClosing: (BOOL)closing;
- (EmacsToolbar *) toolbar;
- (void) deleteWorkingText;
+- (void) updateFrameSize: (BOOL) delay;
#ifdef NS_IMPL_GNUSTEP
/* Not declared, but useful. */
diff --git a/src/nsterm.m b/src/nsterm.m
index c892a5486a..0b26508dbd 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -35,7 +35,6 @@ GNUstep port and post-20 update by Adrian Robert ([email protected])
#include <time.h>
#include <signal.h>
#include <unistd.h>
-#include <setjmp.h>
#include <c-ctype.h>
#include <c-strcase.h>
@@ -627,6 +626,8 @@ ns_update_begin (struct frame *f)
-------------------------------------------------------------------------- */
{
NSView *view = FRAME_NS_VIEW (f);
+ NSRect r = [view frame];
+ NSBezierPath *bp;
NSTRACE (ns_update_begin);
ns_update_auto_hide_menu_bar ();
@@ -634,6 +635,14 @@ ns_update_begin (struct frame *f)
ns_updating_frame = f;
[view lockFocus];
+ /* drawRect may have been called for say the minibuffer, and then clip path
+ is for the minibuffer. But the display engine may draw more because
+ we have set the frame as garbaged. So reset clip path to the whole
+ view. */
+ bp = [[NSBezierPath bezierPathWithRect: r] retain];
+ [bp setClip];
+ [bp release];
+
#ifdef NS_IMPL_GNUSTEP
uRect = NSMakeRect (0, 0, 0, 0);
#endif
@@ -650,7 +659,6 @@ ns_update_window_begin (struct window *w)
struct frame *f = XFRAME (WINDOW_FRAME (w));
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
NSTRACE (ns_update_window_begin);
-
updated_window = w;
set_output_cursor (&w->cursor);
@@ -871,25 +879,12 @@ ns_clip_to_row (struct window *w, struct glyph_row *row, int area, BOOL gc)
window_box (w, area, &window_x, &window_y, &window_width, 0);
- clip_rect.origin.x = window_x - FRAME_INTERNAL_BORDER_WIDTH (f);
+ clip_rect.origin.x = window_x;
clip_rect.origin.y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, row->y));
clip_rect.origin.y = max (clip_rect.origin.y, window_y);
- clip_rect.size.width = window_width + 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
+ clip_rect.size.width = window_width;
clip_rect.size.height = row->visible_height;
- /* allow a full-height row at the top when requested
- (used to draw fringe all the way through internal border area) */
- if (gc && clip_rect.origin.y < 5)
- {
- clip_rect.origin.y -= FRAME_INTERNAL_BORDER_WIDTH (f);
- clip_rect.size.height += FRAME_INTERNAL_BORDER_WIDTH (f);
- }
-
- /* likewise at bottom */
- if (gc &&
- FRAME_PIXEL_HEIGHT (f) - (clip_rect.origin.y + clip_rect.size.height) < 5)
- clip_rect.size.height += FRAME_INTERNAL_BORDER_WIDTH (f);
-
ns_focus (f, &clip_rect, 1);
}
@@ -1237,18 +1232,10 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
NSRect wr = [window frame];
int tb = FRAME_EXTERNAL_TOOL_BAR (f);
int pixelwidth, pixelheight;
- static int oldRows, oldCols, oldFontWidth, oldFontHeight;
- static int oldTB;
- static struct frame *oldF;
NSTRACE (x_set_window_size);
- if (view == nil ||
- (f == oldF
- && rows == oldRows && cols == oldCols
- && oldFontWidth == FRAME_COLUMN_WIDTH (f)
- && oldFontHeight == FRAME_LINE_HEIGHT (f)
- && oldTB == tb))
+ if (view == nil)
return;
/*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */
@@ -1256,12 +1243,6 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
BLOCK_INPUT;
check_frame_size (f, &rows, &cols);
- oldF = f;
- oldRows = rows;
- oldCols = cols;
- oldFontWidth = FRAME_COLUMN_WIDTH (f);
- oldFontHeight = FRAME_LINE_HEIGHT (f);
- oldTB = tb;
f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f);
compute_fringe_widths (f, 0);
@@ -1939,7 +1920,7 @@ ns_redraw_scroll_bars (struct frame *f)
int i;
id view;
NSArray *subviews = [[FRAME_NS_VIEW (f) superview] subviews];
- NSTRACE (ns_judge_scroll_bars);
+ NSTRACE (ns_redraw_scroll_bars);
for (i =[subviews count]-1; i >= 0; i--)
{
view = [subviews objectAtIndex: i];
@@ -2125,9 +2106,9 @@ ns_after_update_window_line (struct glyph_row *desired_row)
desired_row->redraw_fringe_bitmaps_p = 1;
/* When a window has disappeared, make sure that no rest of
- full-width rows stays visible in the internal border.
- Under NS this is drawn inside the fringes. */
+ full-width rows stays visible in the internal border. */
if (windows_or_buffers_changed
+ && desired_row->full_width_p
&& (f = XFRAME (w->frame),
width = FRAME_INTERNAL_BORDER_WIDTH (f),
width != 0)
@@ -2136,24 +2117,11 @@ ns_after_update_window_line (struct glyph_row *desired_row)
{
int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
- /* Internal border is drawn below the tool bar. */
- if (WINDOWP (f->tool_bar_window)
- && w == XWINDOW (f->tool_bar_window))
- y -= width;
- /* end copy from other terms */
-
BLOCK_INPUT;
- if (!desired_row->full_width_p)
- {
- int x1 = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w)
- + WINDOW_LEFT_FRINGE_WIDTH (w);
- int x2 = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w)
- + FRAME_PIXEL_WIDTH (f) - NS_SCROLL_BAR_WIDTH (f)
- - WINDOW_RIGHT_FRINGE_WIDTH (w)
- - FRAME_INTERNAL_BORDER_WIDTH (f);
- ns_clear_frame_area (f, x1, y, width, height);
- ns_clear_frame_area (f, x2, y, width, height);
- }
+ ns_clear_frame_area (f, 0, y, width, height);
+ ns_clear_frame_area (f,
+ FRAME_PIXEL_WIDTH (f) - width,
+ y, width, height);
UNBLOCK_INPUT;
}
}
@@ -2238,17 +2206,6 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
int rowY;
static EmacsImage **bimgs = NULL;
static int nBimgs = 0;
- /* NS-specific: move internal border inside fringe */
- int x = p->bx < 0 ? p->x : p->bx;
- int wd = p->bx < 0 ? p->wd : p->nx;
- BOOL fringeOnVeryLeft
- = x - WINDOW_LEFT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w)
- - FRAME_INTERNAL_BORDER_WIDTH (f) < 10;
- BOOL fringeOnVeryRight
- = FRAME_PIXEL_WIDTH (f) - x - wd - FRAME_INTERNAL_BORDER_WIDTH (f)
- - WINDOW_RIGHT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) < 10;
- int xAdjust = FRAME_INTERNAL_BORDER_WIDTH (f) *
- (fringeOnVeryLeft ? -1 : (fringeOnVeryRight ? 1 : 0));
/* grow bimgs if needed */
if (nBimgs < max_used_fringe_bitmap)
@@ -2263,22 +2220,68 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
ns_clip_to_row (w, row, -1, YES);
- if (p->bx >= 0 && !p->overlay_p)
+ if (!p->overlay_p)
{
- 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
- + (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];
- NSRectFill (r);
+ int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny;
+
+ /* If the fringe is adjacent to the left (right) scroll bar of a
+ leftmost (rightmost, respectively) window, then extend its
+ background to the gap between the fringe and the bar. */
+ if ((WINDOW_LEFTMOST_P (w)
+ && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
+ || (WINDOW_RIGHTMOST_P (w)
+ && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)))
+ {
+ int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
+
+ if (sb_width > 0)
+ {
+ int bar_area_x = WINDOW_SCROLL_BAR_AREA_X (w);
+ int bar_area_width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w)
+ * FRAME_COLUMN_WIDTH (f));
+
+ if (bx < 0)
+ {
+ /* Bitmap fills the fringe. */
+ if (bar_area_x + bar_area_width == p->x)
+ bx = bar_area_x + sb_width;
+ else if (p->x + p->wd == bar_area_x)
+ bx = bar_area_x;
+ if (bx >= 0)
+ {
+ int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
+
+ nx = bar_area_width - sb_width;
+ by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,
+ row->y));
+ ny = row->visible_height;
+ }
+ }
+ else
+ {
+ if (bar_area_x + bar_area_width == bx)
+ {
+ bx = bar_area_x + sb_width;
+ nx += bar_area_width - sb_width;
+ }
+ else if (bx + nx == bar_area_x)
+ nx += bar_area_width - sb_width;
+ }
+ }
+ }
+
+ if (bx >= 0 && nx > 0)
+ {
+ NSRect r = NSMakeRect (bx, by, nx, ny);
+ NSRectClip (r);
+ [ns_lookup_indexed_color (face->background, f) set];
+ NSRectFill (r);
+ }
}
if (p->which)
{
- NSRect r = NSMakeRect (p->x+xAdjust, p->y, p->wd, p->h);
+ NSRect r = NSMakeRect (p->x, p->y, p->wd, p->h);
EmacsImage *img = bimgs[p->which - 1];
if (!img)
@@ -2288,7 +2291,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
int i;
unsigned char *cbits = xmalloc (len);
- for (i =0; i<len; i++)
+ for (i = 0; i < len; i++)
cbits[i] = ~(bits[i] & 0xff);
img = [[EmacsImage alloc] initFromXBM: cbits width: 8 height: p->h
flip: NO];
@@ -2302,12 +2305,20 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
[ns_lookup_indexed_color(face->background, f) set];
NSRectFill (r);
[img setXBMColor: ns_lookup_indexed_color(face->foreground, f)];
+#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
[img drawInRect: r
fromRect: NSZeroRect
operation: NSCompositeSourceOver
fraction: 1.0
respectFlipped: YES
hints: nil];
+#else
+ {
+ NSPoint pt = r.origin;
+ pt.y += p->h;
+ [img compositeToPoint: pt operation: NSCompositeSourceOver];
+ }
+#endif
}
ns_unfocus (f);
}
@@ -2386,14 +2397,6 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
r.size.height = h;
r.size.width = w->phys_cursor_width;
- /* FIXME: if we overwrite the internal border area, it does not get erased;
- fix by truncating cursor, but better would be to erase properly */
- overspill = r.origin.x + r.size.width -
- WINDOW_TEXT_TO_FRAME_PIXEL_X (w, WINDOW_BOX_RIGHT_EDGE_X (w)
- - WINDOW_TOTAL_FRINGE_WIDTH (w) - FRAME_INTERNAL_BORDER_WIDTH (f));
- if (overspill > 0)
- r.size.width -= overspill;
-
/* TODO: only needed in rare cases with last-resort font in HELLO..
should we do this more efficiently? */
ns_clip_to_row (w, glyph_row, -1, NO); /* do ns_focus(f, &r, 1); if remove */
@@ -2517,31 +2520,6 @@ hide_hourglass (void)
========================================================================== */
-
-static inline NSRect
-ns_fix_rect_ibw (NSRect r, int fibw, int frame_pixel_width)
-/* --------------------------------------------------------------------------
- Under NS we draw internal borders inside fringes, and want full-width
- rendering to go all the way to edge. This function makes that correction.
- -------------------------------------------------------------------------- */
-{
- if (r.origin.y <= fibw+1)
- {
- r.size.height += r.origin.y;
- r.origin.y = 0;
- }
- if (r.origin.x <= fibw+1)
- {
- r.size.width += r.origin.x;
- r.origin.x = 0;
- }
- if (frame_pixel_width - (r.origin.x+r.size.width) <= fibw+1)
- r.size.width += fibw;
-
- return r;
-}
-
-
static int
ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr)
/* --------------------------------------------------------------------------
@@ -2551,14 +2529,6 @@ ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr)
-------------------------------------------------------------------------- */
{
int n = get_glyph_string_clip_rects (s, nr, 2);
- if (s->row->full_width_p)
- {
- *nr = ns_fix_rect_ibw (*nr, FRAME_INTERNAL_BORDER_WIDTH (s->f),
- FRAME_PIXEL_WIDTH (s->f));
- if (n == 2)
- *nr = ns_fix_rect_ibw (*(nr+1), FRAME_INTERNAL_BORDER_WIDTH (s->f),
- FRAME_PIXEL_WIDTH (s->f));
- }
return n;
}
@@ -2883,11 +2853,6 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s)
r = NSMakeRect (s->x, s->y, right_x - s->x + 1, s->height);
- /* expand full-width row over internal borders */
- if (s->row->full_width_p)
- r = ns_fix_rect_ibw (r, FRAME_INTERNAL_BORDER_WIDTH (s->f),
- FRAME_PIXEL_WIDTH (s->f));
-
/* TODO: Sometimes box_color is 0 and this seems wrong; should investigate. */
if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color)
{
@@ -2943,26 +2908,6 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p)
NSRect r = NSMakeRect (s->x, s->y + box_line_width,
s->background_width,
s->height-2*box_line_width);
-
- /* expand full-width row over internal borders */
- if (s->row->full_width_p)
- {
- int fibw = FRAME_INTERNAL_BORDER_WIDTH (s->f);
- if (r.origin.y <= fibw+1 + box_line_width)
- {
- r.size.height += r.origin.y;
- r.origin.y = 0;
- }
- if (r.origin.x <= fibw+1)
- {
- r.size.width += 2*r.origin.x;
- r.origin.x = 0;
- }
- if (FRAME_PIXEL_WIDTH (s->f) - (r.origin.x + r.size.width)
- <= fibw+1)
- r.size.width += fibw;
- }
-
NSRectFill (r);
}
@@ -3028,34 +2973,23 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
br = NSMakeRect (x, y, s->slice.width, s->slice.height);
}
- /* expand full-width row over internal borders */
- if (s->row->full_width_p)
- {
- int fibw = FRAME_INTERNAL_BORDER_WIDTH (s->f);
- if (br.origin.y <= fibw+1 + box_line_vwidth)
- {
- br.size.height += br.origin.y;
- br.origin.y = 0;
- }
- if (br.origin.x <= fibw+1 + box_line_vwidth)
- {
- br.size.width += br.origin.x;
- br.origin.x = 0;
- }
- if (FRAME_PIXEL_WIDTH (s->f) - (br.origin.x + br.size.width) <= fibw+1)
- br.size.width += fibw;
- }
-
NSRectFill (br);
/* Draw the image.. do we need to draw placeholder if img ==nil? */
if (img != nil)
+ {
+#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
[img drawInRect: br
- fromRect: NSZeroRect
+ fromRect: NSZeroRect
operation: NSCompositeSourceOver
fraction: 1.0
respectFlipped: YES
hints: nil];
+#else
+ [img compositeToPoint: NSMakePoint (x, y + s->slice.height)
+ operation: NSCompositeSourceOver];
+#endif
+ }
if (s->hl == DRAW_CURSOR)
{
@@ -3143,7 +3077,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
bgCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f);
fgCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f);
- for (i=0; i<n; i++)
+ for (i = 0; i < n; ++i)
{
if (!s->row->full_width_p)
{
@@ -3173,13 +3107,6 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
r[i].size.height = min (s->height, s->row->visible_height);
}
- /* expand full-width rows over internal borders */
- else
- {
- r[i] = ns_fix_rect_ibw (r[i], FRAME_INTERNAL_BORDER_WIDTH (s->f),
- FRAME_PIXEL_WIDTH (s->f));
- }
-
[bgCol set];
/* NOTE: under NS this is NOT used to draw cursors, but we must avoid
@@ -3340,7 +3267,7 @@ ns_draw_glyph_string (struct glyph_string *s)
break;
default:
- abort ();
+ emacs_abort ();
}
/* Draw box if not done already. */
@@ -3428,16 +3355,12 @@ ns_read_socket (struct terminal *terminal, int expected,
if (interrupt_input_blocked)
{
interrupt_input_pending = 1;
-#ifdef SYNC_INPUT
pending_signals = 1;
-#endif
return -1;
}
interrupt_input_pending = 0;
-#ifdef SYNC_INPUT
pending_signals = pending_atimers;
-#endif
BLOCK_INPUT;
n_emacs_events_pending = 0;
@@ -3475,7 +3398,7 @@ ns_read_socket (struct terminal *terminal, int expected,
if (++apploopnr != 1)
{
- abort ();
+ emacs_abort ();
}
[NSApp run];
--apploopnr;
@@ -3515,7 +3438,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
[outerpool release];
outerpool = [[NSAutoreleasePool alloc] init];
-
+
send_appdefined = YES;
if (nr > 0)
{
@@ -3568,7 +3491,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
emacs_event = &event;
if (++apploopnr != 1)
{
- abort();
+ emacs_abort ();
}
[NSApp run];
--apploopnr;
@@ -3586,7 +3509,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
{
int t;
if ([ev type] != NSApplicationDefined)
- abort ();
+ emacs_abort ();
t = [ev data1];
last_appdefined_event = 0;
@@ -3639,9 +3562,9 @@ ns_set_vertical_scroll_bar (struct window *window,
struct frame *f = XFRAME (WINDOW_FRAME (window));
EmacsView *view = FRAME_NS_VIEW (f);
int window_y, window_height;
- BOOL barOnVeryLeft, barOnVeryRight;
int top, left, height, width, sb_width, sb_left;
EmacsScroller *bar;
+ BOOL fringe_extended_p;
/* optimization; display engine sends WAY too many of these.. */
if (!NILP (window->vertical_scroll_bar))
@@ -3668,26 +3591,27 @@ ns_set_vertical_scroll_bar (struct window *window,
width = WINDOW_CONFIG_SCROLL_BAR_COLS (window) * FRAME_COLUMN_WIDTH (f);
left = WINDOW_SCROLL_BAR_AREA_X (window);
- if (top < 5) /* top scrollbar adjustment */
- {
- top -= FRAME_INTERNAL_BORDER_WIDTH (f);
- height += FRAME_INTERNAL_BORDER_WIDTH (f);
- }
-
/* allow for displaying a skinnier scrollbar than char area allotted */
sb_width = (WINDOW_CONFIG_SCROLL_BAR_WIDTH (window) > 0) ?
WINDOW_CONFIG_SCROLL_BAR_WIDTH (window) : width;
-
- barOnVeryLeft = left < 5;
- barOnVeryRight = FRAME_PIXEL_WIDTH (f) - left - width < 5;
- sb_left = left + FRAME_INTERNAL_BORDER_WIDTH (f)
- * (barOnVeryLeft ? -1 : (barOnVeryRight ? 1 : 0));
+ sb_left = left;
r = NSMakeRect (sb_left, top, sb_width, height);
/* the parent view is flipped, so we need to flip y value */
v = [view frame];
r.origin.y = (v.size.height - r.size.height - r.origin.y);
+ if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (window))
+ fringe_extended_p = (WINDOW_LEFTMOST_P (window)
+ && WINDOW_LEFT_FRINGE_WIDTH (window)
+ && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (window)
+ || WINDOW_LEFT_MARGIN_COLS (window) == 0));
+ else
+ fringe_extended_p = (WINDOW_RIGHTMOST_P (window)
+ && WINDOW_RIGHT_FRINGE_WIDTH (window)
+ && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (window)
+ || WINDOW_RIGHT_MARGIN_COLS (window) == 0));
+
XSETWINDOW (win, window);
BLOCK_INPUT;
@@ -3707,7 +3631,14 @@ ns_set_vertical_scroll_bar (struct window *window,
if (NILP (window->vertical_scroll_bar))
{
- ns_clear_frame_area (f, sb_left, top, width, height);
+ if (width > 0 && height > 0)
+ {
+ if (fringe_extended_p)
+ ns_clear_frame_area (f, sb_left, top, sb_width, height);
+ else
+ ns_clear_frame_area (f, left, top, width, height);
+ }
+
bar = [[EmacsScroller alloc] initFrame: r window: win];
wset_vertical_scroll_bar (window, make_save_value (bar, 0));
}
@@ -3778,14 +3709,21 @@ ns_judge_scroll_bars (struct frame *f)
{
int i;
id view;
- NSArray *subviews = [[FRAME_NS_VIEW (f) superview] subviews];
+ EmacsView *eview = FRAME_NS_VIEW (f);
+ NSArray *subviews = [[eview superview] subviews];
+ BOOL removed = NO;
+
NSTRACE (ns_judge_scroll_bars);
- for (i =[subviews count]-1; i >= 0; i--)
+ for (i = [subviews count]-1; i >= 0; --i)
{
view = [subviews objectAtIndex: i];
if (![view isKindOfClass: [EmacsScroller class]]) continue;
[view judge];
+ removed = YES;
}
+
+ if (removed)
+ [eview updateFrameSize: NO];
}
@@ -4035,33 +3973,34 @@ ns_term_init (Lisp_Object display_name)
static int ns_initialized = 0;
Lisp_Object tmp;
+ if (ns_initialized) return x_display_list;
+ ns_initialized = 1;
+
NSTRACE (ns_term_init);
+ [outerpool release];
+ outerpool = [[NSAutoreleasePool alloc] init];
+
/* count object allocs (About, click icon); on OS X use ObjectAlloc tool */
/*GSDebugAllocationActive (YES); */
BLOCK_INPUT;
- handling_signal = 0;
- if (!ns_initialized)
- {
- baud_rate = 38400;
- Fset_input_interrupt_mode (Qnil);
+ baud_rate = 38400;
+ Fset_input_interrupt_mode (Qnil);
- if (selfds[0] == -1)
+ if (selfds[0] == -1)
+ {
+ if (pipe (selfds) == -1)
{
- if (pipe (selfds) == -1)
- {
- fprintf (stderr, "Failed to create pipe: %s\n",
- emacs_strerror (errno));
- abort ();
- }
-
- fcntl (selfds[0], F_SETFL, O_NONBLOCK|fcntl (selfds[0], F_GETFL));
- FD_ZERO (&select_readfds);
- FD_ZERO (&select_writefds);
- pthread_mutex_init (&select_mutex, NULL);
+ fprintf (stderr, "Failed to create pipe: %s\n",
+ emacs_strerror (errno));
+ emacs_abort ();
}
- ns_initialized = 1;
+
+ fcntl (selfds[0], F_SETFL, O_NONBLOCK|fcntl (selfds[0], F_GETFL));
+ FD_ZERO (&select_readfds);
+ FD_ZERO (&select_writefds);
+ pthread_mutex_init (&select_mutex, NULL);
}
ns_pending_files = [[NSMutableArray alloc] init];
@@ -4252,6 +4191,20 @@ ns_term_init (Lisp_Object display_name)
}
#endif /* MAC OS X menu setup */
+ /* Register our external input/output types, used for determining
+ applicable services and also drag/drop eligibility. */
+ ns_send_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] retain];
+ ns_return_types = [[NSArray arrayWithObjects: NSStringPboardType, nil]
+ retain];
+ ns_drag_types = [[NSArray arrayWithObjects:
+ NSStringPboardType,
+ NSTabularTextPboardType,
+ NSFilenamesPboardType,
+ NSURLPboardType,
+ NSColorPboardType,
+ NSFontPboardType, nil] retain];
+
+
[NSApp run];
ns_do_open_file = YES;
return dpyinfo;
@@ -4273,7 +4226,7 @@ ns_term_shutdown (int sig)
}
else // force a stack trace to happen
{
- abort();
+ emacs_abort ();
}
}
@@ -4534,10 +4487,10 @@ not_in_argv (NSString *arg)
/* Don't open files from the command line unconditionally,
Cocoa parses the command line wrong, --option value tries to open value
if --option is the last option. */
- while ((file = [files nextObject]) != nil)
+ while ((file = [files nextObject]) != nil)
if (ns_do_open_file || not_in_argv (file))
[ns_pending_files addObject: file];
-
+
[self replyToOpenOrPrint: NSApplicationDelegateReplySuccess];
}
@@ -4604,7 +4557,7 @@ not_in_argv (NSString *arg)
/* NSTRACE (fd_handler); */
- for (;;)
+ for (;;)
{
[pool release];
pool = [[NSAutoreleasePool alloc] init];
@@ -4889,7 +4842,7 @@ not_in_argv (NSString *arg)
is_right_key = (flags & NSRightCommandKeyMask) == NSRightCommandKeyMask;
is_left_key = (flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask
|| (! is_right_key && (flags & NSCommandKeyMask) == NSCommandKeyMask);
-
+
if (is_right_key)
emacs_event->modifiers |= parse_solitary_modifier
(EQ (ns_right_command_modifier, Qleft)
@@ -5420,6 +5373,50 @@ not_in_argv (NSString *arg)
return NO;
}
+- (void) updateFrameSize: (BOOL) delay;
+{
+ NSWindow *window = [self window];
+ NSRect wr = [window frame];
+#ifdef NS_IMPL_GNUSTEP
+ int extra = 3;
+#else
+ int extra = 0;
+#endif
+
+ int oldc = cols, oldr = rows;
+ int oldw = FRAME_PIXEL_WIDTH (emacsframe),
+ oldh = FRAME_PIXEL_HEIGHT (emacsframe);
+ int neww, newh;
+
+ cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, wr.size.width + extra);
+
+ if (cols < MINWIDTH)
+ cols = MINWIDTH;
+
+ rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES
+ (emacsframe, wr.size.height
+ - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + extra
+ - FRAME_TOOLBAR_HEIGHT (emacsframe));
+
+ if (rows < MINHEIGHT)
+ rows = MINHEIGHT;
+
+ neww = (int)wr.size.width - emacsframe->border_width;
+ newh = ((int)wr.size.height
+ - FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
+ - FRAME_TOOLBAR_HEIGHT (emacsframe));
+
+ if (oldr != rows || oldc != cols || neww != oldw || newh != oldh)
+ {
+ NSView *view = FRAME_NS_VIEW (emacsframe);
+ FRAME_PIXEL_WIDTH (emacsframe) = neww;
+ FRAME_PIXEL_HEIGHT (emacsframe) = newh;
+ change_frame_size (emacsframe, rows, cols, 0, delay, 0);
+ SET_FRAME_GARBAGED (emacsframe);
+ cancel_mouse_face (emacsframe);
+ [view setFrame: NSMakeRect (0, 0, neww, newh)];
+ }
+}
- (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize
/* normalize frame to gridded text size */
@@ -5517,16 +5514,7 @@ not_in_argv (NSString *arg)
x_set_window_size (emacsframe, 0, cols, rows);
else
{
- NSWindow *window = [self window];
- NSRect wr = [window frame];
- FRAME_PIXEL_WIDTH (emacsframe) = (int)wr.size.width
- - emacsframe->border_width;
- FRAME_PIXEL_HEIGHT (emacsframe) = (int)wr.size.height
- - FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
- - FRAME_TOOLBAR_HEIGHT (emacsframe);
- change_frame_size (emacsframe, rows, cols, 0, 0, 1);
- SET_FRAME_GARBAGED (emacsframe);
- cancel_mouse_face (emacsframe);
+ [self updateFrameSize: YES];
}
}
#endif
@@ -5853,7 +5841,7 @@ not_in_argv (NSString *arg)
NSTRACE (menuDown);
if (context_menu_value == -1)
context_menu_value = [sender tag];
- else
+ else
{
NSInteger tag = [sender tag];
find_and_call_menu_selection (emacsframe, emacsframe->menu_bar_items_used,
@@ -6180,7 +6168,7 @@ not_in_argv (NSString *arg)
Lisp_Object str = Qnil;
struct frame *f = SELECTED_FRAME ();
struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->buffer);
-
+
if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
return NSAccessibilityTextFieldRole;
@@ -6193,13 +6181,13 @@ not_in_argv (NSString *arg)
{
if (! NILP (BVAR (curbuf, mark_active)))
str = ns_get_local_selection (QPRIMARY, QUTF8_STRING);
-
+
if (NILP (str))
{
ptrdiff_t start_byte = BUF_BEGV_BYTE (curbuf);
ptrdiff_t byte_range = BUF_ZV_BYTE (curbuf) - start_byte;
ptrdiff_t range = BUF_ZV (curbuf) - BUF_BEGV (curbuf);
-
+
if (! NILP (BVAR (curbuf, enable_multibyte_characters)))
str = make_uninit_multibyte_string (range, byte_range);
else
@@ -6209,9 +6197,9 @@ not_in_argv (NSString *arg)
memcpy (SDATA (str), BYTE_POS_ADDR (start_byte), byte_range);
}
}
-
-
- if (! NILP (str))
+
+
+ if (! NILP (str))
{
if (CONSP (str) && SYMBOLP (XCAR (str)))
{
@@ -6226,7 +6214,7 @@ not_in_argv (NSString *arg)
return nsStr;
}
}
-
+
return [super accessibilityAttributeValue:attribute];
}
#endif /* NS_IMPL_COCOA */
@@ -6242,7 +6230,10 @@ not_in_argv (NSString *arg)
NSTRACE (constrainFrameRect);
if (nr_screens == 1)
- return [super constrainFrameRect:frameRect toScreen:screen];
+ {
+ NSRect r = [super constrainFrameRect:frameRect toScreen:screen];
+ return r;
+ }
if (f->output_data.ns->dont_constrain
|| ns_menu_bar_should_be_hidden ())
diff --git a/src/print.c b/src/print.c
index 52c07c7912..aae13bb676 100644
--- a/src/print.c
+++ b/src/print.c
@@ -21,7 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
@@ -45,15 +45,9 @@ static Lisp_Object Qtemp_buffer_setup_hook;
static Lisp_Object Qfloat_output_format;
-#include <math.h>
#include <float.h>
#include <ftoastr.h>
-/* Default to values appropriate for IEEE floating point. */
-#ifndef DBL_DIG
-#define DBL_DIG 15
-#endif
-
/* Avoid actual stack overflow in print. */
static ptrdiff_t print_depth;
@@ -1879,7 +1873,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
}
else if (BUFFERP (obj))
{
- if (NILP (BVAR (XBUFFER (obj), name)))
+ if (!BUFFER_LIVE_P (XBUFFER (obj)))
strout ("#<killed buffer>", -1, -1, printcharfun);
else if (escapeflag)
{
@@ -2060,7 +2054,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
{
int len;
/* We're in trouble if this happens!
- Probably should just abort () */
+ Probably should just emacs_abort (). */
strout ("#<EMACS BUG: INVALID DATATYPE ", -1, -1, printcharfun);
if (MISCP (obj))
len = sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
diff --git a/src/process.c b/src/process.c
index b45ba73363..6f48463b85 100644
--- a/src/process.c
+++ b/src/process.c
@@ -23,15 +23,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define PROCESS_INLINE EXTERN_INLINE
-#include <signal.h>
#include <stdio.h>
#include <errno.h>
-#include <setjmp.h>
#include <sys/types.h> /* Some typedefs are used in sys/file.h. */
#include <sys/file.h>
#include <sys/stat.h>
-#include <setjmp.h>
-
#include <unistd.h>
#include <fcntl.h>
@@ -76,6 +72,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <bsdtty.h>
#endif
+#ifdef USG5_4
+# include <sys/stream.h>
+# include <sys/stropts.h>
+#endif
+
#ifdef HAVE_RES_INIT
#include <netinet/in.h>
#include <arpa/nameser.h>
@@ -124,6 +125,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "xgselect.h"
#endif
+#ifndef WNOHANG
+# undef waitpid
+# define waitpid(pid, status, options) wait (status)
+#endif
+#ifndef WUNTRACED
+# define WUNTRACED 0
+#endif
+
/* Work around GCC 4.7.0 bug with strict overflow checking; see
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>.
These lines can be removed once the GCC bug is fixed. */
@@ -165,16 +174,6 @@ static Lisp_Object QClocal, QCremote, QCcoding;
static Lisp_Object QCserver, QCnowait, QCnoquery, QCstop;
static Lisp_Object QCsentinel, QClog, QCoptions, QCplist;
static Lisp_Object Qlast_nonmenu_event;
-/* QCfamily is declared and initialized in xfaces.c,
- QCfilter in keyboard.c. */
-extern Lisp_Object QCfamily, QCfilter;
-
-/* Qexit is declared and initialized in eval.c. */
-
-/* QCfamily is defined in xfaces.c. */
-extern Lisp_Object QCfamily;
-/* QCfilter is defined in keyboard.c. */
-extern Lisp_Object QCfilter;
#define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork))
#define NETCONN1_P(p) (EQ (p->type, Qnetwork))
@@ -215,17 +214,13 @@ static EMACS_INT update_tick;
"non-destructive" select. So we require either native select,
or emulation of select using FIONREAD. */
-#ifdef BROKEN_DATAGRAM_SOCKETS
-#undef DATAGRAM_SOCKETS
-#else
-#ifndef DATAGRAM_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 /* DATAGRAM_SOCKETS */
-#endif /* BROKEN_DATAGRAM_SOCKETS */
+#ifndef BROKEN_DATAGRAM_SOCKETS
+# if defined HAVE_SELECT || defined USABLE_FIONREAD
+# if defined HAVE_SENDTO && defined HAVE_RECVFROM && defined EMSGSIZE
+# define DATAGRAM_SOCKETS
+# endif
+# endif
+#endif
#if defined HAVE_LOCAL_SOCKETS && defined DATAGRAM_SOCKETS
# define HAVE_SEQPACKET
@@ -254,7 +249,7 @@ static int process_output_skip;
#endif
static void create_process (Lisp_Object, char **, Lisp_Object);
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
static int keyboard_bit_set (SELECT_TYPE *);
#endif
static void deactivate_process (Lisp_Object);
@@ -811,7 +806,7 @@ get_process (register Lisp_Object name)
#ifdef SIGCHLD
/* Fdelete_process promises to immediately forget about the process, but in
reality, Emacs needs to remember those processes until they have been
- treated by sigchld_handler; otherwise this handler would consider the
+ treated by the SIGCHLD handler; otherwise this handler would consider the
process as being synchronous and say that the synchronous process is
dead. */
static Lisp_Object deleted_pid_list;
@@ -859,7 +854,8 @@ nil, indicating the current buffer's process. */)
#endif
{
Fkill_process (process, Qnil);
- /* Do this now, since remove_process will make sigchld_handler do nothing. */
+ /* Do this now, since remove_process will make the
+ SIGCHLD handler do nothing. */
pset_status (p, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)));
p->tick = ++process_tick;
status_notify (p);
@@ -1587,7 +1583,7 @@ static Lisp_Object
start_process_unwind (Lisp_Object proc)
{
if (!PROCESSP (proc))
- abort ();
+ emacs_abort ();
/* Was PROC started successfully?
-2 is used for a pty with no process, eg for gdb. */
@@ -1613,15 +1609,10 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
int wait_child_setup[2];
#endif
- sigset_t procmask;
- sigset_t blocked;
- struct sigaction sigint_action;
- struct sigaction sigquit_action;
- struct sigaction sigpipe_action;
-#ifdef AIX
- struct sigaction sighup_action;
+#ifdef SIGCHLD
+ sigset_t blocked, procmask;
#endif
- /* Use volatile to protect variables from being clobbered by longjmp. */
+ /* Use volatile to protect variables from being clobbered by vfork. */
volatile int forkin, forkout;
volatile int pty_flag = 0;
@@ -1713,32 +1704,20 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
XPROCESS (process)->pty_flag = pty_flag;
pset_status (XPROCESS (process), Qrun);
+#ifdef SIGCHLD
/* Delay interrupts until we have a chance to store
the new fork's pid in its process structure */
sigemptyset (&blocked);
-#ifdef SIGCHLD
sigaddset (&blocked, SIGCHLD);
-#endif
-#ifdef HAVE_WORKING_VFORK
- /* On many hosts (e.g. Solaris 2.4), if a vforked child calls `signal',
- this sets the parent's signal handlers as well as the child's.
- So delay all interrupts whose handlers the child might munge,
- and record the current handlers so they can be restored later. */
- sigaddset (&blocked, SIGINT ); sigaction (SIGINT , 0, &sigint_action );
- sigaddset (&blocked, SIGQUIT); sigaction (SIGQUIT, 0, &sigquit_action);
- sigaddset (&blocked, SIGPIPE); sigaction (SIGPIPE, 0, &sigpipe_action);
-#ifdef AIX
- sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action );
-#endif
-#endif /* HAVE_WORKING_VFORK */
pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
+#endif
FD_SET (inchannel, &input_wait_mask);
FD_SET (inchannel, &non_keyboard_wait_mask);
if (inchannel > max_process_desc)
max_process_desc = inchannel;
- /* Until we store the proper pid, enable sigchld_handler
+ /* Until we store the proper pid, enable the SIGCHLD handler
to recognize an unknown pid as standing for this process.
It is very important not to let this `marker' value stay
in the table after this function has returned; if it does
@@ -1766,12 +1745,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
int xforkin = forkin;
int xforkout = forkout;
-#if 0 /* This was probably a mistake--it duplicates code later on,
- but fails to handle all the cases. */
- /* Make sure SIGCHLD is not blocked in the child. */
- sigsetmask (SIGEMPTYMASK);
-#endif
-
/* Make the pty be the controlling terminal of the process. */
#ifdef HAVE_PTYS
/* First, disconnect its current controlling terminal. */
@@ -1890,8 +1863,10 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
in the child. */
signal (SIGPIPE, SIG_DFL);
+#ifdef SIGCHLD
/* Stop blocking signals in the child. */
pthread_sigmask (SIG_SETMASK, &procmask, 0);
+#endif
if (pty_flag)
child_setup_tty (xforkout);
@@ -1970,19 +1945,10 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
#endif
}
- /* Restore the signal state whether vfork succeeded or not.
- (We will signal an error, below, if it failed.) */
-#ifdef HAVE_WORKING_VFORK
- /* Restore the parent's signal handlers. */
- sigaction (SIGINT, &sigint_action, 0);
- sigaction (SIGQUIT, &sigquit_action, 0);
- sigaction (SIGPIPE, &sigpipe_action, 0);
-#ifdef AIX
- sigaction (SIGHUP, &sighup_action, 0);
-#endif
-#endif /* HAVE_WORKING_VFORK */
+#ifdef SIGCHLD
/* Stop blocking signals in the parent. */
pthread_sigmask (SIG_SETMASK, &procmask, 0);
+#endif
/* Now generate the error if vfork failed. */
if (pid < 0)
@@ -2560,7 +2526,7 @@ static Lisp_Object
make_serial_process_unwind (Lisp_Object proc)
{
if (!PROCESSP (proc))
- abort ();
+ emacs_abort ();
remove_process (proc);
return Qnil;
}
@@ -3397,7 +3363,7 @@ usage: (make-network-process &rest ARGS) */)
if (socktype == SOCK_DGRAM)
{
if (datagram_address[s].sa)
- abort ();
+ emacs_abort ();
datagram_address[s].sa = xmalloc (lres->ai_addrlen);
datagram_address[s].len = lres->ai_addrlen;
if (is_server)
@@ -3983,7 +3949,7 @@ deactivate_process (Lisp_Object proc)
FD_CLR (inchannel, &connect_wait_mask);
FD_CLR (inchannel, &write_mask);
if (--num_pending_connects < 0)
- abort ();
+ emacs_abort ();
}
#endif
if (inchannel == max_process_desc)
@@ -4406,10 +4372,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
Otherwise, do pending quit if requested. */
if (read_kbd >= 0)
QUIT;
-#ifdef SYNC_INPUT
else
process_pending_signals ();
-#endif
/* Exit now if the cell we're waiting for became non-nil. */
if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
@@ -4763,7 +4727,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
Cleanup occurs c/o status_notify after SIGCLD. */
no_avail = 1; /* Cannot depend on values returned */
#else
- abort ();
+ emacs_abort ();
#endif
}
else
@@ -4846,7 +4810,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
break;
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
/* If we think we have keyboard input waiting, but didn't get SIGIO,
go read it. This can happen with X on BSD after logging out.
In that case, there really is no input and no SIGIO,
@@ -4967,8 +4931,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
if (p->pid == -2)
{
- /* If the EIO occurs on a pty, sigchld_handler's
- waitpid() will not find the process object to
+ /* If the EIO occurs on a pty, the SIGCHLD handler's
+ waitpid call will not find the process object to
delete. Do it here. */
p->tick = ++process_tick;
pset_status (p, Qfailed);
@@ -5004,7 +4968,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
FD_CLR (channel, &connect_wait_mask);
FD_CLR (channel, &write_mask);
if (--num_pending_connects < 0)
- abort ();
+ emacs_abort ();
proc = chan_process[channel];
if (NILP (proc))
@@ -5205,7 +5169,7 @@ read_process_output (Lisp_Object proc, register int channel)
if (!NILP (outstream))
{
Lisp_Object text;
- int outer_running_asynch_code = running_asynch_code;
+ bool outer_running_asynch_code = running_asynch_code;
int waiting = waiting_for_user_input_p;
/* No need to gcpro these, because all we do with them later
@@ -5308,7 +5272,7 @@ read_process_output (Lisp_Object proc, register int channel)
}
/* If no filter, write into buffer if it isn't dead. */
- else if (!NILP (p->buffer) && !NILP (BVAR (XBUFFER (p->buffer), name)))
+ else if (!NILP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer)))
{
Lisp_Object old_read_only;
ptrdiff_t old_begv, old_zv;
@@ -5430,19 +5394,23 @@ read_process_output (Lisp_Object proc, register int channel)
/* Sending data to subprocess */
-static jmp_buf send_process_frame;
+static sys_jmp_buf send_process_frame;
static Lisp_Object process_sent_to;
-#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD
-static _Noreturn void send_process_trap (int);
-#endif
+static _Noreturn void
+handle_pipe_signal (int sig)
+{
+ sigset_t unblocked;
+ sigemptyset (&unblocked);
+ sigaddset (&unblocked, SIGPIPE);
+ pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
+ sys_longjmp (send_process_frame, 1);
+}
static void
-send_process_trap (int ignore)
+deliver_pipe_signal (int sig)
{
- SIGNAL_THREAD_CHECK (SIGPIPE);
- sigunblock (sigmask (SIGPIPE));
- longjmp (send_process_frame, 1);
+ handle_on_main_thread (sig, handle_pipe_signal);
}
/* In send_process, when a write fails temporarily,
@@ -5535,7 +5503,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
struct Lisp_Process *p = XPROCESS (proc);
ssize_t rv;
struct coding_system *coding;
- void (*volatile old_sigpipe) (int);
+ struct sigaction old_sigpipe_action;
if (p->raw_status_new)
update_status (p);
@@ -5645,7 +5613,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
/* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2,
CFLAGS="-g -O": The value of the parameter `proc' is clobbered
when returning with longjmp despite being declared volatile. */
- if (!setjmp (send_process_frame))
+ if (!sys_setjmp (send_process_frame))
{
p = XPROCESS (proc); /* Repair any setjmp clobbering. */
process_sent_to = proc;
@@ -5674,7 +5642,9 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
/* Send this batch, using one or more write calls. */
ptrdiff_t written = 0;
int outfd = p->outfd;
- old_sigpipe = (void (*) (int)) signal (SIGPIPE, send_process_trap);
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_pipe_signal);
+ sigaction (SIGPIPE, &action, &old_sigpipe_action);
#ifdef DATAGRAM_SOCKETS
if (DATAGRAM_CHAN_P (outfd))
{
@@ -5685,7 +5655,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
written = rv;
else if (errno == EMSGSIZE)
{
- signal (SIGPIPE, old_sigpipe);
+ sigaction (SIGPIPE, &old_sigpipe_action, 0);
report_file_error ("sending datagram",
Fcons (proc, Qnil));
}
@@ -5710,7 +5680,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
}
#endif
}
- signal (SIGPIPE, old_sigpipe);
+ sigaction (SIGPIPE, &old_sigpipe_action, 0);
if (rv < 0)
{
@@ -5770,7 +5740,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
}
else
{
- signal (SIGPIPE, old_sigpipe);
+ sigaction (SIGPIPE, &old_sigpipe_action, 0);
proc = process_sent_to;
p = XPROCESS (proc);
p->raw_status_new = 0;
@@ -6365,15 +6335,14 @@ process has been transmitted to the serial port. */)
#endif /* not HAVE_SHUTDOWN */
new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0);
if (new_outfd < 0)
- abort ();
+ emacs_abort ();
old_outfd = XPROCESS (proc)->outfd;
if (!proc_encode_coding_system[new_outfd])
proc_encode_coding_system[new_outfd]
= xmalloc (sizeof (struct coding_system));
- memcpy (proc_encode_coding_system[new_outfd],
- proc_encode_coding_system[old_outfd],
- sizeof (struct coding_system));
+ *proc_encode_coding_system[new_outfd]
+ = *proc_encode_coding_system[old_outfd];
memset (proc_encode_coding_system[old_outfd], 0,
sizeof (struct coding_system));
@@ -6408,143 +6377,135 @@ process has been transmitted to the serial port. */)
indirectly; if it does, that is a bug */
#ifdef SIGCHLD
-static void
-sigchld_handler (int signo)
+
+/* Record one child's changed status. Return true if a child was found. */
+static bool
+record_child_status_change (void)
{
- int old_errno = errno;
Lisp_Object proc;
struct Lisp_Process *p;
+ pid_t pid;
+ int w;
+ Lisp_Object tail;
- SIGNAL_THREAD_CHECK (signo);
-
- while (1)
- {
- pid_t pid;
- int w;
- Lisp_Object tail;
-
-#ifdef WNOHANG
-#ifndef WUNTRACED
-#define WUNTRACED 0
-#endif /* no WUNTRACED */
- /* Keep trying to get a status until we get a definitive result. */
- do
- {
- errno = 0;
- pid = waitpid (-1, &w, WNOHANG | WUNTRACED);
- }
- while (pid < 0 && errno == EINTR);
-
- if (pid <= 0)
- {
- /* PID == 0 means no processes found, PID == -1 means a real
- failure. We have done all our job, so return. */
+ do
+ pid = waitpid (-1, &w, WNOHANG | WUNTRACED);
+ while (pid < 0 && errno == EINTR);
- errno = old_errno;
- return;
- }
-#else
- pid = wait (&w);
-#endif /* no WNOHANG */
+ /* PID == 0 means no processes found, PID == -1 means a real failure.
+ Either way, we have done all our job. */
+ if (pid <= 0)
+ return false;
- /* Find the process that signaled us, and record its status. */
+ /* Find the process that signaled us, and record its status. */
- /* The process can have been deleted by Fdelete_process. */
- for (tail = deleted_pid_list; CONSP (tail); tail = XCDR (tail))
+ /* The process can have been deleted by Fdelete_process. */
+ for (tail = deleted_pid_list; CONSP (tail); tail = XCDR (tail))
+ {
+ Lisp_Object xpid = XCAR (tail);
+ if ((INTEGERP (xpid) && pid == XINT (xpid))
+ || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid)))
{
- Lisp_Object xpid = XCAR (tail);
- if ((INTEGERP (xpid) && pid == XINT (xpid))
- || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid)))
- {
- XSETCAR (tail, Qnil);
- goto sigchld_end_of_loop;
- }
+ XSETCAR (tail, Qnil);
+ return true;
}
+ }
- /* Otherwise, if it is asynchronous, it is in Vprocess_alist. */
+ /* Otherwise, if it is asynchronous, it is in Vprocess_alist. */
+ p = 0;
+ for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
+ {
+ proc = XCDR (XCAR (tail));
+ p = XPROCESS (proc);
+ if (EQ (p->type, Qreal) && p->pid == pid)
+ break;
p = 0;
- for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
- {
- proc = XCDR (XCAR (tail));
- p = XPROCESS (proc);
- if (EQ (p->type, Qreal) && p->pid == pid)
- break;
- p = 0;
- }
-
- /* Look for an asynchronous process whose pid hasn't been filled
- in yet. */
- if (p == 0)
- for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
- {
- proc = XCDR (XCAR (tail));
- p = XPROCESS (proc);
- if (p->pid == -1)
- break;
- p = 0;
- }
-
- /* Change the status of the process that was found. */
- if (p != 0)
- {
- int clear_desc_flag = 0;
+ }
- p->tick = ++process_tick;
- p->raw_status = w;
- p->raw_status_new = 1;
+ /* Look for an asynchronous process whose pid hasn't been filled
+ in yet. */
+ if (! p)
+ for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
+ {
+ proc = XCDR (XCAR (tail));
+ p = XPROCESS (proc);
+ if (p->pid == -1)
+ break;
+ p = 0;
+ }
- /* If process has terminated, stop waiting for its output. */
- if ((WIFSIGNALED (w) || WIFEXITED (w))
- && p->infd >= 0)
- clear_desc_flag = 1;
+ /* Change the status of the process that was found. */
+ if (p)
+ {
+ int clear_desc_flag = 0;
- /* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */
- if (clear_desc_flag)
- {
- FD_CLR (p->infd, &input_wait_mask);
- FD_CLR (p->infd, &non_keyboard_wait_mask);
- }
+ p->tick = ++process_tick;
+ p->raw_status = w;
+ p->raw_status_new = 1;
- /* Tell wait_reading_process_output that it needs to wake up and
- look around. */
- if (input_available_clear_time)
- *input_available_clear_time = make_emacs_time (0, 0);
- }
+ /* If process has terminated, stop waiting for its output. */
+ if ((WIFSIGNALED (w) || WIFEXITED (w))
+ && p->infd >= 0)
+ clear_desc_flag = 1;
- /* There was no asynchronous process found for that pid: we have
- a synchronous process. */
- else
+ /* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */
+ if (clear_desc_flag)
{
- synch_process_alive = 0;
-
- /* Report the status of the synchronous process. */
- if (WIFEXITED (w))
- synch_process_retcode = WEXITSTATUS (w);
- else if (WIFSIGNALED (w))
- synch_process_termsig = WTERMSIG (w);
-
- /* Tell wait_reading_process_output that it needs to wake up and
- look around. */
- if (input_available_clear_time)
- *input_available_clear_time = make_emacs_time (0, 0);
+ FD_CLR (p->infd, &input_wait_mask);
+ FD_CLR (p->infd, &non_keyboard_wait_mask);
}
- sigchld_end_of_loop:
- ;
+ /* Tell wait_reading_process_output that it needs to wake up and
+ look around. */
+ if (input_available_clear_time)
+ *input_available_clear_time = make_emacs_time (0, 0);
+ }
+ /* There was no asynchronous process found for that pid: we have
+ a synchronous process. */
+ else
+ {
+ synch_process_alive = 0;
+
+ /* Report the status of the synchronous process. */
+ if (WIFEXITED (w))
+ synch_process_retcode = WEXITSTATUS (w);
+ else if (WIFSIGNALED (w))
+ synch_process_termsig = WTERMSIG (w);
+
+ /* Tell wait_reading_process_output that it needs to wake up and
+ look around. */
+ if (input_available_clear_time)
+ *input_available_clear_time = make_emacs_time (0, 0);
+ }
+
+ return true;
+}
- /* On some systems, we must return right away.
- If any more processes want to signal us, we will
- get another signal.
- Otherwise (on systems that have WNOHANG), loop around
- to use up all the processes that have something to tell us. */
+/* On some systems, the SIGCHLD handler must return right away. If
+ any more processes want to signal us, we will get another signal.
+ Otherwise, loop around to use up all the processes that have
+ something to tell us. */
#if (defined WINDOWSNT \
|| (defined USG && !defined GNU_LINUX \
&& !(defined HPUX && defined WNOHANG)))
- errno = old_errno;
- return;
-#endif /* USG, but not HPUX with WNOHANG */
- }
+enum { CAN_HANDLE_MULTIPLE_CHILDREN = 0 };
+#else
+enum { CAN_HANDLE_MULTIPLE_CHILDREN = 1 };
+#endif
+
+static void
+handle_child_signal (int sig)
+{
+ while (record_child_status_change () && CAN_HANDLE_MULTIPLE_CHILDREN)
+ continue;
}
+
+static void
+deliver_child_signal (int sig)
+{
+ handle_on_main_thread (sig, handle_child_signal);
+}
+
#endif /* SIGCHLD */
@@ -6569,9 +6530,9 @@ static void
exec_sentinel (Lisp_Object proc, Lisp_Object reason)
{
Lisp_Object sentinel, odeactivate;
- register struct Lisp_Process *p = XPROCESS (proc);
+ struct Lisp_Process *p = XPROCESS (proc);
ptrdiff_t count = SPECPDL_INDEX ();
- int outer_running_asynch_code = running_asynch_code;
+ bool outer_running_asynch_code = running_asynch_code;
int waiting = waiting_for_user_input_p;
if (inhibit_sentinels)
@@ -6734,7 +6695,7 @@ status_notify (struct Lisp_Process *deleting_process)
/* Avoid error if buffer is deleted
(probably that's why the process is dead, too) */
- if (NILP (BVAR (XBUFFER (buffer), name)))
+ if (!BUFFER_LIVE_P (XBUFFER (buffer)))
continue;
Fset_buffer (buffer);
@@ -6866,7 +6827,7 @@ delete_gpm_wait_descriptor (int desc)
# endif
-# ifdef SIGIO
+# ifdef USABLE_SIGIO
/* Return nonzero if *MASK has a bit set
that corresponds to one of the keyboard input descriptors. */
@@ -7398,7 +7359,11 @@ init_process_emacs (void)
#ifndef CANNOT_DUMP
if (! noninteractive || initialized)
#endif
- signal (SIGCHLD, sigchld_handler);
+ {
+ struct sigaction action;
+ emacs_sigaction_init (&action, deliver_child_signal);
+ sigaction (SIGCHLD, &action, 0);
+ }
#endif
FD_ZERO (&input_wait_mask);
diff --git a/src/ralloc.c b/src/ralloc.c
index 3877e21d4f..9a4b1ada22 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -25,7 +25,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef emacs
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h" /* Needed for VALBITS. */
#include "blockinput.h"
@@ -237,7 +237,7 @@ obtain (POINTER address, SIZE size)
}
if (! heap)
- abort ();
+ emacs_abort ();
/* If we can't fit SIZE bytes in that heap,
try successive later heaps. */
@@ -330,7 +330,7 @@ relinquish (void)
/* This heap should have no blocs in it. */
if (last_heap->first_bloc != NIL_BLOC
|| last_heap->last_bloc != NIL_BLOC)
- abort ();
+ emacs_abort ();
/* Return the last heap, with its header, to the system. */
excess = (char *)last_heap->end - (char *)last_heap->start;
@@ -355,7 +355,7 @@ relinquish (void)
which returns the entire last heap to the system, seems
unlikely to trigger this mode of failure. */
if (last_heap->end != (*real_morecore) (0))
- abort ();
+ emacs_abort ();
}
}
}
@@ -452,7 +452,7 @@ relocate_blocs (bloc_ptr bloc, heap_ptr heap, POINTER address)
/* No need to ever call this if arena is frozen, bug somewhere! */
if (r_alloc_freeze_level)
- abort ();
+ emacs_abort ();
while (b)
{
@@ -576,7 +576,7 @@ resize_bloc (bloc_ptr bloc, SIZE size)
/* No need to ever call this if arena is frozen, bug somewhere! */
if (r_alloc_freeze_level)
- abort ();
+ emacs_abort ();
if (bloc == NIL_BLOC || size == bloc->size)
return 1;
@@ -588,7 +588,7 @@ resize_bloc (bloc_ptr bloc, SIZE size)
}
if (heap == NIL_HEAP)
- abort ();
+ emacs_abort ();
old_size = bloc->size;
bloc->size = size;
@@ -937,7 +937,7 @@ r_alloc_free (register POINTER *ptr)
dead_bloc = find_bloc (ptr);
if (dead_bloc == NIL_BLOC)
- abort (); /* Double free? PTR not originally used to allocate? */
+ emacs_abort (); /* Double free? PTR not originally used to allocate? */
free_bloc (dead_bloc);
*ptr = 0;
@@ -979,7 +979,7 @@ r_re_alloc (POINTER *ptr, SIZE size)
bloc = find_bloc (ptr);
if (bloc == NIL_BLOC)
- abort (); /* Already freed? PTR not originally used to allocate? */
+ emacs_abort (); /* Already freed? PTR not originally used to allocate? */
if (size < bloc->size)
{
@@ -1152,7 +1152,7 @@ r_alloc_reset_variable (POINTER *old, POINTER *new)
}
if (bloc == NIL_BLOC || bloc->variable != old)
- abort (); /* Already freed? OLD not originally used to allocate? */
+ emacs_abort (); /* Already freed? OLD not originally used to allocate? */
/* Update variable to point to the new location. */
bloc->variable = new;
@@ -1193,7 +1193,7 @@ r_alloc_init (void)
first_heap->start = first_heap->bloc_start
= virtual_break_value = break_value = (*real_morecore) (0);
if (break_value == NIL)
- abort ();
+ emacs_abort ();
extra_bytes = ROUNDUP (50000);
#endif
@@ -1204,9 +1204,15 @@ r_alloc_init (void)
UNBLOCK_INPUT;
#else
#ifndef SYSTEM_MALLOC
- /* Give GNU malloc's morecore some hysteresis
- so that we move all the relocatable blocks much less often. */
- __malloc_extra_blocks = 64;
+ /* Give GNU malloc's morecore some hysteresis so that we move all
+ the relocatable blocks much less often. The number used to be
+ 64, but alloc.c would override that with 32 in code that was
+ removed when SYNC_INPUT became the only input handling mode.
+ That code was conditioned on !DOUG_LEA_MALLOC, so the call to
+ mallopt above is left unchanged. (Actually, I think there's no
+ system nowadays that uses DOUG_LEA_MALLOC and also uses
+ REL_ALLOC.) */
+ __malloc_extra_blocks = 32;
#endif
#endif
diff --git a/src/regex.c b/src/regex.c
index 472ef72797..17562043df 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -126,7 +126,6 @@
that make sense only in Emacs. */
#ifdef emacs
-# include <setjmp.h>
# include "lisp.h"
# include "character.h"
# include "buffer.h"
@@ -1832,9 +1831,9 @@ typedef struct
/* The next available element. */
#define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
-/* Explicit quit checking is only used on NTemacs and whenever we
- use polling to process input events. */
-#if defined emacs && (defined WINDOWSNT || defined SYNC_INPUT) && defined QUIT
+/* Explicit quit checking is needed for Emacs, which uses polling to
+ process input events. */
+#ifdef emacs
extern int immediate_quit;
# define IMMEDIATE_QUIT_CHECK \
do { \
diff --git a/src/region-cache.c b/src/region-cache.c
index d2bba8c11b..832f4bfd21 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
@@ -194,7 +193,7 @@ find_cache_boundary (struct region_cache *c, ptrdiff_t pos)
if (BOUNDARY_POS (c, low) > pos
|| (low + 1 < c->cache_len
&& BOUNDARY_POS (c, low + 1) <= pos))
- abort ();
+ emacs_abort ();
return low;
}
@@ -217,12 +216,12 @@ move_cache_gap (struct region_cache *c, ptrdiff_t pos, ptrdiff_t min_size)
if (pos < 0
|| pos > c->cache_len)
- abort ();
+ emacs_abort ();
/* We mustn't ever try to put the gap before the dummy start
boundary. That must always be start-relative. */
if (pos == 0)
- abort ();
+ emacs_abort ();
/* Need we move the gap right? */
while (gap_start < pos)
@@ -291,24 +290,24 @@ insert_cache_boundary (struct region_cache *c, ptrdiff_t i, ptrdiff_t pos,
{
/* i must be a valid cache index. */
if (i < 0 || i > c->cache_len)
- abort ();
+ emacs_abort ();
/* We must never want to insert something before the dummy first
boundary. */
if (i == 0)
- abort ();
+ emacs_abort ();
/* We must only be inserting things in order. */
if (! (BOUNDARY_POS (c, i - 1) < pos
&& (i == c->cache_len
|| pos < BOUNDARY_POS (c, i))))
- abort ();
+ emacs_abort ();
/* The value must be different from the ones around it. However, we
temporarily create boundaries that establish the same value as
the subsequent boundary, so we're not going to flag that case. */
if (BOUNDARY_VALUE (c, i - 1) == value)
- abort ();
+ emacs_abort ();
move_cache_gap (c, i, 1);
@@ -331,16 +330,16 @@ delete_cache_boundaries (struct region_cache *c,
/* Gotta be in range. */
if (start < 0
|| end > c->cache_len)
- abort ();
+ emacs_abort ();
/* Gotta be in order. */
if (start > end)
- abort ();
+ emacs_abort ();
/* Can't delete the dummy entry. */
if (start == 0
&& end >= 1)
- abort ();
+ emacs_abort ();
/* Minimize gap motion. If we're deleting nothing, do nothing. */
if (len == 0)
@@ -380,10 +379,10 @@ set_cache_region (struct region_cache *c,
ptrdiff_t start, ptrdiff_t end, int value)
{
if (start > end)
- abort ();
+ emacs_abort ();
if (start < c->buffer_beg
|| end > c->buffer_end)
- abort ();
+ emacs_abort ();
/* Eliminate this case; then we can assume that start and end-1 are
both the locations of real characters in the buffer. */
diff --git a/src/scroll.c b/src/scroll.c
index 78ebe65bdc..71ce43b2e4 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -21,7 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "termchar.h"
#include "dispextern.h"
@@ -195,13 +195,13 @@ calculate_scrolling (FRAME_PTR frame,
{
cost = p1->writecost + first_insert_cost[i];
if ((int) p1->insertcount > i)
- abort ();
+ emacs_abort ();
cost1 = p1->insertcost + next_insert_cost[i - p1->insertcount];
}
p->insertcost = min (cost, cost1) + draw_cost[i] + extra_cost;
p->insertcount = (cost < cost1) ? 1 : p1->insertcount + 1;
if ((int) p->insertcount > i)
- abort ();
+ emacs_abort ();
/* Calculate the cost if we do a delete line after
outputting this line.
diff --git a/src/search.c b/src/search.c
index 0b4f635066..99fd7971e4 100644
--- a/src/search.c
+++ b/src/search.c
@@ -20,7 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "syntax.h"
#include "category.h"
@@ -1009,7 +1009,7 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
if (!EQ (noerror, Qt))
{
if (lim < BEGV || lim > ZV)
- abort ();
+ emacs_abort ();
SET_PT_BOTH (lim, lim_byte);
return Qnil;
#if 0 /* This would be clean, but maybe programs depend on
@@ -1022,7 +1022,7 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
}
if (np < BEGV || np > ZV)
- abort ();
+ emacs_abort ();
SET_PT (np);
@@ -2770,7 +2770,7 @@ Return value is undefined if the last search failed. */)
}
else
/* last_thing_searched must always be Qt, a buffer, or Qnil. */
- abort ();
+ emacs_abort ();
len = 2 * i + 2;
}
diff --git a/src/sheap.c b/src/sheap.c
index 3ae14b5dae..f6022ea3ce 100644
--- a/src/sheap.c
+++ b/src/sheap.c
@@ -20,7 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include <unistd.h>
@@ -93,4 +93,3 @@ report_sheap_usage (int die_if_pure_storage_exceeded)
bss_sbrk_ptr - bss_sbrk_buffer, STATIC_HEAP_SIZE);
message ("%s", buf);
}
-
diff --git a/src/sound.c b/src/sound.c
index 403f08240c..0ee85312fd 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -44,11 +44,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <sys/types.h>
#include <errno.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "dispextern.h"
#include "atimer.h"
-#include <signal.h>
#include "syssignal.h"
/* END: Common Includes */
@@ -315,8 +314,13 @@ sound_perror (const char *msg)
int saved_errno = errno;
turn_on_atimers (1);
-#ifdef SIGIO
- sigunblock (sigmask (SIGIO));
+#ifdef USABLE_SIGIO
+ {
+ sigset_t unblocked;
+ sigemptyset (&unblocked);
+ sigaddset (&unblocked, SIGIO);
+ pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
+ }
#endif
if (saved_errno != 0)
error ("%s: %s", msg, strerror (saved_errno));
@@ -728,6 +732,9 @@ static void
vox_configure (struct sound_device *sd)
{
int val;
+#ifdef USABLE_SIGIO
+ sigset_t blocked;
+#endif
eassert (sd->fd >= 0);
@@ -735,8 +742,10 @@ vox_configure (struct sound_device *sd)
interrupted by a signal. Block the ones we know to cause
troubles. */
turn_on_atimers (0);
-#ifdef SIGIO
- sigblock (sigmask (SIGIO));
+#ifdef USABLE_SIGIO
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGIO);
+ pthread_sigmask (SIG_BLOCK, &blocked, 0);
#endif
val = sd->format;
@@ -769,8 +778,8 @@ vox_configure (struct sound_device *sd)
}
turn_on_atimers (1);
-#ifdef SIGIO
- sigunblock (sigmask (SIGIO));
+#ifdef USABLE_SIGIO
+ pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
#endif
}
@@ -785,8 +794,11 @@ vox_close (struct sound_device *sd)
/* On GNU/Linux, it seems that the device driver doesn't like to
be interrupted by a signal. Block the ones we know to cause
troubles. */
-#ifdef SIGIO
- sigblock (sigmask (SIGIO));
+#ifdef USABLE_SIGIO
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGIO);
+ pthread_sigmask (SIG_BLOCK, &blocked, 0);
#endif
turn_on_atimers (0);
@@ -794,8 +806,8 @@ vox_close (struct sound_device *sd)
ioctl (sd->fd, SNDCTL_DSP_SYNC, NULL);
turn_on_atimers (1);
-#ifdef SIGIO
- sigunblock (sigmask (SIGIO));
+#ifdef USABLE_SIGIO
+ pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
#endif
/* Close the device. */
@@ -843,7 +855,7 @@ vox_choose_format (struct sound_device *sd, struct sound *s)
}
}
else
- abort ();
+ emacs_abort ();
}
@@ -1138,7 +1150,7 @@ alsa_choose_format (struct sound_device *sd, struct sound *s)
}
}
else
- abort ();
+ emacs_abort ();
}
diff --git a/src/syntax.c b/src/syntax.c
index f995b8f2ca..91ef4e6666 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -21,7 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <sys/types.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "commands.h"
#include "character.h"
@@ -921,11 +921,11 @@ DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0,
}
DEFUN ("string-to-syntax", Fstring_to_syntax, Sstring_to_syntax, 1, 1, 0,
- doc: /* Convert a syntax specification STRING into syntax cell form.
-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. */)
+ doc: /* Convert a syntax descriptor STRING into a raw syntax descriptor.
+STRING should be a string of the form allowed as argument of
+`modify-syntax-entry'. The return value is a raw syntax descriptor: a
+cons cell \(CODE . MATCHING-CHAR) which can be used, for example, as
+the value of a `syntax-table' text property. */)
(Lisp_Object string)
{
register const unsigned char *p;
diff --git a/src/sysdep.c b/src/sysdep.c
index b84e6a4ea3..dbfd9efc7d 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -21,9 +21,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define SYSTIME_INLINE EXTERN_INLINE
-#include <signal.h>
+#include <execinfo.h>
#include <stdio.h>
-#include <setjmp.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#include <grp.h>
@@ -107,9 +106,6 @@ extern char *getwd (char *);
static int emacs_get_tty (int, struct emacs_tty *);
static int emacs_set_tty (int, struct emacs_tty *, int);
-#if defined TIOCNOTTY || defined USG5 || defined CYGWIN
-static _Noreturn void croak (char *);
-#endif
/* ULLONG_MAX is missing on Red Hat Linux 7.3; see Bug#11781. */
#ifndef ULLONG_MAX
@@ -302,27 +298,34 @@ wait_for_termination_1 (pid_t pid, int interruptible)
termination of subprocesses, perhaps involving a kernel bug too,
but no idea what it is. Just as a hunch we signal SIGCHLD to see
if that causes the problem to go away or get worse. */
- sigsetmask (sigmask (SIGCHLD));
+ sigset_t sigchild_mask;
+ sigemptyset (&sigchild_mask);
+ sigaddset (&sigchild_mask, SIGCHLD);
+ pthread_sigmask (SIG_SETMASK, &sigchild_mask, 0);
+
if (0 > kill (pid, 0))
{
- sigsetmask (SIGEMPTYMASK);
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
kill (getpid (), SIGCHLD);
break;
}
if (wait_debugging)
sleep (1);
else
- sigpause (SIGEMPTYMASK);
+ sigsuspend (&empty_mask);
#else /* not BSD_SYSTEM, and not HPUX version >= 6 */
#ifdef WINDOWSNT
wait (0);
break;
#else /* not WINDOWSNT */
- sigblock (sigmask (SIGCHLD));
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGCHLD);
+ pthread_sigmask (SIG_BLOCK, &blocked, 0);
errno = 0;
if (kill (pid, 0) == -1 && errno == ESRCH)
{
- sigunblock (sigmask (SIGCHLD));
+ pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
break;
}
@@ -456,11 +459,11 @@ child_setup_tty (int out)
#endif /* not MSDOS */
-/* Record a signal code and the handler for it. */
+/* Record a signal code and the action for it. */
struct save_signal
{
int code;
- void (*handler) (int);
+ struct sigaction action;
};
static void save_signal_handlers (struct save_signal *);
@@ -506,7 +509,7 @@ sys_subshell (void)
saved_handlers[0].code = SIGINT;
saved_handlers[1].code = SIGQUIT;
saved_handlers[2].code = SIGTERM;
-#ifdef SIGIO
+#ifdef USABLE_SIGIO
saved_handlers[3].code = SIGIO;
saved_handlers[4].code = 0;
#else
@@ -618,8 +621,9 @@ save_signal_handlers (struct save_signal *saved_handlers)
{
while (saved_handlers->code)
{
- saved_handlers->handler
- = (void (*) (int)) signal (saved_handlers->code, SIG_IGN);
+ struct sigaction action;
+ emacs_sigaction_init (&action, SIG_IGN);
+ sigaction (saved_handlers->code, &action, &saved_handlers->action);
saved_handlers++;
}
}
@@ -629,118 +633,80 @@ restore_signal_handlers (struct save_signal *saved_handlers)
{
while (saved_handlers->code)
{
- signal (saved_handlers->code, saved_handlers->handler);
+ sigaction (saved_handlers->code, &saved_handlers->action, 0);
saved_handlers++;
}
}
-#ifndef SIGIO
-/* If SIGIO is broken, don't do anything. */
-void
-init_sigio (int fd)
-{
-}
-
-static void
-reset_sigio (int fd)
-{
-}
-
-void
-request_sigio (void)
-{
-}
-
-void
-unrequest_sigio (void)
-{
-}
-
-#else
-#ifdef F_SETFL
-
+#ifdef USABLE_SIGIO
static int old_fcntl_flags[MAXDESC];
+#endif
void
init_sigio (int fd)
{
-#ifdef FASYNC
+#ifdef USABLE_SIGIO
old_fcntl_flags[fd] = fcntl (fd, F_GETFL, 0) & ~FASYNC;
fcntl (fd, F_SETFL, old_fcntl_flags[fd] | FASYNC);
-#endif
interrupts_deferred = 0;
+#endif
}
static void
reset_sigio (int fd)
{
-#ifdef FASYNC
+#ifdef USABLE_SIGIO
fcntl (fd, F_SETFL, old_fcntl_flags[fd]);
#endif
}
-#ifdef FASYNC /* F_SETFL does not imply existence of FASYNC */
-/* XXX Uhm, FASYNC is not used anymore here. */
-/* XXX Yeah, but you need it for SIGIO, don't you? */
-
void
request_sigio (void)
{
+#ifdef USABLE_SIGIO
+ sigset_t unblocked;
+
if (noninteractive)
return;
-#ifdef SIGWINCH
- sigunblock (sigmask (SIGWINCH));
-#endif
- sigunblock (sigmask (SIGIO));
+ sigemptyset (&unblocked);
+# ifdef SIGWINCH
+ sigaddset (&unblocked, SIGWINCH);
+# endif
+ sigaddset (&unblocked, SIGIO);
+ pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
interrupts_deferred = 0;
+#endif
}
void
unrequest_sigio (void)
{
- if (noninteractive)
- return;
+#ifdef USABLE_SIGIO
+ sigset_t blocked;
-#if 0 /* XXX What's wrong with blocking SIGIO under X? */
- if (x_display_list)
+ if (noninteractive)
return;
-#endif
-#ifdef SIGWINCH
- sigblock (sigmask (SIGWINCH));
-#endif
- sigblock (sigmask (SIGIO));
+ sigemptyset (&blocked);
+# ifdef SIGWINCH
+ sigaddset (&blocked, SIGWINCH);
+# endif
+ sigaddset (&blocked, SIGIO);
+ pthread_sigmask (SIG_BLOCK, &blocked, 0);
interrupts_deferred = 1;
-}
-
-#else /* no FASYNC */
-#ifndef MSDOS
-
-void
-request_sigio (void)
-{
- if (noninteractive || read_socket_hook)
- return;
-
- croak ("request_sigio");
+#endif
}
void
-unrequest_sigio (void)
+ignore_sigio (void)
{
- if (noninteractive || read_socket_hook)
- return;
-
- croak ("unrequest_sigio");
+#ifdef USABLE_SIGIO
+ signal (SIGIO, SIG_IGN);
+#endif
}
-#endif /* MSDOS */
-#endif /* FASYNC */
-#endif /* F_SETFL */
-#endif /* SIGIO */
-
/* Getting and setting emacs_tty structures. */
@@ -1470,86 +1436,64 @@ init_system_name (void)
}
}
-/* POSIX signals support - DJB */
-/* Anyone with POSIX signals should have ANSI C declarations */
-
sigset_t empty_mask;
-#ifndef WINDOWSNT
-
-signal_handler_t
-sys_signal (int signal_number, signal_handler_t action)
+/* Store into *ACTION a signal action suitable for Emacs, with handler
+ HANDLER. */
+void
+emacs_sigaction_init (struct sigaction *action, signal_handler_t handler)
{
- struct sigaction new_action, old_action;
- sigemptyset (&new_action.sa_mask);
- new_action.sa_handler = action;
- new_action.sa_flags = 0;
+ sigemptyset (&action->sa_mask);
+ action->sa_handler = handler;
+ action->sa_flags = 0;
#if defined (SA_RESTART)
- /* Emacs mostly works better with restartable system services. If this
- flag exists, we probably want to turn it on here.
- However, on some systems (only hpux11 at present) this resets the
- timeout of `select' which means that `select' never finishes if
- it keeps getting signals.
- We define BROKEN_SA_RESTART on those systems. */
- /* It's not clear why the comment above says "mostly works better". --Stef
- When SYNC_INPUT is set, we don't want SA_RESTART because we need to poll
+ /* SA_RESTART causes interruptible functions with timeouts (e.g.,
+ 'select') to reset their timeout on some platforms (e.g.,
+ HP-UX 11), which is not what we want. Also, when Emacs is
+ interactive, we don't want SA_RESTART because we need to poll
for pending input so we need long-running syscalls to be interrupted
after a signal that sets the interrupt_input_pending flag. */
/* Non-interactive keyboard input goes through stdio, where we always
want restartable system calls. */
-# if defined (BROKEN_SA_RESTART) || defined (SYNC_INPUT)
if (noninteractive)
-# endif
- new_action.sa_flags = SA_RESTART;
+ action->sa_flags = SA_RESTART;
#endif
- sigaction (signal_number, &new_action, &old_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. */
-sigset_t
-sys_sigmask (int sig)
-{
- sigset_t mask;
- sigemptyset (&mask);
- sigaddset (&mask, sig);
- return mask;
-}
+#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
+static pthread_t main_thread;
#endif
-/* I'd like to have these guys return pointers to the mask storage in here,
- but there'd be trouble if the code was saving multiple masks. I'll be
- safe and pass the structure. It normally won't be more than 2 bytes
- anyhow. - DJB */
-
-sigset_t
-sys_sigblock (sigset_t new_mask)
+/* If we are on the main thread, handle the signal SIG with HANDLER.
+ Otherwise, redirect the signal to the main thread, blocking it from
+ this thread. POSIX says any thread can receive a signal that is
+ associated with a process, process group, or asynchronous event.
+ On GNU/Linux that is not true, but for other systems (FreeBSD at
+ least) it is. */
+void
+handle_on_main_thread (int sig, signal_handler_t handler)
{
- sigset_t old_mask;
- pthread_sigmask (SIG_BLOCK, &new_mask, &old_mask);
- return (old_mask);
-}
+ /* Preserve errno, to avoid race conditions with signal handlers that
+ might change errno. Races can occur even in single-threaded hosts. */
+ int old_errno = errno;
-sigset_t
-sys_sigunblock (sigset_t new_mask)
-{
- sigset_t old_mask;
- pthread_sigmask (SIG_UNBLOCK, &new_mask, &old_mask);
- return (old_mask);
-}
+ bool on_main_thread = true;
+#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
+ if (! pthread_equal (pthread_self (), main_thread))
+ {
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, sig);
+ pthread_sigmask (SIG_BLOCK, &blocked, 0);
+ pthread_kill (main_thread, sig);
+ on_main_thread = false;
+ }
+#endif
+ if (on_main_thread)
+ handler (sig);
-sigset_t
-sys_sigsetmask (sigset_t new_mask)
-{
- sigset_t old_mask;
- pthread_sigmask (SIG_SETMASK, &new_mask, &old_mask);
- return (old_mask);
+ errno = old_errno;
}
-
#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST
static char *my_sys_siglist[NSIG];
@@ -1564,6 +1508,10 @@ init_signals (void)
{
sigemptyset (&empty_mask);
+#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
+ main_thread = pthread_self ();
+#endif
+
#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST
if (! initialized)
{
@@ -1856,6 +1804,33 @@ snprintf (char *buf, size_t bufsize, char const *format, ...)
}
#endif
+/* If a backtrace is available, output the top lines of it to stderr.
+ Do not output more than BACKTRACE_LIMIT or BACKTRACE_LIMIT_MAX lines.
+ This function may be called from a signal handler, so it should
+ not invoke async-unsafe functions like malloc. */
+void
+emacs_backtrace (int backtrace_limit)
+{
+ enum { BACKTRACE_LIMIT_MAX = 500 };
+ void *buffer[BACKTRACE_LIMIT_MAX + 1];
+ int bounded_limit = min (backtrace_limit, BACKTRACE_LIMIT_MAX);
+ int npointers = backtrace (buffer, bounded_limit + 1);
+ if (npointers)
+ ignore_value (write (STDERR_FILENO, "\nBacktrace:\n", 12));
+ backtrace_symbols_fd (buffer, bounded_limit, STDERR_FILENO);
+ if (bounded_limit < npointers)
+ ignore_value (write (STDERR_FILENO, "...\n", 4));
+}
+
+#ifndef HAVE_NTGUI
+/* Using emacs_abort lets GDB return from a breakpoint here. */
+void
+emacs_abort (void)
+{
+ fatal_error_backtrace (SIGABRT, 10);
+}
+#endif
+
int
emacs_open (const char *path, int oflag, int mode)
{
@@ -1933,11 +1908,9 @@ emacs_write (int fildes, const char *buf, ptrdiff_t nbyte)
{
if (errno == EINTR)
{
-#ifdef SYNC_INPUT
/* I originally used `QUIT' but that might causes files to
be truncated if you hit C-g in the middle of it. --Stef */
process_pending_signals ();
-#endif
continue;
}
else
@@ -2020,19 +1993,6 @@ getwd (char *pathname)
}
#endif /* !defined (HAVE_GETWD) || defined (BROKEN_GETWD) */
-
-/*
- * This function will go away as soon as all the stubs fixed. (fnf)
- */
-
-void
-croak (char *badfunc)
-{
- printf ("%s not yet implemented\r\n", badfunc);
- reset_all_sys_modes ();
- exit (1);
-}
-
#endif /* USG */
/* Directory routines for systems that don't have them. */
diff --git a/src/syssignal.h b/src/syssignal.h
index 71151ed4c6..e309e6725b 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -17,6 +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 <signal.h>
+
extern void init_signals (void);
#ifdef HAVE_PTHREAD
@@ -26,83 +28,14 @@ extern void init_signals (void);
#define FORWARD_SIGNAL_TO_MAIN_THREAD
#endif
-/* 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
- #includes <signal.h>, then that will re-#define SIGIO and confuse
- things. */
-/* XXX This is not correct anymore, there is a BROKEN_SIGIO macro. */
-
-#define SIGMASKTYPE sigset_t
-
-#define SIGEMPTYMASK (empty_mask)
extern sigset_t empty_mask;
-/* POSIX pretty much destroys any possibility of writing sigmask as a
- macro in standard C. We always define our own version because the
- predefined macro in Glibc 2.1 is only provided for compatibility for old
- programs that use int as signal mask type. */
-#undef sigmask
-#ifdef __GNUC__
-#define sigmask(SIG) \
- ({ \
- sigset_t _mask; \
- sigemptyset (&_mask); \
- sigaddset (&_mask, SIG); \
- _mask; \
- })
-#else /* ! defined (__GNUC__) */
-extern sigset_t sys_sigmask ();
-#define sigmask(SIG) (sys_sigmask (SIG))
-#endif /* ! defined (__GNUC__) */
-
-#undef sigpause
-#define sigpause(MASK) sigsuspend (&(MASK))
-
-#define sigblock(SIG) sys_sigblock (SIG)
-#define sigunblock(SIG) sys_sigunblock (SIG)
-#ifndef sigsetmask
-#define sigsetmask(SIG) sys_sigsetmask (SIG)
-#endif
-#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 void (*signal_handler_t) (int);
-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);
-#if ! (defined TIOCNOTTY || defined USG5 || defined CYGWIN)
-_Noreturn void croak (char *);
-#endif
-
-#define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG)
-
-#define sigfree() sigsetmask (SIGEMPTYMASK)
-
-#if defined (SIGIO) && defined (BROKEN_SIGIO)
-# undef SIGIO
-#endif
-/* These are only used by AIX */
-#if defined (SIGPOLL) && defined (BROKEN_SIGPOLL)
-#undef SIGPOLL
-#endif
-#if defined (SIGAIO) && defined (BROKEN_SIGAIO)
-#undef SIGAIO
-#endif
-#if defined (SIGPTY) && defined (BROKEN_SIGPTY)
-#undef SIGPTY
-#endif
-
+extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
-/* FIXME? Emacs only defines NSIG_MINIMUM on some platforms? */
#if NSIG < NSIG_MINIMUM
-# ifdef NSIG
-# undef NSIG
-# endif
+# undef NSIG
# define NSIG NSIG_MINIMUM
#endif
@@ -131,26 +64,4 @@ _Noreturn void croak (char *);
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)) \
- { \
- /* POSIX says any thread can receive the signal. On GNU/Linux \
- that is not true, but for other systems (FreeBSD at least) \
- it is. So direct the signal to the correct thread and block \
- it from this thread. */ \
- sigset_t new_mask; \
- \
- sigemptyset (&new_mask); \
- sigaddset (&new_mask, signo); \
- pthread_sigmask (SIG_BLOCK, &new_mask, 0); \
- pthread_kill (main_thread, signo); \
- return; \
- } \
- } while (0)
-
-#else /* not FORWARD_SIGNAL_TO_MAIN_THREAD */
-#define SIGNAL_THREAD_CHECK(signo)
-#endif /* not FORWARD_SIGNAL_TO_MAIN_THREAD */
+void handle_on_main_thread (int, signal_handler_t);
diff --git a/src/systty.h b/src/systty.h
index ae98f123f2..b7f36c6c25 100644
--- a/src/systty.h
+++ b/src/systty.h
@@ -17,10 +17,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/>. */
/* Include the proper files. */
+
#ifndef DOS_NT
-#ifndef NO_TERMIO
-#include <termio.h>
-#endif /* not NO_TERMIO */
#include <termios.h>
#include <fcntl.h>
#endif /* not DOS_NT */
@@ -39,20 +37,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
-/* Special cases - inhibiting the use of certain features. */
-
-/* Allow configure to inhibit use of FIONREAD. */
-#ifdef BROKEN_FIONREAD
-#undef FIONREAD
-#undef ASYNC
-#endif
-
-/* Interrupt input is not used if there is no FIONREAD. */
-#ifndef FIONREAD
-#undef SIGIO
-#endif
-
-
/* Try to establish the correct character to disable terminal functions
in a system-independent manner. Note that USG (at least) define
_POSIX_VDISABLE as 0! */
diff --git a/src/term.c b/src/term.c
index f1a09b39cf..f4117d67de 100644
--- a/src/term.c
+++ b/src/term.c
@@ -25,8 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/file.h>
#include <sys/time.h>
#include <unistd.h>
-#include <signal.h>
-#include <setjmp.h>
#include "lisp.h"
#include "termchar.h"
@@ -1498,7 +1496,7 @@ append_glyph (struct it *it)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
- abort ();
+ emacs_abort ();
glyph->bidi_type = it->bidi_it.type;
}
else
@@ -1695,7 +1693,7 @@ append_composite_glyph (struct it *it)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
- abort ();
+ emacs_abort ();
glyph->bidi_type = it->bidi_it.type;
}
else
@@ -1780,7 +1778,7 @@ append_glyphless_glyph (struct it *it, int face_id, const char *str)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
- abort ();
+ emacs_abort ();
glyph->bidi_type = it->bidi_it.type;
}
else
@@ -2250,7 +2248,7 @@ get_named_tty (const char *name)
struct terminal *t;
if (!name)
- abort ();
+ emacs_abort ();
for (t = terminal_list; t; t = t->next_terminal)
{
@@ -2798,7 +2796,7 @@ create_tty_output (struct frame *f)
struct tty_output *t = xzalloc (sizeof *t);
if (! FRAME_TERMCAP_P (f))
- abort ();
+ emacs_abort ();
t->display_info = FRAME_TERMINAL (f)->display_info.tty;
@@ -2811,7 +2809,7 @@ static void
tty_free_frame_resources (struct frame *f)
{
if (! FRAME_TERMCAP_P (f))
- abort ();
+ emacs_abort ();
if (FRAME_FACE_CACHE (f))
free_frame_faces (f);
@@ -2827,7 +2825,7 @@ static void
tty_free_frame_resources (struct frame *f)
{
if (! FRAME_TERMCAP_P (f) && ! FRAME_MSDOS_P (f))
- abort ();
+ emacs_abort ();
if (FRAME_FACE_CACHE (f))
free_frame_faces (f);
@@ -2932,7 +2930,10 @@ dissociate_if_controlling_tty (int fd)
no_controlling_tty = 1;
#else
#ifdef TIOCNOTTY /* Try BSD ioctls. */
- sigblock (sigmask (SIGTTOU));
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGTTOU);
+ pthread_sigmask (SIG_BLOCK, &blocked, 0);
fd = emacs_open (DEV_TTY, O_RDWR, 0);
if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1)
{
@@ -2940,10 +2941,9 @@ dissociate_if_controlling_tty (int fd)
}
if (fd != -1)
emacs_close (fd);
- sigunblock (sigmask (SIGTTOU));
+ pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
#else
- /* Unknown system. */
- croak ();
+# error "Unknown system."
#endif /* ! TIOCNOTTY */
#endif /* ! USG */
}
@@ -3074,9 +3074,14 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
/* On some systems, tgetent tries to access the controlling
terminal. */
- sigblock (sigmask (SIGTTOU));
- status = tgetent (tty->termcap_term_buffer, terminal_type);
- sigunblock (sigmask (SIGTTOU));
+ {
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGTTOU);
+ pthread_sigmask (SIG_BLOCK, &blocked, 0);
+ status = tgetent (tty->termcap_term_buffer, terminal_type);
+ pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
+ }
if (status < 0)
{
@@ -3108,7 +3113,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
#ifndef TERMINFO
if (strlen (tty->termcap_term_buffer) >= buffer_size)
- abort ();
+ emacs_abort ();
buffer_size = strlen (tty->termcap_term_buffer);
#endif
tty->termcap_strings_buffer = area = xmalloc (buffer_size);
@@ -3467,7 +3472,7 @@ maybe_fatal (int must_succeed, struct terminal *terminal,
verror (str1, ap);
va_end (ap);
- abort ();
+ emacs_abort ();
}
void
@@ -3494,7 +3499,7 @@ delete_tty (struct terminal *terminal)
return;
if (terminal->type != output_termcap)
- abort ();
+ emacs_abort ();
tty = terminal->display_info.tty;
@@ -3508,7 +3513,7 @@ delete_tty (struct terminal *terminal)
if (! p)
/* This should not happen. */
- abort ();
+ emacs_abort ();
p->next = tty->next;
tty->next = 0;
diff --git a/src/termcap.c b/src/termcap.c
index d1b05e8df9..e494cd113d 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -19,7 +19,6 @@ Boston, MA 02110-1301, USA. */
/* Emacs config.h may rename various library functions such as malloc. */
#include <config.h>
-#include <setjmp.h>
#include <sys/file.h>
#include <fcntl.h>
#include <unistd.h>
diff --git a/src/termchar.h b/src/termchar.h
index 102fe45350..5c57593c04 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -207,6 +207,6 @@ extern struct tty_display_info *tty_list;
(((f)->output_method == output_termcap \
|| (f)->output_method == output_msdos_raw) \
? (f)->terminal->display_info.tty \
- : (abort (), (struct tty_display_info *) 0))
+ : (emacs_abort (), (struct tty_display_info *) 0))
#define CURTTY() FRAME_TTY (SELECTED_FRAME())
diff --git a/src/terminal.c b/src/terminal.c
index d94164a4e4..719c2a3611 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define TERMHOOKS_INLINE EXTERN_INLINE
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "frame.h"
@@ -294,7 +293,7 @@ delete_terminal (struct terminal *terminal)
for (tp = &terminal_list; *tp != terminal; tp = &(*tp)->next_terminal)
if (! *tp)
- abort ();
+ emacs_abort ();
*tp = terminal->next_terminal;
xfree (terminal->keyboard_coding);
@@ -411,7 +410,7 @@ possible return values. */)
case output_ns:
return Qns;
default:
- abort ();
+ emacs_abort ();
}
}
@@ -519,7 +518,7 @@ struct terminal *
init_initial_terminal (void)
{
if (initialized || terminal_list || tty_list)
- abort ();
+ emacs_abort ();
initial_terminal = create_terminal ();
initial_terminal->type = output_initial;
@@ -538,7 +537,7 @@ static void
delete_initial_terminal (struct terminal *terminal)
{
if (terminal != initial_terminal)
- abort ();
+ emacs_abort ();
delete_terminal (terminal);
initial_terminal = NULL;
diff --git a/src/terminfo.c b/src/terminfo.c
index dce7af77bc..124c452a4a 100644
--- a/src/terminfo.c
+++ b/src/terminfo.c
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include "tparam.h"
-#include <setjmp.h>
#include "lisp.h"
/* Define these variables that serve as global parameters to termcap,
@@ -46,7 +45,7 @@ tparam (const char *string, char *outstring, int len,
/* Emacs always should pass a null OUTSTRING and zero LEN. */
if (outstring || len)
- abort ();
+ emacs_abort ();
temp = tparm (string, arg1, arg2, arg3, arg4);
return xstrdup (temp);
diff --git a/src/textprop.c b/src/textprop.c
index b6895fc426..872912ea70 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "intervals.h"
#include "character.h"
@@ -556,7 +556,8 @@ If POSITION is at the end of OBJECT, the value is nil. */)
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.
+OBJECT should be a buffer or a string; if omitted or nil, it defaults
+to the current buffer.
If POSITION is at the end of OBJECT, the value is nil. */)
(Lisp_Object position, Lisp_Object prop, Lisp_Object object)
{
diff --git a/src/tparam.c b/src/tparam.c
index 9492d9dee3..164f61d471 100644
--- a/src/tparam.c
+++ b/src/tparam.c
@@ -19,7 +19,7 @@ Boston, MA 02110-1301, USA. */
/* Emacs config.h may rename various library functions such as malloc. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h" /* for xmalloc */
#include "tparam.h"
@@ -247,7 +247,7 @@ tparam1 (const char *string, char *outstring, int len,
break;
default:
- abort ();
+ emacs_abort ();
}
}
else
diff --git a/src/undo.c b/src/undo.c
index 9cd1d5f9f6..e878ef4dcf 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -18,7 +18,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
diff --git a/src/unexaix.c b/src/unexaix.c
index c09156296f..c01a22a79f 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -89,7 +89,6 @@ static int adjust_lnnoptrs (int, int, const char *);
static int pagemask;
-#include <setjmp.h>
#include "lisp.h"
static void
diff --git a/src/unexcoff.c b/src/unexcoff.c
index e83042a379..966dd58cb6 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -120,7 +120,6 @@ static int pagemask;
#define ADDR_CORRECT(x) ((char *)(x) - (char*)0)
-#include <setjmp.h>
#include "lisp.h"
static void
diff --git a/src/unexcw.c b/src/unexcw.c
index eae534cf4d..96c4b4a9ae 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include "unexec.h"
-#include <setjmp.h>
#include <lisp.h>
#include <stdio.h>
#include <fcntl.h>
diff --git a/src/unexsol.c b/src/unexsol.c
index 336f3b4fae..470206d583 100644
--- a/src/unexsol.c
+++ b/src/unexsol.c
@@ -4,7 +4,6 @@
#include "unexec.h"
#include <dlfcn.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
diff --git a/src/vm-limit.c b/src/vm-limit.c
index cf697b56fd..8de0acd1bb 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -17,7 +17,6 @@ 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 <setjmp.h>
#include <unistd.h> /* for 'environ', on AIX */
#include "lisp.h"
#include "mem-limits.h"
diff --git a/src/w16select.c b/src/w16select.c
index 2026de7421..a3f6f1fb9a 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -31,7 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <dpmi.h>
#include <go32.h>
#include <sys/farptr.h>
-#include <setjmp.h>
#include "lisp.h"
#include "dispextern.h" /* frame.h seems to want this */
#include "frame.h" /* Need this to get the X window of selected_frame */
diff --git a/src/w32.c b/src/w32.c
index d779d74072..d79065e76e 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -32,7 +32,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/time.h>
#include <sys/utime.h>
#include <math.h>
-#include <setjmp.h>
#include <time.h>
/* must include CRT headers *before* config.h */
@@ -1256,9 +1255,9 @@ init_user_info (void)
/* Ensure HOME and SHELL are defined. */
if (getenv ("HOME") == NULL)
- abort ();
+ emacs_abort ();
if (getenv ("SHELL") == NULL)
- abort ();
+ emacs_abort ();
/* Set dir and shell from environment variables. */
strcpy (dflt_passwd.pw_dir, getenv ("HOME"));
@@ -1513,34 +1512,10 @@ is_unc_volume (const char *filename)
}
/* Routines that are no-ops on NT but are defined to get Emacs to compile. */
-
-int
-sigsetmask (int signal_mask)
-{
- return 0;
-}
-
-int
-sigmask (int sig)
-{
- return 0;
-}
-
-int
-sigblock (int sig)
-{
- return 0;
-}
-
-int
-sigunblock (int sig)
-{
- return 0;
-}
-
int
sigemptyset (sigset_t *set)
{
+ *set = 0;
return 0;
}
@@ -1771,9 +1746,9 @@ init_environment (char ** argv)
char modname[MAX_PATH];
if (!GetModuleFileName (NULL, modname, MAX_PATH))
- abort ();
+ emacs_abort ();
if ((p = strrchr (modname, '\\')) == NULL)
- abort ();
+ emacs_abort ();
*p = 0;
if ((p = strrchr (modname, '\\')) && xstrcasecmp (p, "\\bin") == 0)
@@ -1885,13 +1860,13 @@ init_environment (char ** argv)
/* FIXME: Do we need to resolve possible symlinks in startup_dir?
Does it matter anywhere in Emacs? */
if (!GetCurrentDirectory (MAXPATHLEN, startup_dir))
- abort ();
+ emacs_abort ();
{
static char modname[MAX_PATH];
if (!GetModuleFileName (NULL, modname, MAX_PATH))
- abort ();
+ emacs_abort ();
argv[0] = modname;
}
@@ -1913,7 +1888,7 @@ emacs_root_dir (void)
p = getenv ("emacs_dir");
if (p == NULL)
- abort ();
+ emacs_abort ();
strcpy (root_dir, p);
root_dir[parse_root (root_dir, NULL)] = '\0';
dostounix_filename (root_dir);
@@ -3270,7 +3245,7 @@ generate_inode_val (const char * name)
doesn't resolve aliasing due to subst commands, or recognize hard
links. */
if (!w32_get_long_filename ((char *)name, fullname, MAX_PATH))
- abort ();
+ emacs_abort ();
parse_root (fullname, &p);
/* Normal W32 filesystems are still case insensitive. */
@@ -5570,7 +5545,7 @@ socket_to_fd (SOCKET s)
if (fd_info[ fd ].cp != NULL)
{
DebPrint (("sys_socket: fd_info[%d] apparently in use!\n", fd));
- abort ();
+ emacs_abort ();
}
fd_info[ fd ].cp = cp;
@@ -5949,7 +5924,7 @@ sys_close (int fd)
{
if (fd_info[fd].flags & FILE_SOCKET)
{
- if (winsock_lib == NULL) abort ();
+ if (winsock_lib == NULL) emacs_abort ();
pfn_shutdown (SOCK_HANDLE (fd), 2);
rc = pfn_closesocket (SOCK_HANDLE (fd));
@@ -6067,7 +6042,7 @@ _sys_read_ahead (int fd)
|| (fd_info[fd].flags & FILE_READ) == 0)
{
DebPrint (("_sys_read_ahead: internal error: fd %d is not a pipe, serial port, or socket!\n", fd));
- abort ();
+ emacs_abort ();
}
cp->status = STATUS_READ_IN_PROGRESS;
@@ -6203,7 +6178,7 @@ sys_read (int fd, char * buffer, unsigned int count)
/* re-read CR carried over from last read */
if (fd_info[fd].flags & FILE_LAST_CR)
{
- if (fd_info[fd].flags & FILE_BINARY) abort ();
+ if (fd_info[fd].flags & FILE_BINARY) emacs_abort ();
*buffer++ = 0x0d;
count--;
nchars++;
@@ -6306,7 +6281,7 @@ sys_read (int fd, char * buffer, unsigned int count)
}
else /* FILE_SOCKET */
{
- if (winsock_lib == NULL) abort ();
+ if (winsock_lib == NULL) emacs_abort ();
/* do the equivalent of a non-blocking read */
pfn_ioctlsocket (SOCK_HANDLE (fd), FIONREAD, &waiting);
@@ -6457,7 +6432,7 @@ sys_write (int fd, const void * buffer, unsigned int count)
else if (fd < MAXDESC && fd_info[fd].flags & FILE_SOCKET)
{
unsigned long nblock = 0;
- if (winsock_lib == NULL) abort ();
+ if (winsock_lib == NULL) emacs_abort ();
/* TODO: implement select() properly so non-blocking I/O works. */
/* For now, make sure the write blocks. */
@@ -6623,8 +6598,7 @@ check_windows_init_file (void)
buffer,
"Emacs Abort Dialog",
MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL);
- /* Use the low-level Emacs abort. */
-#undef abort
+ /* Use the low-level system abort. */
abort ();
}
else
@@ -6756,7 +6730,7 @@ shutdown_handler (DWORD type)
|| type == CTRL_SHUTDOWN_EVENT) /* User shutsdown. */
{
/* Shut down cleanly, making sure autosave files are up to date. */
- shut_down_emacs (0, 0, Qnil);
+ shut_down_emacs (0, Qnil);
}
/* Allow other handlers to handle this signal. */
diff --git a/src/w32console.c b/src/w32console.c
index 76b7bb0b45..5a44d3748a 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -26,7 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <windows.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
diff --git a/src/w32fns.c b/src/w32fns.c
index aa7d6c7a0e..cd48ae65e3 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -26,7 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <limits.h>
#include <errno.h>
#include <math.h>
-#include <setjmp.h>
#include "lisp.h"
#include "w32term.h"
@@ -2368,7 +2367,7 @@ w32_msg_pump (deferred_msg * msg_buf)
CoInitialize (NULL);
w32_createwindow ((struct frame *) msg.wParam);
if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
- abort ();
+ emacs_abort ();
break;
case WM_EMACS_SETLOCALE:
SetThreadLocale (msg.wParam);
@@ -2378,7 +2377,7 @@ w32_msg_pump (deferred_msg * msg_buf)
result = (int) ActivateKeyboardLayout ((HKL) msg.wParam, 0);
if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE,
result, 0))
- abort ();
+ emacs_abort ();
break;
case WM_EMACS_REGISTER_HOT_KEY:
focus_window = GetFocus ();
@@ -2399,7 +2398,7 @@ w32_msg_pump (deferred_msg * msg_buf)
GC. */
XSETCAR ((Lisp_Object) ((EMACS_INT) msg.lParam), Qnil);
if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
- abort ();
+ emacs_abort ();
break;
case WM_EMACS_TOGGLE_LOCK_KEY:
{
@@ -2431,7 +2430,7 @@ w32_msg_pump (deferred_msg * msg_buf)
}
if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE,
cur_state, 0))
- abort ();
+ emacs_abort ();
}
break;
#ifdef MSG_DEBUG
@@ -2486,11 +2485,11 @@ send_deferred_msg (deferred_msg * msg_buf,
{
/* Only input thread can send deferred messages. */
if (GetCurrentThreadId () != dwWindowsThreadId)
- abort ();
+ emacs_abort ();
/* It is an error to send a message that is already deferred. */
if (find_deferred_msg (hwnd, msg) != NULL)
- abort ();
+ emacs_abort ();
/* Enforced synchronization is not needed because this is the only
function that alters deferred_msg_head, and the following critical
@@ -2563,7 +2562,7 @@ w32_msg_worker (void *arg)
PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
- abort ();
+ emacs_abort ();
memset (&dummy_buf, 0, sizeof (dummy_buf));
dummy_buf.w32msg.msg.hwnd = NULL;
@@ -3224,7 +3223,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
msg = WM_MBUTTONUP;
button_state &= ~MMOUSE;
- if (button_state) abort ();
+ if (button_state) emacs_abort ();
}
else
return 0;
@@ -3455,7 +3454,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
/* Detect if message has already been deferred; in this case
we cannot return any sensible value to ignore this. */
if (find_deferred_msg (hwnd, msg) != NULL)
- abort ();
+ emacs_abort ();
menubar_in_use = 1;
@@ -3930,7 +3929,7 @@ my_create_window (struct frame * f)
MSG msg;
if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0))
- abort ();
+ emacs_abort ();
GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
}
@@ -6490,7 +6489,7 @@ w32_parse_hot_key (Lisp_Object key)
lisp_modifiers = XINT (Fcar (Fcdr (c)));
c = Fcar (c);
if (!SYMBOLP (c))
- abort ();
+ emacs_abort ();
vk_code = lookup_vk_code (SDATA (SYMBOL_NAME (c)));
}
else if (INTEGERP (c))
@@ -7685,10 +7684,8 @@ globals_of_w32fns (void)
syms_of_w32uniscribe ();
}
-#undef abort
-
void
-w32_abort (void)
+emacs_abort (void)
{
int button;
button = MessageBox (NULL,
diff --git a/src/w32font.c b/src/w32font.c
index c135d061e7..d7d25d8993 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <math.h>
#include <ctype.h>
#include <commdlg.h>
-#include <setjmp.h>
#include "lisp.h"
#include "w32term.h"
@@ -636,9 +635,9 @@ w32font_text_extents (struct font *font, unsigned *code,
/* w32 implementation of draw for font backend.
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).
+ position of frame F with S->FACE and S->GC. If WITH_BACKGROUND,
+ fill the background in advance. It is assured that WITH_BACKGROUND
+ is false when (FROM > 0 || TO < S->nchars).
TODO: Currently this assumes that the colors and fonts are already
set in the DC. This seems to be true now, but maybe only due to
@@ -648,7 +647,7 @@ w32font_text_extents (struct font *font, unsigned *code,
int
w32font_draw (struct glyph_string *s, int from, int to,
- int x, int y, int with_background)
+ int x, int y, bool with_background)
{
UINT options;
HRGN orig_clip = NULL;
@@ -805,7 +804,7 @@ static int
w32font_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);
+ bool alternate_subst);
*/
/* Internal implementation of w32font_list.
@@ -988,7 +987,6 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
font->space_width = font->average_width = w32_font->metrics.tmAveCharWidth;
font->vertical_centering = 0;
- font->encoding_type = 0;
font->baseline_offset = 0;
font->relative_compose = 0;
font->default_ascent = w32_font->metrics.tmAscent;
diff --git a/src/w32font.h b/src/w32font.h
index a29ddbe778..8fa00a9b52 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -77,7 +77,7 @@ 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 x, int y, bool with_background);
int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec);
diff --git a/src/w32heap.c b/src/w32heap.c
index f075340479..e7d4c29e04 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include "w32heap.h"
#include "lisp.h" /* for VALMASK */
diff --git a/src/w32inevt.c b/src/w32inevt.c
index ca97fed1fe..a036fcbefe 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -25,7 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
#include <windows.h>
-#include <setjmp.h>
#ifndef MOUSE_MOVED
#define MOUSE_MOVED 1
diff --git a/src/w32menu.c b/src/w32menu.c
index 886fd55bbe..4d820471f1 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -835,7 +835,7 @@ w32_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
else if (EQ (type, QCradio))
wv->button_type = BUTTON_TYPE_RADIO;
else
- abort ();
+ emacs_abort ();
wv->selected = !NILP (selected);
diff --git a/src/w32proc.c b/src/w32proc.c
index 0cc62aebca..27d93e4a7b 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -28,7 +28,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <fcntl.h>
#include <signal.h>
#include <sys/file.h>
-#include <setjmp.h>
/* must include CRT headers *before* config.h */
#include <config.h>
@@ -89,6 +88,29 @@ sys_signal (int sig, signal_handler handler)
return old;
}
+/* Emulate sigaction. */
+int
+sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
+{
+ signal_handler old;
+
+ if (sig != SIGCHLD)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+ old = sig_handlers[sig];
+ if (act)
+ sig_handlers[sig] = act->sa_handler;
+ if (oact)
+ {
+ oact->sa_handler = old;
+ oact->sa_flags = 0;
+ oact->sa_mask = empty_mask;
+ }
+ return 0;
+}
+
/* Defined in <process.h> which conflicts with the local copy */
#define _P_NOWAIT 1
@@ -162,7 +184,7 @@ delete_child (child_process *cp)
/* Should not be deleting a child that is still needed. */
for (i = 0; i < MAXDESC; i++)
if (fd_info[i].cp == cp)
- abort ();
+ emacs_abort ();
if (!CHILD_ACTIVE (cp))
return;
@@ -302,7 +324,7 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app,
DWORD flags;
char dir[ MAXPATHLEN ];
- if (cp == NULL) abort ();
+ if (cp == NULL) emacs_abort ();
memset (&start, 0, sizeof (start));
start.cb = sizeof (start);
@@ -391,7 +413,7 @@ register_child (int pid, int fd)
if (fd_info[fd].cp != NULL)
{
DebPrint (("register_child: fd_info[%d] apparently in use!\n", fd));
- abort ();
+ emacs_abort ();
}
fd_info[fd].cp = cp;
@@ -445,7 +467,7 @@ sys_wait (int *status)
/* We want to wait for a specific child */
wait_hnd[nh] = dead_child->procinfo.hProcess;
cps[nh] = dead_child;
- if (!wait_hnd[nh]) abort ();
+ if (!wait_hnd[nh]) emacs_abort ();
nh++;
active = 0;
goto get_result;
@@ -493,7 +515,7 @@ sys_wait (int *status)
active -= WAIT_ABANDONED_0;
}
else
- abort ();
+ emacs_abort ();
get_result:
if (!GetExitCodeProcess (wait_hnd[active], &retval))
@@ -1175,7 +1197,7 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
#endif
wait_hnd[nh] = cp->char_avail;
fdindex[nh] = i;
- if (!wait_hnd[nh]) abort ();
+ if (!wait_hnd[nh]) emacs_abort ();
nh++;
#ifdef FULL_DEBUG
DebPrint (("select waiting on child %d fd %d\n",
@@ -1262,7 +1284,7 @@ count_children:
active -= WAIT_ABANDONED_0;
}
else
- abort ();
+ emacs_abort ();
/* Loop over all handles after active (now officially documented as
being the first signaled handle in the array). We do this to
@@ -1392,6 +1414,9 @@ sys_kill (int pid, int sig)
int need_to_free = 0;
int rc = 0;
+ if (pid == getpid () && sig == SIGABRT)
+ emacs_abort ();
+
/* Only handle signals that will result in the process dying */
if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP)
{
diff --git a/src/w32reg.c b/src/w32reg.c
index 9c727ae5ab..8a6a3c853b 100644
--- a/src/w32reg.c
+++ b/src/w32reg.c
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Kevin Gallo */
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "w32term.h"
#include "blockinput.h"
diff --git a/src/w32select.c b/src/w32select.c
index 6b855b43a3..b616f232ee 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -73,7 +73,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
*/
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "w32term.h" /* for all of the w32 includes */
#include "w32heap.h" /* os_subtype */
@@ -399,7 +398,7 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg)
BLOCK_INPUT;
- /* Fsignal calls abort() if it sees that waiting_for_input is
+ /* Fsignal calls emacs_abort () if it sees that waiting_for_input is
set. */
owfi = waiting_for_input;
waiting_for_input = 0;
diff --git a/src/w32term.c b/src/w32term.c
index 0dffcd0bf0..af075955e2 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "blockinput.h"
#include "w32term.h"
@@ -2440,7 +2439,7 @@ x_draw_glyph_string (struct glyph_string *s)
break;
default:
- abort ();
+ emacs_abort ();
}
if (!s->for_overlaps)
@@ -2605,6 +2604,7 @@ x_draw_glyph_string (struct glyph_string *s)
w32_set_clip_rectangle (next->hdc, NULL);
next->hl = save;
next->num_clips = 0;
+ next->clip_head = s->next;
}
}
}
@@ -2640,7 +2640,7 @@ x_delete_glyphs (struct frame *f, register int n)
if (! FRAME_W32_P (f))
return;
- abort ();
+ emacs_abort ();
}
@@ -2723,7 +2723,7 @@ x_ins_del_lines (struct frame *f, int vpos, int n)
if (! FRAME_W32_P (f))
return;
- abort ();
+ emacs_abort ();
}
@@ -3445,7 +3445,7 @@ x_window_to_scroll_bar (Window window_id)
frame = XCAR (tail);
/* All elements of Vframe_list should be frames. */
if (! FRAMEP (frame))
- abort ();
+ emacs_abort ();
/* Scan this frame's scroll bar list for a scroll bar with the
right window ID. */
@@ -3868,7 +3868,7 @@ w32_redeem_scroll_bar (struct window *window)
/* We can't redeem this window's scroll bar if it doesn't have one. */
if (NILP (window->vertical_scroll_bar))
- abort ();
+ emacs_abort ();
bar = XSCROLL_BAR (window->vertical_scroll_bar);
@@ -3887,7 +3887,7 @@ w32_redeem_scroll_bar (struct window *window)
else
/* If its prev pointer is nil, it must be at the front of
one or the other! */
- abort ();
+ emacs_abort ();
}
else
XSCROLL_BAR (bar->prev)->next = bar->next;
@@ -3942,7 +3942,7 @@ w32_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg,
struct input_event *emacs_event)
{
if (! WINDOWP (bar->window))
- abort ();
+ emacs_abort ();
emacs_event->kind = SCROLL_BAR_CLICK_EVENT;
emacs_event->code = 0;
@@ -4177,6 +4177,7 @@ w32_read_socket (struct terminal *terminal, int expected,
if (interrupt_input_blocked)
{
interrupt_input_pending = 1;
+ pending_signals = 1;
return -1;
}
@@ -5255,7 +5256,7 @@ w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
break;
default:
- abort ();
+ emacs_abort ();
}
}
}
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index bc45e2c648..5d160b9d42 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -27,7 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define _WIN32_WINNT 0x500
#include <windows.h>
#include <usp10.h>
-#include <setjmp.h>
#include "lisp.h"
#include "w32term.h"
@@ -454,7 +453,11 @@ uniscribe_shape (Lisp_Object lgstring)
}
else
ASET (vec, 0, make_number (offsets[j].du + adj_offset));
- ASET (vec, 1, make_number (offsets[j].dv));
+ /* In the font definition coordinate system, the
+ Y coordinate points up, while in our screen
+ coordinates Y grows downwards. So we need to
+ reverse the sign of Y-OFFSET here. */
+ ASET (vec, 1, make_number (-offsets[j].dv));
/* Based on what ftfont.c does... */
ASET (vec, 2, make_number (advances[j]));
LGLYPH_SET_ADJUSTMENT (lglyph, vec);
diff --git a/src/w32xfns.c b/src/w32xfns.c
index dfafb0ac74..1a67b018dd 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "keyboard.h"
@@ -131,7 +130,7 @@ get_frame_dc (FRAME_PTR f)
HDC hdc;
if (f->output_method != output_w32)
- abort ();
+ emacs_abort ();
enter_crit ();
diff --git a/src/widget.c b/src/widget.c
index b94c30f4e9..fd5ad16712 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -30,7 +30,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "xterm.h"
@@ -50,9 +50,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <X11/ShellP.h>
#include "../lwlib/lwlib.h"
-#include <signal.h>
-#include "syssignal.h"
-
#include "character.h"
#include "font.h"
@@ -226,7 +223,7 @@ get_wm_shell (Widget w)
static void
mark_shell_size_user_specified (Widget wmshell)
{
- if (! XtIsWMShell (wmshell)) abort ();
+ if (! XtIsWMShell (wmshell)) emacs_abort ();
/* This is kind of sleazy, but I can't see how else to tell it to make it
mark the WM_SIZE_HINTS size as user specified when appropriate. */
((WMShellWidget) wmshell)->wm.size_hints.flags |= USSize;
@@ -290,7 +287,7 @@ set_frame_size (EmacsFrame ew)
Widget wmshell = get_wm_shell ((Widget) ew);
/* Each Emacs shell is now independent and top-level. */
- if (! XtIsSubclass (wmshell, shellWidgetClass)) abort ();
+ if (! XtIsSubclass (wmshell, shellWidgetClass)) emacs_abort ();
/* We don't need this for the moment. The geometry is computed in
xfns.c. */
@@ -671,16 +668,14 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs
update_wm_hints (ew);
}
-extern void free_frame_faces (struct frame *);
-
static void
EmacsFrameDestroy (Widget widget)
{
EmacsFrame ew = (EmacsFrame) widget;
struct frame* s = ew->emacs_frame.frame;
- if (! s) abort ();
- if (! s->output_data.x) abort ();
+ if (! s) emacs_abort ();
+ if (! s->output_data.x) emacs_abort ();
BLOCK_INPUT;
x_free_gcs (s);
diff --git a/src/window.c b/src/window.c
index 117e86065e..114bd28c31 100644
--- a/src/window.c
+++ b/src/window.c
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define WINDOW_INLINE EXTERN_INLINE
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
@@ -176,11 +175,6 @@ wset_new_total (struct window *w, Lisp_Object val)
w->new_total = val;
}
static inline void
-wset_next_buffers (struct window *w, Lisp_Object val)
-{
- w->next_buffers = val;
-}
-static inline void
wset_normal_cols (struct window *w, Lisp_Object val)
{
w->normal_cols = val;
@@ -201,11 +195,6 @@ wset_pointm (struct window *w, Lisp_Object val)
w->pointm = val;
}
static inline void
-wset_prev_buffers (struct window *w, Lisp_Object val)
-{
- w->prev_buffers = val;
-}
-static inline void
wset_right_fringe_width (struct window *w, Lisp_Object val)
{
w->right_fringe_width = val;
@@ -386,7 +375,7 @@ the first window of that frame. */)
else if (! NILP (XWINDOW (window)->vchild))
window = XWINDOW (window)->vchild;
else
- abort ();
+ emacs_abort ();
}
return window;
@@ -1289,7 +1278,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
return Qnil;
default:
- abort ();
+ emacs_abort ();
}
}
@@ -1866,23 +1855,23 @@ return value is a list of elements of the form (PARAMETER . VALUE). */)
DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter,
2, 2, 0,
doc: /* Return WINDOW's value for PARAMETER.
-WINDOW must be a valid window and defaults to the selected one. */)
+WINDOW can be any window and defaults to the selected one. */)
(Lisp_Object window, Lisp_Object parameter)
{
Lisp_Object result;
- result = Fassq (parameter, decode_valid_window (window)->window_parameters);
+ result = Fassq (parameter, decode_any_window (window)->window_parameters);
return CDR_SAFE (result);
}
DEFUN ("set-window-parameter", Fset_window_parameter,
Sset_window_parameter, 3, 3, 0,
doc: /* Set WINDOW's value of PARAMETER to VALUE.
-WINDOW must be a valid window and defaults to the selected one.
+WINDOW can be any window and defaults to the selected one.
Return VALUE. */)
(Lisp_Object window, Lisp_Object parameter, Lisp_Object value)
{
- register struct window *w = decode_valid_window (window);
+ register struct window *w = decode_any_window (window);
Lisp_Object old_alist_elt;
old_alist_elt = Fassq (parameter, w->window_parameters);
@@ -1948,7 +1937,7 @@ unshow_buffer (register struct window *w)
buf = w->buffer;
b = XBUFFER (buf);
if (b != XMARKER (w->pointm)->buffer)
- abort ();
+ emacs_abort ();
#if 0
if (w == XWINDOW (selected_window)
@@ -2668,8 +2657,8 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
/* Check for a window that has a killed buffer. */
case CHECK_ALL_WINDOWS:
if (! NILP (w->buffer)
- && NILP (BVAR (XBUFFER (w->buffer), name)))
- abort ();
+ && !BUFFER_LIVE_P (XBUFFER (w->buffer)))
+ emacs_abort ();
break;
case WINDOW_LOOP_UNUSED:
@@ -3273,7 +3262,7 @@ This function runs `window-scroll-functions' before running
XSETWINDOW (window, w);
buffer = Fget_buffer (buffer_or_name);
CHECK_BUFFER (buffer);
- if (NILP (BVAR (XBUFFER (buffer), name)))
+ if (!BUFFER_LIVE_P (XBUFFER (buffer)))
error ("Attempt to display deleted buffer");
tem = w->buffer;
@@ -3338,7 +3327,7 @@ displaying that buffer. */)
if (STRINGP (object))
object = Fget_buffer (object);
- if (BUFFERP (object) && !NILP (BVAR (XBUFFER (object), name)))
+ if (BUFFERP (object) && BUFFER_LIVE_P (XBUFFER (object)))
{
/* Walk all windows looking for buffer, and force update
of each of those windows. */
@@ -5549,7 +5538,7 @@ the return value is nil. Otherwise the value is t. */)
saved_windows = XVECTOR (data->saved_windows);
new_current_buffer = data->current_buffer;
- if (NILP (BVAR (XBUFFER (new_current_buffer), name)))
+ if (!BUFFER_LIVE_P (XBUFFER (new_current_buffer)))
new_current_buffer = Qnil;
else
{
@@ -5624,7 +5613,7 @@ the return value is nil. Otherwise the value is t. */)
w = XWINDOW (window);
if (!NILP (w->buffer)
&& !EQ (w->buffer, p->buffer)
- && !NILP (BVAR (XBUFFER (p->buffer), name)))
+ && BUFFER_LIVE_P (XBUFFER (p->buffer)))
/* If a window we restore gets another buffer, record the
window's old buffer. */
call1 (Qrecord_window_buffer, window);
@@ -5774,7 +5763,7 @@ the return value is nil. Otherwise the value is t. */)
if (NILP (p->buffer))
/* An internal window. */
wset_buffer (w, p->buffer);
- else if (!NILP (BVAR (XBUFFER (p->buffer), name)))
+ else if (BUFFER_LIVE_P (XBUFFER (p->buffer)))
/* If saved buffer is alive, install it. */
{
wset_buffer (w, p->buffer);
@@ -5793,7 +5782,7 @@ the return value is nil. Otherwise the value is t. */)
Fgoto_char (w->pointm);
}
else if (!NILP (w->buffer)
- && !NILP (BVAR (XBUFFER (w->buffer), name)))
+ && BUFFER_LIVE_P (XBUFFER (w->buffer)))
/* Keep window's old buffer; make sure the markers are
real. */
{
@@ -6576,15 +6565,17 @@ freeze_window_starts (struct frame *f, int freeze_p)
/* Return 1 if window configurations CONFIGURATION1 and CONFIGURATION2
describe the same state of affairs. This is used by Fequal.
- ignore_positions non-zero means ignore non-matching scroll positions
+ IGNORE_POSITIONS means ignore non-matching scroll positions
and the like.
This ignores a couple of things like the dedication status of
window, combination_limit and the like. This might have to be
fixed. */
-int
-compare_window_configurations (Lisp_Object configuration1, Lisp_Object configuration2, int ignore_positions)
+bool
+compare_window_configurations (Lisp_Object configuration1,
+ Lisp_Object configuration2,
+ bool ignore_positions)
{
register struct save_window_data *d1, *d2;
struct Lisp_Vector *sws1, *sws2;
diff --git a/src/window.h b/src/window.h
index dfb88b2cf3..62ae43a999 100644
--- a/src/window.h
+++ b/src/window.h
@@ -27,8 +27,6 @@ INLINE_HEADER_BEGIN
# define WINDOW_INLINE INLINE
#endif
-extern Lisp_Object Qleft, Qright;
-
/* Windows are allocated as if they were vectors, but then the
Lisp data type is changed to Lisp_Window. They are garbage
collected along with the vectors.
@@ -416,7 +414,16 @@ wset_window_end_vpos (struct window *w, Lisp_Object val)
{
w->window_end_vpos = val;
}
-
+WINDOW_INLINE void
+wset_prev_buffers (struct window *w, Lisp_Object val)
+{
+ w->prev_buffers = val;
+}
+WINDOW_INLINE void
+wset_next_buffers (struct window *w, Lisp_Object val)
+{
+ w->next_buffers = val;
+}
/* 1 if W is a minibuffer window. */
@@ -973,7 +980,7 @@ extern Lisp_Object Qwindowp, Qwindow_live_p;
extern Lisp_Object Vwindow_list;
extern struct window *decode_live_window (Lisp_Object);
-extern int compare_window_configurations (Lisp_Object, Lisp_Object, int);
+extern bool compare_window_configurations (Lisp_Object, Lisp_Object, bool);
extern void mark_window_cursors_off (struct window *);
extern int window_internal_height (struct window *);
extern int window_body_cols (struct window *w);
diff --git a/src/xdisp.c b/src/xdisp.c
index 9b9b91a890..1f6a60c0b8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -273,7 +273,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
#include <limits.h>
-#include <setjmp.h>
#include "lisp.h"
#include "keyboard.h"
@@ -768,9 +767,9 @@ static int clear_image_cache_count;
static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 };
#endif
-/* Non-zero while redisplay_internal is in progress. */
+/* True while redisplay_internal is in progress. */
-int redisplaying_p;
+bool redisplaying_p;
static Lisp_Object Qinhibit_free_realized_faces;
static Lisp_Object Qmode_line_default_help_echo;
@@ -3666,7 +3665,7 @@ handle_fontified_prop (struct it *it)
}
/* There isn't much we can reasonably do to protect against
misbehaving fontification, but here's a fig leaf. */
- else if (!NILP (BVAR (obuf, name)))
+ else if (BUFFER_LIVE_P (obuf))
set_buffer_internal_1 (obuf);
/* The fontification code may have added/removed text.
@@ -7306,7 +7305,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
default:
/* There are no other methods defined, so this should be a bug. */
- abort ();
+ emacs_abort ();
}
eassert (it->method != GET_FROM_STRING
@@ -7761,7 +7760,7 @@ compute_stop_pos_backwards (struct it *it)
compute_stop_pos (it);
/* We must advance forward, right? */
if (it->stop_charpos <= charpos)
- abort ();
+ emacs_abort ();
}
while (charpos > BEGV && it->stop_charpos >= it->end_charpos);
@@ -7810,7 +7809,7 @@ handle_stop_backwards (struct it *it, ptrdiff_t charpos)
compute_stop_pos (it);
/* We must advance forward, right? */
if (it->stop_charpos <= it->prev_stop)
- abort ();
+ emacs_abort ();
charpos = it->stop_charpos;
}
while (charpos <= where_we_are);
@@ -8898,7 +8897,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
break;
default:
- abort ();
+ emacs_abort ();
}
/* Reset/increment for the next run. */
@@ -9291,12 +9290,6 @@ add_to_log (const char *format, Lisp_Object arg1, Lisp_Object arg2)
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
USE_SAFE_ALLOCA;
- /* Do nothing if called asynchronously. Inserting text into
- a buffer may call after-change-functions and alike and
- that would means running Lisp asynchronously. */
- if (handling_signal)
- return;
-
fmt = msg = Qnil;
GCPRO4 (fmt, msg, arg1, arg2);
@@ -9909,7 +9902,7 @@ ensure_echo_area_buffers (void)
for (i = 0; i < 2; ++i)
if (!BUFFERP (echo_buffer[i])
- || NILP (BVAR (XBUFFER (echo_buffer[i]), name)))
+ || !BUFFER_LIVE_P (XBUFFER (echo_buffer[i])))
{
char name[30];
Lisp_Object old_buffer;
@@ -10532,7 +10525,7 @@ void
check_message_stack (void)
{
if (!NILP (Vmessage_stack))
- abort ();
+ emacs_abort ();
}
@@ -10571,7 +10564,6 @@ truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4
return 0;
}
-
/* Set the current message to a substring of S or STRING.
If STRING is a Lisp string, set the message to the first NBYTES
@@ -10598,6 +10590,10 @@ set_message (const char *s, Lisp_Object string,
(intptr_t) s, string, nbytes, multibyte_p);
message_buf_print = 0;
help_echo_showing_p = 0;
+
+ if (STRINGP (Vdebug_on_message)
+ && fast_string_match (Vdebug_on_message, string) >= 0)
+ call_debugger (list2 (Qerror, string));
}
@@ -12789,7 +12785,7 @@ overlay_arrow_at_row (struct it *it, struct glyph_row *row)
return make_number (fringe_bitmap);
}
#endif
- return make_number (-1); /* Use default arrow bitmap */
+ return make_number (-1); /* Use default arrow bitmap. */
}
return overlay_arrow_string_or_property (var);
}
@@ -12966,12 +12962,11 @@ redisplay_internal (void)
if (redisplaying_p)
return;
- /* Record a function that resets redisplaying_p to its old value
+ /* Record a function that clears redisplaying_p
when we leave this function. */
count = SPECPDL_INDEX ();
- record_unwind_protect (unwind_redisplay,
- Fcons (make_number (redisplaying_p), selected_frame));
- ++redisplaying_p;
+ record_unwind_protect (unwind_redisplay, selected_frame);
+ redisplaying_p = 1;
specbind (Qinhibit_free_realized_faces, Qnil);
{
@@ -13709,21 +13704,15 @@ redisplay_preserve_echo_area (int from_where)
}
-/* Function registered with record_unwind_protect in
- redisplay_internal. Reset redisplaying_p to the value it had
- before redisplay_internal was called, and clear
- prevent_freeing_realized_faces_p. It also selects the previously
+/* Function registered with record_unwind_protect in redisplay_internal.
+ Clear redisplaying_p. Also, select the previously
selected frame, unless it has been deleted (by an X connection
failure during redisplay, for example). */
static Lisp_Object
-unwind_redisplay (Lisp_Object val)
+unwind_redisplay (Lisp_Object old_frame)
{
- Lisp_Object old_redisplaying_p, old_frame;
-
- old_redisplaying_p = XCAR (val);
- redisplaying_p = XFASTINT (old_redisplaying_p);
- old_frame = XCDR (val);
+ redisplaying_p = 0;
if (! EQ (old_frame, selected_frame)
&& FRAME_LIVE_P (XFRAME (old_frame)))
select_frame_for_redisplay (old_frame);
@@ -14422,7 +14411,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
for (g = row->glyphs[TEXT_AREA], x = row->x; g < glyph; g++)
{
if (g >= row->glyphs[TEXT_AREA] + row->used[TEXT_AREA])
- abort ();
+ emacs_abort ();
x += g->pixel_width;
}
}
@@ -14543,7 +14532,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
SET_MARKER_FROM_TEXT_POS (w->start, startp);
if (current_buffer != XBUFFER (w->buffer))
- abort ();
+ emacs_abort ();
if (!NILP (Vwindow_scroll_functions))
{
@@ -15512,9 +15501,9 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
/* Some sanity checks. */
CHECK_WINDOW_END (w);
if (Z == Z_BYTE && CHARPOS (opoint) != BYTEPOS (opoint))
- abort ();
+ emacs_abort ();
if (BYTEPOS (opoint) < CHARPOS (opoint))
- abort ();
+ emacs_abort ();
/* If %c is in mode line, update it if needed. */
if (!NILP (w->column_number_displayed)
@@ -15726,7 +15715,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
goto try_to_scroll;
default:
- abort ();
+ emacs_abort ();
}
}
/* If current starting point was originally the beginning of a line
@@ -15889,7 +15878,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
break;
default:
- abort ();
+ emacs_abort ();
}
}
@@ -17337,7 +17326,7 @@ try_window_id (struct window *w)
if (row)
set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0);
else
- abort ();
+ emacs_abort ();
return 1;
}
}
@@ -17381,7 +17370,7 @@ try_window_id (struct window *w)
if (row)
set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0);
else
- abort ();
+ emacs_abort ();
return 2;
}
}
@@ -17870,7 +17859,7 @@ try_window_id (struct window *w)
IF_DEBUG (debug_method_add (w, "C"));
}
else
- abort ();
+ emacs_abort ();
IF_DEBUG (debug_end_pos = XFASTINT (w->window_end_pos);
debug_end_vpos = XFASTINT (w->window_end_vpos));
@@ -19247,7 +19236,7 @@ find_row_edges (struct it *it, struct glyph_row *row,
/* A line that is entirely from a string/image/stretch... */
row->maxpos = row->minpos;
else
- abort ();
+ emacs_abort ();
}
else
row->maxpos = it->current.pos;
@@ -20088,7 +20077,7 @@ See also `bidi-paragraph-direction'. */)
return Qright_to_left;
break;
default:
- abort ();
+ emacs_abort ();
}
}
}
@@ -21043,8 +21032,7 @@ are the selected window and the WINDOW's buffer). */)
: EQ (face, Qtool_bar) ? TOOL_BAR_FACE_ID
: DEFAULT_FACE_ID;
- if (XBUFFER (buffer) != current_buffer)
- old_buffer = current_buffer;
+ old_buffer = current_buffer;
/* Save things including mode_line_proptrans_alist,
and set that to nil so that we don't alter the outer value. */
@@ -21055,8 +21043,7 @@ are the selected window and the WINDOW's buffer). */)
mode_line_proptrans_alist = Qnil;
Fselect_window (window, Qt);
- if (old_buffer)
- set_buffer_internal_1 (XBUFFER (buffer));
+ set_buffer_internal_1 (XBUFFER (buffer));
init_iterator (&it, w, -1, -1, NULL, face_id);
@@ -22001,7 +21988,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
{
/* Glyph is off the left margin of the display area.
Should not happen. */
- abort ();
+ emacs_abort ();
}
row->ascent = max (row->ascent, it->max_ascent);
@@ -23046,7 +23033,8 @@ right_overwritten (struct glyph_string *s)
{
int x = 0, i;
struct glyph *glyphs = s->row->glyphs[s->area];
- int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars);
+ int first = (s->first_glyph - glyphs
+ + (s->first_glyph->type == COMPOSITE_GLYPH ? 1 : s->nchars));
int end = s->row->used[s->area];
for (i = first; i < end && s->right_overhang > x; ++i)
@@ -23069,7 +23057,8 @@ right_overwriting (struct glyph_string *s)
int i, k, x;
int end = s->row->used[s->area];
struct glyph *glyphs = s->row->glyphs[s->area];
- int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars);
+ int first = (s->first_glyph - glyphs
+ + (s->first_glyph->type == COMPOSITE_GLYPH ? 1 : s->nchars));
k = -1;
x = 0;
@@ -23366,7 +23355,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
break; \
\
default: \
- abort (); \
+ emacs_abort (); \
} \
\
if (s) \
@@ -23707,7 +23696,7 @@ append_glyph (struct it *it)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
- abort ();
+ emacs_abort ();
glyph->bidi_type = it->bidi_it.type;
}
else
@@ -23781,7 +23770,7 @@ append_composite_glyph (struct it *it)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
- abort ();
+ emacs_abort ();
glyph->bidi_type = it->bidi_it.type;
}
++it->glyph_row->used[area];
@@ -23960,7 +23949,7 @@ produce_image_glyph (struct it *it)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
- abort ();
+ emacs_abort ();
glyph->bidi_type = it->bidi_it.type;
}
++it->glyph_row->used[area];
@@ -24021,7 +24010,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
- abort ();
+ emacs_abort ();
glyph->bidi_type = it->bidi_it.type;
}
else
@@ -24276,7 +24265,7 @@ produce_special_glyphs (struct it *it, enum display_element_type what)
}
}
else
- abort ();
+ emacs_abort ();
#ifdef HAVE_WINDOW_SYSTEM
/* On a GUI frame, when the right fringe (left fringe for R2L rows)
@@ -24473,7 +24462,7 @@ append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len,
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
- abort ();
+ emacs_abort ();
glyph->bidi_type = it->bidi_it.type;
}
++it->glyph_row->used[area];
@@ -29306,6 +29295,10 @@ Its value should be an ASCII acronym string, `hex-code', `empty-box', or
Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil);
Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0),
Qempty_box);
+
+ DEFVAR_LISP ("debug-on-message", Vdebug_on_message,
+ doc: /* If non-nil, debug if a message matching this regexp is displayed. */);
+ Vdebug_on_message = Qnil;
}
diff --git a/src/xfaces.c b/src/xfaces.c
index 67e9c2c37c..51e568547e 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -204,7 +204,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h> /* This needs to be before termchar.h */
-#include <setjmp.h>
#include "lisp.h"
#include "character.h"
@@ -315,9 +314,10 @@ static Lisp_Object QCfontset;
Lisp_Object Qnormal;
Lisp_Object Qbold;
static Lisp_Object Qline, Qwave;
-Lisp_Object Qultra_light, Qextra_light, Qlight;
+static Lisp_Object Qultra_light, Qreverse_oblique, Qreverse_italic;
+Lisp_Object Qextra_light, Qlight;
Lisp_Object Qsemi_light, Qsemi_bold, Qextra_bold, Qultra_bold;
-Lisp_Object Qoblique, Qreverse_oblique, Qreverse_italic;
+Lisp_Object Qoblique;
Lisp_Object Qitalic;
static Lisp_Object Qultra_condensed, Qextra_condensed;
Lisp_Object Qcondensed;
@@ -452,18 +452,7 @@ static int menu_face_changed_default;
struct table_entry;
struct named_merge_point;
-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 ptrdiff_t 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,
@@ -473,38 +462,11 @@ 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 (struct frame *, unsigned long, XGCValues *);
-static void x_free_gc (struct frame *, GC);
-
-#ifdef USE_X_TOOLKIT
-static void x_update_menu_appearance (struct frame *);
-
-extern void free_frame_menubar (struct frame *);
-#endif /* USE_X_TOOLKIT */
-
-#endif /* HAVE_WINDOW_SYSTEM */
/***********************************************************************
@@ -547,7 +509,7 @@ unregister_color (unsigned long pixel)
if (color_count[pixel] > 0)
--color_count[pixel];
else
- abort ();
+ emacs_abort ();
}
@@ -698,7 +660,7 @@ x_create_gc (struct frame *f,
XGCValues *xgcv)
{
GC gc = xmalloc (sizeof *gc);
- memcpy (gc, xgcv, sizeof (XGCValues));
+ *gc = *xgcv;
return gc;
}
@@ -764,7 +726,7 @@ init_frame_faces (struct frame *f)
if (!FRAME_NS_P (f) || FRAME_NS_WINDOW (f))
#endif
if (!realize_basic_faces (f))
- abort ();
+ emacs_abort ();
}
@@ -808,7 +770,7 @@ recompute_basic_faces (struct frame *f)
{
clear_face_cache (0);
if (!realize_basic_faces (f))
- abort ();
+ emacs_abort ();
}
}
@@ -1145,7 +1107,7 @@ defined_color (struct frame *f, const char *color_name, XColor *color_def,
return ns_defined_color (f, color_name, color_def, alloc, 1);
#endif
else
- abort ();
+ emacs_abort ();
}
@@ -1341,7 +1303,7 @@ load_color (struct frame *f, struct face *face, Lisp_Object name,
break;
default:
- abort ();
+ emacs_abort ();
}
}
#ifdef GLYPH_DEBUG
@@ -4585,7 +4547,7 @@ lookup_named_face (struct frame *f, Lisp_Object symbol, int signal_p)
return -1;
default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
if (default_face == NULL)
- abort (); /* realize_basic_faces must have set it up */
+ emacs_abort (); /* realize_basic_faces must have set it up */
}
if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
@@ -4628,7 +4590,7 @@ lookup_basic_face (struct frame *f, int face_id)
case MENU_FACE_ID: name = Qmenu; break;
default:
- abort (); /* the caller is supposed to pass us a basic face id */
+ emacs_abort (); /* the caller is supposed to pass us a basic face id */
}
/* Do a quick scan through Vface_remapping_alist, and return immediately
@@ -4749,7 +4711,7 @@ lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id,
struct face *default_face = FACE_FROM_ID (f, face_id);
if (!default_face)
- abort ();
+ emacs_abort ();
if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
return -1;
@@ -5139,7 +5101,7 @@ face for italic. */)
error ("Cannot realize default face");
def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
if (def_face == NULL)
- abort (); /* realize_basic_faces must have set it up */
+ emacs_abort (); /* realize_basic_faces must have set it up */
}
/* Dispatch to the appropriate handler. */
@@ -5424,7 +5386,7 @@ realize_default_face (struct frame *f)
else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
ASET (lface, LFACE_FOREGROUND_INDEX, build_string (unspecified_fg));
else
- abort ();
+ emacs_abort ();
}
if (UNSPECIFIEDP (LFACE_BACKGROUND (lface)))
@@ -5439,7 +5401,7 @@ realize_default_face (struct frame *f)
else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
ASET (lface, LFACE_BACKGROUND_INDEX, build_string (unspecified_bg));
else
- abort ();
+ emacs_abort ();
}
if (UNSPECIFIEDP (LFACE_STIPPLE (lface)))
@@ -5539,7 +5501,7 @@ realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id)
face = make_realized_face (attrs);
}
else
- abort ();
+ emacs_abort ();
/* Insert the new face. */
cache_face (cache, face, lface_hash (attrs));
@@ -5634,7 +5596,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
if (default_face)
fontset = default_face->fontset;
if (fontset == -1)
- abort ();
+ emacs_abort ();
}
if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
attrs[LFACE_FONT_INDEX]
diff --git a/src/xfns.c b/src/xfns.c
index 90b54d1234..8304a3df04 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
#include <math.h>
-#include <setjmp.h>
#include <unistd.h>
/* This makes the fields of a Display accessible, in Xlib header files. */
diff --git a/src/xfont.c b/src/xfont.c
index cbb24622ae..1f2fd13f1b 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <X11/Xlib.h>
#include "lisp.h"
@@ -46,7 +45,6 @@ struct xfont_info
};
/* Prototypes of support functions. */
-extern void x_clear_errors (Display *);
static XCharStruct *xfont_get_pcm (XFontStruct *, XChar2b *);
@@ -127,7 +125,7 @@ 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_draw (struct glyph_string *, int, int, int, int, bool);
static int xfont_check (FRAME_PTR, struct font *);
struct font_driver xfont_driver =
@@ -218,9 +216,9 @@ xfont_encode_coding_xlfd (char *xlfd)
/* Check if CHARS (cons or vector) is supported by XFONT whose
encoding charset is ENCODING (XFONT is NULL) or by a font whose
registry corresponds to ENCODING and REPERTORY.
- Return 1 if supported, return 0 otherwise. */
+ Return true if supported. */
-static int
+static bool
xfont_chars_supported (Lisp_Object chars, XFontStruct *xfont,
struct charset *encoding, struct charset *repertory)
{
@@ -1020,7 +1018,8 @@ xfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct f
}
static int
-xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background)
+xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
+ bool with_background)
{
XFontStruct *xfont = ((struct xfont_info *) s->font)->xfont;
int len = to - from;
@@ -1041,7 +1040,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_bac
for (i = 0; i < len ; i++)
str[i] = XCHAR2B_BYTE2 (s->char2b + from + i);
BLOCK_INPUT;
- if (with_background > 0)
+ if (with_background)
{
if (s->padding_p)
for (i = 0; i < len; i++)
@@ -1067,7 +1066,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_bac
}
BLOCK_INPUT;
- if (with_background > 0)
+ if (with_background)
{
if (s->padding_p)
for (i = 0; i < len; i++)
diff --git a/src/xftfont.c b/src/xftfont.c
index 5e60ab0c4d..9f52eb8b23 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <setjmp.h>
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
@@ -52,7 +51,7 @@ struct xftfont_info
/* The following five members must be here in this order to be
compatible with struct ftfont_info (in ftfont.c). */
#ifdef HAVE_LIBOTF
- int maybe_otf; /* Flag to tell if this may be OTF or not. */
+ bool maybe_otf; /* Flag to tell if this may be OTF or not. */
OTF *otf;
#endif /* HAVE_LIBOTF */
FT_Size ft_size;
@@ -92,7 +91,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
else
{
XGCValues xgcv;
- int fg_done = 0, bg_done = 0;
+ bool fg_done = 0, bg_done = 0;
BLOCK_INPUT;
XGetGCValues (FRAME_X_DISPLAY (f), gc,
@@ -111,7 +110,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
*bg = xftface_info->xft_fg, bg_done = 1;
}
- if (fg_done + bg_done < 2)
+ if (! (fg_done & bg_done))
{
XColor colors[2];
@@ -137,19 +136,6 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
}
-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
@@ -470,7 +456,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
font->underline_thickness = 0;
}
#ifdef HAVE_LIBOTF
- xftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT;
+ xftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0;
xftfont_info->otf = NULL;
#endif /* HAVE_LIBOTF */
xftfont_info->ft_size = ft_face->size;
@@ -630,7 +616,8 @@ xftfont_get_xft_draw (FRAME_PTR f)
}
static int
-xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background)
+xftfont_draw (struct glyph_string *s, int from, int to, int x, int y,
+ bool with_background)
{
FRAME_PTR f = s->f;
struct face *face = s->face;
@@ -711,15 +698,17 @@ xftfont_end_for_frame (FRAME_PTR f)
return 0;
}
-static int
-xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object, Lisp_Object entity)
+static bool
+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;
Display *display = FRAME_X_DISPLAY (f);
FcPattern *pat = FcPatternCreate ();
FcBool b1, b2;
- int ok = 0, i1, i2, r1, r2;
+ bool ok = 0;
+ int i1, i2, r1, r2;
xftfont_add_rendering_parameters (pat, entity);
XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat);
diff --git a/src/xgselect.c b/src/xgselect.c
index 0c00d81582..c161564a32 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -19,14 +19,12 @@ along with GNU Emacs. If not, see <http§://www.gnu.org/licenses/>. */
#include <config.h>
-#include <setjmp.h>
#include "xgselect.h"
#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS)
#include <glib.h>
#include <errno.h>
-#include <setjmp.h>
#include "xterm.h"
int
@@ -49,9 +47,9 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
&& g_main_context_pending (context = g_main_context_default ())))
return pselect (fds_lim, rfds, wfds, efds, timeout, sigmask);
- if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds));
+ if (rfds) all_rfds = *rfds;
else FD_ZERO (&all_rfds);
- if (wfds) memcpy (&all_wfds, wfds, sizeof (all_rfds));
+ if (wfds) all_wfds = *wfds;
else FD_ZERO (&all_wfds);
n_gfds = g_main_context_query (context, G_PRIORITY_LOW, &tmo_in_millisec,
diff --git a/src/xmenu.c b/src/xmenu.c
index 54a7849218..d03a4bc974 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -32,13 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#if 0 /* Why was this included? And without syssignal.h? */
-/* On 4.3 this loses if it comes after xterm.h. */
-#include <signal.h>
-#endif
-
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "keyboard.h"
@@ -169,7 +163,7 @@ mouse_position_for_popup (FRAME_PTR f, int *x, int *y)
int dummy;
if (! FRAME_X_P (f))
- abort ();
+ emacs_abort ();
BLOCK_INPUT;
@@ -636,7 +630,7 @@ void
x_activate_menubar (FRAME_PTR f)
{
if (! FRAME_X_P (f))
- abort ();
+ emacs_abort ();
if (!f->output_data.x->saved_menu_event->type)
return;
@@ -852,7 +846,7 @@ update_frame_menubar (FRAME_PTR f)
int columns, rows;
if (! FRAME_X_P (f))
- abort ();
+ emacs_abort ();
x = f->output_data.x;
@@ -940,7 +934,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
int *submenu_top_level_items, *submenu_n_panes;
if (! FRAME_X_P (f))
- abort ();
+ emacs_abort ();
menubar_widget = f->output_data.x->menubar_widget;
@@ -1299,7 +1293,7 @@ free_frame_menubar (FRAME_PTR f)
Widget menubar_widget;
if (! FRAME_X_P (f))
- abort ();
+ emacs_abort ();
menubar_widget = f->output_data.x->menubar_widget;
@@ -1450,7 +1444,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
#endif
if (! FRAME_X_P (f))
- abort ();
+ emacs_abort ();
xg_crazy_callback_abort = 1;
menu = xg_create_widget ("popup", first_wv->name, f, first_wv,
@@ -1557,7 +1551,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
Widget menu;
if (! FRAME_X_P (f))
- abort ();
+ emacs_abort ();
#ifdef USE_LUCID
apply_systemfont_to_menu (f, f->output_data.x->widget);
@@ -1646,7 +1640,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
if (! FRAME_X_P (f))
- abort ();
+ emacs_abort ();
*error_name = NULL;
@@ -1792,7 +1786,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
else if (EQ (type, QCradio))
wv->button_type = BUTTON_TYPE_RADIO;
else
- abort ();
+ emacs_abort ();
wv->selected = !NILP (selected);
@@ -1930,7 +1924,7 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv)
GtkWidget *menu;
if (! FRAME_X_P (f))
- abort ();
+ emacs_abort ();
menu = xg_create_widget ("dialog", first_wv->name, f, first_wv,
G_CALLBACK (dialog_selection_callback),
@@ -1977,7 +1971,7 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv)
LWLIB_ID dialog_id;
if (!FRAME_X_P (f))
- abort ();
+ emacs_abort ();
dialog_id = widget_id_tick++;
#ifdef USE_LUCID
@@ -2036,7 +2030,7 @@ xdialog_show (FRAME_PTR f,
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
if (! FRAME_X_P (f))
- abort ();
+ emacs_abort ();
*error_name = NULL;
@@ -2301,7 +2295,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f))
- abort ();
+ emacs_abort ();
*error_name = 0;
if (menu_items_n_panes == 0)
diff --git a/src/xml.c b/src/xml.c
index 7bc6130b8b..b668525cf2 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_LIBXML2
-#include <setjmp.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/HTMLparser.h>
diff --git a/src/xrdb.c b/src/xrdb.c
index 624bafa5e9..73672c9617 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -26,7 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <epaths.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
diff --git a/src/xselect.c b/src/xselect.c
index 463bd6e37b..ab199e0b9b 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <limits.h>
#include <stdio.h> /* termhooks.h needs this */
-#include <setjmp.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -193,7 +192,7 @@ static void
x_start_queuing_selection_requests (void)
{
if (x_queue_selection_requests)
- abort ();
+ emacs_abort ();
x_queue_selection_requests++;
TRACE1 ("x_start_queuing_selection_requests %d", x_queue_selection_requests);
@@ -245,7 +244,7 @@ symbol_to_x_atom (struct x_display_info *dpyinfo, Lisp_Object sym)
if (EQ (sym, QEMACS_TMP)) return dpyinfo->Xatom_EMACS_TMP;
if (EQ (sym, QTARGETS)) return dpyinfo->Xatom_TARGETS;
if (EQ (sym, QNULL)) return dpyinfo->Xatom_NULL;
- if (!SYMBOLP (sym)) abort ();
+ if (!SYMBOLP (sym)) emacs_abort ();
TRACE1 (" XInternAtom %s", SSDATA (SYMBOL_NAME (sym)));
BLOCK_INPUT;
@@ -1138,7 +1137,7 @@ wait_for_property_change (struct prop_location *location)
ptrdiff_t count = SPECPDL_INDEX ();
if (property_change_reply_object)
- abort ();
+ emacs_abort ();
/* Make sure to do unexpect_property_change if we quit or err. */
record_unwind_protect (wait_for_property_change_unwind,
diff --git a/src/xsettings.c b/src/xsettings.c
index a28d75d942..58c8449548 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <float.h>
#include <limits.h>
-#include <setjmp.h>
#include <fcntl.h>
#include "lisp.h"
#include "xterm.h"
@@ -711,12 +710,12 @@ apply_xft_settings (struct x_display_info *dpyinfo,
if (send_event_p)
store_config_changed_event (Qfont_render,
XCAR (dpyinfo->name_list_element));
- Vxft_settings
+ Vxft_settings
= make_formatted_string (buf, format,
oldsettings.aa, oldsettings.hinting,
oldsettings.rgba, oldsettings.lcdfilter,
oldsettings.hintstyle, oldsettings.dpi);
-
+
}
else
FcPatternDestroy (pat);
diff --git a/src/xsmfns.c b/src/xsmfns.c
index cddbb2aae8..8067899f93 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -29,7 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <sys/param.h>
#include <stdio.h>
-#include <setjmp.h>
#include "lisp.h"
#include "systime.h"
diff --git a/src/xterm.c b/src/xterm.c
index 7e61cc4d8e..9ab53dc087 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -21,17 +21,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Xt features made by Fred Pierresteguy. */
#include <config.h>
-#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
#ifdef HAVE_X_WINDOWS
#include "lisp.h"
#include "blockinput.h"
-
-/* Need syssignal.h for various externs and definitions that may be required
- by some configurations for calls to signal later in this source file. */
#include "syssignal.h"
/* This may include sys/types.h, and that somehow loses
@@ -51,7 +46,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <fcntl.h>
#include <errno.h>
-#include <setjmp.h>
#include <sys/stat.h>
/* Caused redefinition of DBL_DIG on Netbsd; seems not to be needed. */
/* #include <sys/param.h> */
@@ -165,13 +159,6 @@ struct x_display_info *x_display_list;
Lisp_Object x_display_name_list;
-/* Frame being updated by update_frame. This is declared in term.c.
- This is set by update_begin and looked at by all the XT functions.
- It is zero while not inside an update. In that case, the XT
- functions assume that `selected_frame' is the frame to apply to. */
-
-extern struct frame *updating_frame;
-
/* This is a frame waiting to be auto-raised, within XTread_socket. */
static struct frame *pending_autoraise_frame;
@@ -1474,7 +1461,7 @@ x_frame_of_widget (Widget widget)
&& f->output_data.x->widget == widget)
return f;
- abort ();
+ emacs_abort ();
}
/* Allocate a color which is lighter or darker than *PIXEL by FACTOR
@@ -2703,7 +2690,7 @@ x_draw_underwave (struct glyph_string *s)
y2 += dy;
if (INT_MAX - dx < xmax)
- abort ();
+ emacs_abort ();
while (x1 <= xmax)
{
@@ -2812,7 +2799,7 @@ x_draw_glyph_string (struct glyph_string *s)
break;
default:
- abort ();
+ emacs_abort ();
}
if (!s->for_overlaps)
@@ -2986,6 +2973,7 @@ x_draw_glyph_string (struct glyph_string *s)
XSetClipMask (next->display, next->gc, None);
next->hl = save;
next->num_clips = 0;
+ next->clip_head = s->next;
}
}
}
@@ -3012,7 +3000,7 @@ x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height,
static void
x_delete_glyphs (struct frame *f, register int n)
{
- abort ();
+ emacs_abort ();
}
@@ -3285,7 +3273,7 @@ XTset_terminal_window (struct frame *f, int n)
static void
x_ins_del_lines (struct frame *f, int vpos, int n)
{
- abort ();
+ emacs_abort ();
}
@@ -4122,7 +4110,7 @@ x_window_to_scroll_bar (Display *display, Window window_id)
frame = XCAR (tail);
/* All elements of Vframe_list should be frames. */
if (! FRAMEP (frame))
- abort ();
+ emacs_abort ();
if (! FRAME_X_P (XFRAME (frame)))
continue;
@@ -5441,7 +5429,7 @@ XTredeem_scroll_bar (struct window *window)
/* We can't redeem this window's scroll bar if it doesn't have one. */
if (NILP (window->vertical_scroll_bar))
- abort ();
+ emacs_abort ();
bar = XSCROLL_BAR (window->vertical_scroll_bar);
@@ -5460,7 +5448,7 @@ XTredeem_scroll_bar (struct window *window)
else
/* If its prev pointer is nil, it must be at the front of
one or the other! */
- abort ();
+ emacs_abort ();
}
else
XSCROLL_BAR (bar->prev)->next = bar->next;
@@ -5558,7 +5546,7 @@ static void
x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_event *emacs_event)
{
if (! WINDOWP (bar->window))
- abort ();
+ emacs_abort ();
emacs_event->kind = SCROLL_BAR_CLICK_EVENT;
emacs_event->code = event->xbutton.button - Button1;
@@ -6464,7 +6452,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
}
else if (status_return != XLookupKeySym
&& status_return != XLookupBoth)
- abort ();
+ emacs_abort ();
}
else
nbytes = XLookupString (&event.xkey, (char *) copy_bufptr,
@@ -7141,25 +7129,17 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold
if (interrupt_input_blocked)
{
interrupt_input_pending = 1;
-#ifdef SYNC_INPUT
pending_signals = 1;
-#endif
return -1;
}
interrupt_input_pending = 0;
-#ifdef SYNC_INPUT
pending_signals = pending_atimers;
-#endif
BLOCK_INPUT;
/* So people can tell when we have read the available input. */
input_signal_count++;
-#ifndef SYNC_INPUT
- ++handling_signal;
-#endif
-
/* For debugging, this gives a way to fake an I/O error. */
if (terminal->display_info.x == XTread_socket_fake_io_error)
{
@@ -7248,9 +7228,6 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold
pending_autoraise_frame = 0;
}
-#ifndef SYNC_INPUT
- --handling_signal;
-#endif
UNBLOCK_INPUT;
return count;
@@ -7503,7 +7480,7 @@ x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, int
break;
default:
- abort ();
+ emacs_abort ();
}
}
@@ -7773,7 +7750,9 @@ x_connection_signal (int signalnum) /* If we don't have an argument, */
#ifdef USG
/* USG systems forget handlers when they are used;
must reestablish each time */
- signal (signalnum, x_connection_signal);
+ struct sigaction action;
+ emacs_sigaction_init (&action, x_connection_signal);
+ sigaction (signalnum, &action, 0);
#endif /* USG */
}
@@ -7798,7 +7777,6 @@ x_connection_closed (Display *dpy, const char *error_message)
error_msg = alloca (strlen (error_message) + 1);
strcpy (error_msg, error_message);
- handling_signal = 0;
/* Inhibit redisplay while frames are being deleted. */
specbind (Qinhibit_redisplay, Qt);
@@ -7850,13 +7828,13 @@ x_connection_closed (Display *dpy, const char *error_message)
(https://bugzilla.gnome.org/show_bug.cgi?id=85715). Once,
the resulting Glib error message loop filled a user's disk.
To avoid this, kill Emacs unconditionally on disconnect. */
- shut_down_emacs (0, 0, Qnil);
+ shut_down_emacs (0, Qnil);
fprintf (stderr, "%s\n\
When compiled with GTK, Emacs cannot recover from X disconnects.\n\
This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\
For details, see etc/PROBLEMS.\n",
error_msg);
- abort ();
+ emacs_abort ();
#endif /* USE_GTK */
/* Indicate that this display is dead. */
@@ -7866,7 +7844,7 @@ For details, see etc/PROBLEMS.\n",
dpyinfo->terminal->reference_count--;
if (dpyinfo->reference_count != 0)
/* We have just closed all frames on this display. */
- abort ();
+ emacs_abort ();
{
Lisp_Object tmp;
@@ -7883,10 +7861,15 @@ For details, see etc/PROBLEMS.\n",
}
/* Ordinary stack unwind doesn't deal with these. */
-#ifdef SIGIO
- sigunblock (sigmask (SIGIO));
+ {
+ sigset_t unblocked;
+ sigemptyset (&unblocked);
+#ifdef USABLE_SIGIO
+ sigaddset (&unblocked, SIGIO);
#endif
- sigunblock (sigmask (SIGALRM));
+ sigaddset (&unblocked, SIGALRM);
+ pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
+ }
TOTALLY_UNBLOCK_INPUT;
unbind_to (idx, Qnil);
@@ -10424,10 +10407,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
fcntl (connection, F_SETOWN, getpid ());
#endif /* ! defined (F_SETOWN) */
-#ifdef SIGIO
if (interrupt_input)
init_sigio (connection);
-#endif /* ! defined (SIGIO) */
#ifdef USE_LUCID
{
@@ -10443,7 +10424,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
to.addr = (XPointer)&font;
x_catch_errors (dpy);
if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL))
- abort ();
+ emacs_abort ();
if (x_had_errors_p (dpy) || !XQueryFont (dpy, font))
XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15");
x_uncatch_errors ();
@@ -10609,8 +10590,6 @@ x_activate_timeout_atimer (void)
/* Set up use of X before we make the first connection. */
-extern frame_parm_handler x_frame_parm_handlers[];
-
static struct redisplay_interface x_redisplay_interface =
{
x_frame_parm_handlers,
@@ -10768,6 +10747,8 @@ x_create_terminal (struct x_display_info *dpyinfo)
void
x_initialize (void)
{
+ struct sigaction action;
+
baud_rate = 19200;
x_noop_count = 0;
@@ -10814,7 +10795,8 @@ x_initialize (void)
XSetErrorHandler (x_error_handler);
XSetIOErrorHandler (x_io_error_quitter);
- signal (SIGPIPE, x_connection_signal);
+ emacs_sigaction_init (&action, x_connection_signal);
+ sigaction (SIGPIPE, &action, 0);
}
diff --git a/test/ChangeLog b/test/ChangeLog
index f523f6f59a..a7e22aa9ae 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,14 @@
+2012-09-08 Dmitry Gutov <[email protected]>
+
+ * automated/ruby-mode-tests.el:
+ (ruby-toggle-block-to-multiline): New test.
+ (ruby-should-indent-buffer, ruby-toggle-block-to-do-end)
+ (ruby-toggle-block-to-brace): Use buffer-string.
+
+2012-09-07 Dmitry Gutov <[email protected]>
+
+ * automated/ruby-mode-tests.el: New tests (Bug#11613).
+
2012-08-28 Chong Yidong <[email protected]>
* automated/files.el: Test every combination of values for
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el
index df51aa0d15..e711b52fb9 100644
--- a/test/automated/ruby-mode-tests.el
+++ b/test/automated/ruby-mode-tests.el
@@ -40,8 +40,7 @@ The whitespace before and including \"|\" on each line is removed."
(insert (fix-indent content))
(ruby-mode)
(indent-region (point-min) (point-max))
- (should (string= (fix-indent expected) (buffer-substring-no-properties
- (point-min) (point-max)))))))
+ (should (string= (fix-indent expected) (buffer-string))))))
(defun ruby-assert-state (content &rest values-plist)
"Assert syntax state values at the end of CONTENT.
@@ -57,6 +56,13 @@ VALUES-PLIST is a list with alternating index and value elements."
(cadr values-plist)))
(setq values-plist (cddr values-plist)))))
+(defun ruby-assert-face (content pos face)
+ (with-temp-buffer
+ (insert content)
+ (ruby-mode)
+ (font-lock-fontify-buffer)
+ (should (eq face (get-text-property pos 'face)))))
+
(ert-deftest ruby-indent-after-symbol-made-from-string-interpolation ()
"It can indent the line after symbol made using string interpolation."
(ruby-should-indent "def foo(suffix)\n :\"bar#{suffix}\"\n"
@@ -84,6 +90,11 @@ VALUES-PLIST is a list with alternating index and value elements."
(ruby-should-indent "foo = {\na: b" ruby-indent-level)
(ruby-should-indent "foo(\na" ruby-indent-level)))
+(ert-deftest ruby-indent-after-keyword-in-a-string ()
+ (ruby-should-indent "a = \"abc\nif\"\n " 0)
+ (ruby-should-indent "a = %w[abc\n def]\n " 0)
+ (ruby-should-indent "a = \"abc\n def\"\n " 0))
+
(ert-deftest ruby-indent-simple ()
(ruby-should-indent-buffer
"if foo
@@ -201,21 +212,42 @@ VALUES-PLIST is a list with alternating index and value elements."
(ert-deftest ruby-toggle-block-to-do-end ()
(with-temp-buffer
- (insert "foo {|b|\n}\n")
+ (insert "foo {|b|\n}")
(ruby-mode)
- (search-backward "{")
+ (beginning-of-line)
(ruby-toggle-block)
- (should (string= "foo do |b|\nend\n" (buffer-substring-no-properties
- (point-min) (point-max))))))
+ (should (string= "foo do |b|\nend" (buffer-string)))))
(ert-deftest ruby-toggle-block-to-brace ()
(with-temp-buffer
- (insert "foo do |b|\nend\n")
+ (insert "foo do |b|\nend")
(ruby-mode)
- (search-backward "do")
+ (beginning-of-line)
+ (ruby-toggle-block)
+ (should (string= "foo {|b|\n}" (buffer-string)))))
+
+(ert-deftest ruby-toggle-block-to-multiline ()
+ (with-temp-buffer
+ (insert "foo {|b| b + 1}")
+ (ruby-mode)
+ (beginning-of-line)
(ruby-toggle-block)
- (should (string= "foo {|b|\n}\n" (buffer-substring-no-properties
- (point-min) (point-max))))))
+ (should (string= "foo do |b|\n b + 1\nend" (buffer-string)))))
+
+(ert-deftest ruby-recognize-symbols-starting-with-at-character ()
+ (ruby-assert-face ":@abc" 3 'font-lock-constant-face))
+
+(ert-deftest ruby-hash-character-not-interpolation ()
+ (ruby-assert-face "\"This is #{interpolation}\"" 15
+ 'font-lock-variable-name-face)
+ (ruby-assert-face "\"This is \\#{no interpolation} despite the #\""
+ 15 'font-lock-string-face)
+ (ruby-assert-face "\n#@comment, not ruby code" 5 'font-lock-comment-face)
+ (ruby-assert-state "\n#@comment, not ruby code" 4 t)
+ (ruby-assert-face "# A comment cannot have #{an interpolation} in it"
+ 30 'font-lock-comment-face)
+ (ruby-assert-face "# #{comment}\n \"#{interpolation}\"" 16
+ 'font-lock-variable-name-face))
(provide 'ruby-mode-tests)