Now on revision 110011. ------------------------------------------------------------ revno: 110011 committer: Jan D. branch nick: trunk timestamp: Thu 2012-09-13 08:27:21 +0200 message: * configure.ac: Reorder Xaw3d messages. diff: === modified file 'ChangeLog' --- ChangeLog 2012-09-13 02:21:28 +0000 +++ ChangeLog 2012-09-13 06:27:21 +0000 @@ -1,3 +1,7 @@ +2012-09-13 Jan Djärv + + * configure.ac: Reorder Xaw3d messages. + 2012-09-13 Paul Eggert Simplify SIGIO usage (Bug#12408). === modified file 'configure.ac' --- configure.ac 2012-09-13 02:21:28 +0000 +++ configure.ac 2012-09-13 06:27:21 +0000 @@ -2109,7 +2109,6 @@ 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 @@ -2122,6 +2121,7 @@ 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 @@ -2129,6 +2129,7 @@ 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, ------------------------------------------------------------ revno: 110010 committer: Jan Djärv branch nick: trunk timestamp: Thu 2012-09-13 08:13:26 +0200 message: * etc/NEWS (--with-x-toolkit): Mention Gtk+ 3 is now default. diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2012-09-13 06:09:45 +0000 +++ etc/ChangeLog 2012-09-13 06:13:26 +0000 @@ -1,3 +1,7 @@ +2012-09-13 Jan Djärv + + * NEWS (--with-x-toolkit): Mention that Gtk+ 3 is now default. + 2012-09-13 Paul Eggert * NEWS: Document timer format change (Bug#12430). === modified file 'etc/NEWS' --- etc/NEWS 2012-09-13 06:09:45 +0000 +++ etc/NEWS 2012-09-13 06:13:26 +0000 @@ -65,6 +65,14 @@ 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 ------------------------------------------------------------ revno: 110009 fixes bug: http://debbugs.gnu.org/12430 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-09-12 23:09:45 -0700 message: Fix glitches caused by addition of psec to timers. * etc/NEWS: Document timer format change. * lisp/image.el (image-animate-timer): * lisp/time.el (display-time-world-timer): Use timer--function and timer--args rather than raw access to timer vector. * lisp/gnus/gnus-art.el (gnus-article-stop-animations): Use timer--function rather than raw access to timer vector. diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2012-09-11 02:28:27 +0000 +++ etc/ChangeLog 2012-09-13 06:09:45 +0000 @@ -1,3 +1,7 @@ +2012-09-13 Paul Eggert + + * NEWS: Document timer format change (Bug#12430). + 2012-09-11 Paul Eggert Simplify, document, and port floating-point (Bug#12381). === modified file 'etc/NEWS' --- etc/NEWS 2012-09-12 19:16:36 +0000 +++ etc/NEWS 2012-09-13 06:09:45 +0000 @@ -101,6 +101,11 @@ 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 +[HIGH-SECONDS LOW-SECONDS USECS PSECS REPEAT-DELAY FUNCTION ARGS IDLE-DELAY]. +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 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-13 02:41:46 +0000 +++ lisp/ChangeLog 2012-09-13 06:09:45 +0000 @@ -1,3 +1,11 @@ +2012-09-13 Paul Eggert + + 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 * emacs-lisp/bytecomp.el (byte-compile-warning-prefix): === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-09-11 10:08:59 +0000 +++ lisp/gnus/ChangeLog 2012-09-13 06:09:45 +0000 @@ -1,3 +1,9 @@ +2012-09-13 Paul Eggert + + 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 * gnus-notifications.el (gnus-notifications): Check for nil values in === modified file 'lisp/gnus/gnus-art.el' --- lisp/gnus/gnus-art.el 2012-08-14 05:34:20 +0000 +++ lisp/gnus/gnus-art.el 2012-09-13 06:09:45 +0000 @@ -4554,7 +4554,7 @@ (defun gnus-article-stop-animations () (dolist (timer (and (boundp 'timer-list) timer-list)) - (when (eq (elt timer 5) 'image-animate-timeout) + (when (eq (timer--function timer) 'image-animate-timeout) (cancel-timer timer)))) (defun gnus-stop-downloads () === modified file 'lisp/image.el' --- lisp/image.el 2012-08-15 16:29:11 +0000 +++ lisp/image.el 2012-09-13 06:09:45 +0000 @@ -645,8 +645,8 @@ (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)) === modified file 'lisp/time.el' --- lisp/time.el 2012-05-04 06:13:18 +0000 +++ lisp/time.el 2012-09-13 06:09:45 +0000 @@ -575,7 +575,8 @@ (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 ------------------------------------------------------------ revno: 110008 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2012-09-13 09:18:26 +0400 message: 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. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-13 04:14:33 +0000 +++ src/ChangeLog 2012-09-13 05:18:26 +0000 @@ -1,3 +1,12 @@ +2012-09-13 Dmitry Antipov + + 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 Better workaround for GNOME bug when --enable-gcc-warnings. === modified file 'src/alloc.c' --- src/alloc.c 2012-09-11 20:35:23 +0000 +++ src/alloc.c 2012-09-13 05:18:26 +0000 @@ -5865,16 +5865,16 @@ mark_buffer (buffer->base_buffer); } -/* Remove killed buffers or items whose car is a killed buffer - from LIST and return changed LIST. Called during GC. */ +/* 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 -discard_killed_buffers (Lisp_Object list) +mark_discard_killed_buffers (Lisp_Object list) { - Lisp_Object *prev = &list; - Lisp_Object tail; + Lisp_Object tail, *prev = &list; - for (tail = list; CONSP (tail); tail = XCDR (tail)) + for (tail = list; CONSP (tail) && !CONS_MARKED_P (XCONS (tail)); + tail = XCDR (tail)) { Lisp_Object tem = XCAR (tail); if (CONSP (tem)) @@ -5882,7 +5882,11 @@ if (BUFFERP (tem) && !BUFFER_LIVE_P (XBUFFER (tem))) *prev = XCDR (tail); else - prev = &XCDR_AS_LVALUE (tail); + { + CONS_MARK (XCONS (tail)); + mark_object (XCAR (tail)); + prev = &XCDR_AS_LVALUE (tail); + } } return list; } @@ -6023,18 +6027,8 @@ break; case PVEC_FRAME: - { - struct frame *f = (struct frame *) ptr; - - /* For live frames, killed buffers are filtered out by - store_frame_param. For dead frames, we do it here in - attempt to help GC to reclaim killed buffers faster. */ - if (!FRAME_LIVE_P (f)) - fset_buffer_list (f, discard_killed_buffers (f->buffer_list)); - - mark_vectorlike (ptr); - mark_face_cache (f->face_cache); - } + mark_vectorlike (ptr); + mark_face_cache (((struct frame *) ptr)->face_cache); break; case PVEC_WINDOW: @@ -6048,9 +6042,9 @@ if (leaf && NILP (w->buffer)) { wset_prev_buffers - (w, discard_killed_buffers (w->prev_buffers)); + (w, mark_discard_killed_buffers (w->prev_buffers)); wset_next_buffers - (w, discard_killed_buffers (w->next_buffers)); + (w, mark_discard_killed_buffers (w->next_buffers)); } mark_vectorlike (ptr); === modified file 'src/frame.c' --- src/frame.c 2012-09-04 17:34:54 +0000 +++ src/frame.c 2012-09-13 05:18:26 +0000 @@ -1299,6 +1299,11 @@ 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); ------------------------------------------------------------ revno: 110007 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-09-12 21:14:33 -0700 message: 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 . diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-13 02:21:28 +0000 +++ src/ChangeLog 2012-09-13 04:14:33 +0000 @@ -1,5 +1,10 @@ 2012-09-13 Paul Eggert + 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 + . + 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 === modified file 'src/emacsgtkfixed.c' --- src/emacsgtkfixed.c 2012-09-13 01:22:08 +0000 +++ src/emacsgtkfixed.c 2012-09-13 04:14:33 +0000 @@ -28,9 +28,10 @@ #include "xterm.h" /* Silence a bogus diagnostic; see GNOME bug 683906. */ -#include -#undef G_STATIC_ASSERT -#define G_STATIC_ASSERT(x) verify (x) +#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) \ ------------------------------------------------------------ revno: 110006 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-09-12 22:41:46 -0400 message: byte-compile-warning-prefix tweak * lisp/emacs-lisp/bytecomp.el (byte-compile-warning-prefix): If not compiling a file, try using load-file-name. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-13 02:29:05 +0000 +++ lisp/ChangeLog 2012-09-13 02:41:46 +0000 @@ -1,3 +1,8 @@ +2012-09-13 Glenn Morris + + * emacs-lisp/bytecomp.el (byte-compile-warning-prefix): + If not compiling a file, try using load-file-name. + 2012-09-13 Stefan Monnier * emacs-lisp/edebug.el (edebug-outside-unread-command-events): === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2012-08-14 18:23:10 +0000 +++ lisp/emacs-lisp/bytecomp.el 2012-09-13 02:41:46 +0000 @@ -1016,6 +1016,10 @@ ((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)) ------------------------------------------------------------ revno: 110005 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-09-12 22:29:05 -0400 message: * lisp/emacs-lisp/edebug.el (edebug-outside-unread-command-events): Fix last change. (edebug-update-eval-list): Use `push'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-13 02:00:41 +0000 +++ lisp/ChangeLog 2012-09-13 02:29:05 +0000 @@ -1,5 +1,9 @@ 2012-09-13 Stefan Monnier + * 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. === modified file 'lisp/emacs-lisp/edebug.el' --- lisp/emacs-lisp/edebug.el 2012-09-13 02:00:41 +0000 +++ lisp/emacs-lisp/edebug.el 2012-09-13 02:29:05 +0000 @@ -2480,6 +2480,7 @@ ;; 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 (value offset-index arg-mode) (unless (marker-position edebug-def-mark) @@ -2763,7 +2764,6 @@ ;; 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) @@ -3906,10 +3906,9 @@ )) (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) @@ -3947,7 +3946,7 @@ (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) @@ -3956,7 +3955,7 @@ (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) ------------------------------------------------------------ revno: 110004 fixes bug: http://debbugs.gnu.org/12408 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-09-12 19:21:28 -0700 message: Simplify SIGIO usage. 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). * 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'. * src/admin/CPP_DEFINES (BROKEN_SIGAIO, BROKEN_SIGIO, BROKEN_SIGPOLL) (BROKEN_SIGPTY, NO_TERMIO): Remove. * src/conf_post.h [USG5_4]: Do not include here. Modules that need it can include it. [USG5_4 && emacs]: Likewise, do not include the streams stuff here. * src/dispextern.h (ignore_sigio): New decl. * src/emacs.c (shut_down_emacs): Invoke unrequest_sigio unconditionally, since it's now a no-op if !USABLE_SIGIO. * src/emacs.c (shut_down_emacs): * src/keyboard.c (kbd_buffer_store_event_hold): Use ignore_sigio rather than invoking 'signal' directly. * src/keyboard.c (USABLE_FIONREAD && USG5_4): Include , for FIONREAD. (FIONREAD, SIGIO): Do not #undef. (tty_read_avail_input): Use #error rather than a syntax error. * src/process.c [USG5_4]: Include and , for I_PIPE, used by SETUP_SLAVE_PTY. (DATAGRAM_SOCKETS): Simplify defn, based on USABLE_FIONREAD. * src/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. * src/syssignal.h (croak): Remove decl. (SIGIO, SIGPOO, SIGAIO, SIGPTY): Do not #undef; that's too fragile. * src/systty.h [!NO_TERMIO]: Do not include ; no longer needed now that we're termios-only. (FIONREAD, ASYNC) [BROKEN_FIONREAD]: Do not #undef. * src/term.c (dissociate_if_controlling_tty): Use #error rather than a run-time error. diff: === modified file 'ChangeLog' --- ChangeLog 2012-09-12 20:21:39 +0000 +++ ChangeLog 2012-09-13 02:21:28 +0000 @@ -1,3 +1,13 @@ +2012-09-13 Paul Eggert + + 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 * configure.ac: No --with-x-toolkit given: Try gtk3 toolkit first === modified file 'admin/CPP-DEFINES' --- admin/CPP-DEFINES 2012-09-11 02:28:27 +0000 +++ admin/CPP-DEFINES 2012-09-13 02:21:28 +0000 @@ -91,10 +91,6 @@ 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 @@ -423,7 +419,6 @@ MAXPATHLEN NLIST_STRUCT NO_EDITRES -NO_TERMIO NSIG NSIG_MINIMUM NULL_DEVICE === modified file 'admin/ChangeLog' --- admin/ChangeLog 2012-09-11 02:28:27 +0000 +++ admin/ChangeLog 2012-09-13 02:21:28 +0000 @@ -1,3 +1,9 @@ +2012-09-13 Paul Eggert + + Simplify SIGIO usage (Bug#12408). + * CPP_DEFINES (BROKEN_SIGAIO, BROKEN_SIGIO, BROKEN_SIGPOLL) + (BROKEN_SIGPTY, NO_TERMIO): Remove. + 2012-09-11 Paul Eggert Simplify, document, and port floating-point (Bug#12381). === modified file 'configure.ac' --- configure.ac 2012-09-12 20:21:39 +0000 +++ configure.ac 2012-09-13 02:21:28 +0000 @@ -3271,10 +3271,6 @@ 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 @@ -3284,26 +3280,16 @@ ;; 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 . 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 @@ -3379,7 +3365,7 @@ 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 @@ -3900,6 +3886,46 @@ ;; 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 + #include + #ifdef USG5_4 + # include + #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 + #include + ]], + [[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 === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-13 01:22:08 +0000 +++ src/ChangeLog 2012-09-13 02:21:28 +0000 @@ -1,5 +1,41 @@ 2012-09-13 Paul Eggert + 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 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 , + for FIONREAD. + (FIONREAD, SIGIO): Do not #undef. + (tty_read_avail_input): Use #error rather than a syntax error. + * process.c [USG5_4]: Include and , + 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 ; 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. === modified file 'src/blockinput.h' --- src/blockinput.h 2012-09-04 17:34:54 +0000 +++ src/blockinput.h 2012-09-13 02:21:28 +0000 @@ -67,15 +67,10 @@ 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 \ === modified file 'src/conf_post.h' --- src/conf_post.h 2012-09-07 01:27:44 +0000 +++ src/conf_post.h 2012-09-13 02:21:28 +0000 @@ -133,22 +133,6 @@ #endif #endif /* MSDOS */ -#ifdef USG5_4 -/* Get FIONREAD from . Get to get struct tchars. - But get first to make sure ttold.h doesn't interfere. */ -#include - -#ifdef emacs -#include -#include -#include -#include -#include -#include -#include -#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 === modified file 'src/dispextern.h' --- src/dispextern.h 2012-09-02 17:10:35 +0000 +++ src/dispextern.h 2012-09-13 02:21:28 +0000 @@ -3193,6 +3193,7 @@ int tabs_safe_p (int); void init_baud_rate (int); void init_sigio (int); +void ignore_sigio (void); /* Defined in xfaces.c */ === modified file 'src/dispnew.c' --- src/dispnew.c 2012-09-09 17:59:50 +0000 +++ src/dispnew.c 2012-09-13 02:21:28 +0000 @@ -5971,7 +5971,7 @@ wrong_type_argument (Qnumberp, timeout); -#ifdef SIGIO +#ifdef USABLE_SIGIO gobble_input (0); #endif === modified file 'src/emacs.c' --- src/emacs.c 2012-09-09 16:06:33 +0000 +++ src/emacs.c 2012-09-13 02:21:28 +0000 @@ -2035,12 +2035,10 @@ unlock_all_files (); #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 (); === modified file 'src/keyboard.c' --- src/keyboard.c 2012-09-12 19:16:36 +0000 +++ src/keyboard.c 2012-09-13 02:21:28 +0000 @@ -56,6 +56,10 @@ #include #endif /* not MSDOS */ +#if defined USABLE_FIONREAD && defined USG5_4 +# include +#endif + #include "syssignal.h" #include @@ -385,19 +389,6 @@ /* 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) @@ -448,7 +439,7 @@ static Lisp_Object apply_modifiers (int, Lisp_Object); static void clear_event (struct input_event *); static Lisp_Object restore_kboard_configuration (Lisp_Object); -#ifdef SIGIO +#ifdef USABLE_SIGIO static void deliver_input_available_signal (int signo); #endif static void handle_interrupt (void); @@ -3646,10 +3637,8 @@ /* 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 */ @@ -3818,14 +3807,14 @@ /* Start reading input again, we have processed enough so we can accept new events again. */ unhold_keyboard_input (); -#ifdef SIGIO +#ifdef USABLE_SIGIO if (!noninteractive) { struct sigaction action; emacs_sigaction_init (&action, deliver_input_available_signal); sigaction (SIGIO, &action, 0); } -#endif /* SIGIO */ +#endif start_polling (); } #endif /* subprocesses */ @@ -3867,10 +3856,9 @@ /* 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) @@ -6769,7 +6757,7 @@ void gobble_input (int expected) { -#ifdef SIGIO +#ifdef USABLE_SIGIO if (interrupt_input) { sigset_t blocked, procmask; @@ -6824,7 +6812,7 @@ return; /* Make sure no interrupt happens while storing the event. */ -#ifdef SIGIO +#ifdef USABLE_SIGIO if (interrupt_input) { sigset_t blocked, procmask; @@ -7050,7 +7038,7 @@ #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) { @@ -7063,14 +7051,12 @@ 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 @@ -7119,7 +7105,7 @@ #endif ); -#ifndef FIONREAD +#ifndef USABLE_FIONREAD #if defined (USG) || defined (CYGWIN) fcntl (fileno (tty->input), F_SETFL, 0); #endif /* USG or CYGWIN */ @@ -7190,7 +7176,7 @@ return nread; } -#if defined SYNC_INPUT || defined SIGIO +#if defined SYNC_INPUT || defined USABLE_SIGIO static void handle_async_input (void) { @@ -7217,7 +7203,7 @@ --handling_signal; #endif } -#endif /* SYNC_INPUT || SIGIO */ +#endif /* SYNC_INPUT || USABLE_SIGIO */ #ifdef SYNC_INPUT void @@ -7229,8 +7215,7 @@ } #endif -#ifdef SIGIO /* for entire page */ -/* Note SIGIO has been undef'd if FIONREAD is missing. */ +#ifdef USABLE_SIGIO static void handle_input_available_signal (int sig) @@ -7253,7 +7238,7 @@ { handle_on_main_thread (sig, handle_input_available_signal); } -#endif /* SIGIO */ +#endif /* USABLE_SIGIO */ /* Send ourselves a SIGIO. @@ -7264,7 +7249,7 @@ void reinvoke_input_signal (void) { -#ifdef SIGIO +#ifdef USABLE_SIGIO handle_async_input (); #endif } @@ -7338,7 +7323,7 @@ } p->npending++; -#ifdef SIGIO +#ifdef USABLE_SIGIO if (interrupt_input) kill (getpid (), SIGIO); else @@ -11007,8 +10992,7 @@ (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) { @@ -11019,9 +11003,9 @@ 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) { @@ -11415,15 +11399,14 @@ 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) { struct sigaction action; emacs_sigaction_init (&action, deliver_input_available_signal); sigaction (SIGIO, &action, 0); } -#endif /* SIGIO */ +#endif /* Use interrupt input by default, if it works and noninterrupt input has deficiencies. */ === modified file 'src/process.c' --- src/process.c 2012-09-11 22:59:50 +0000 +++ src/process.c 2012-09-13 02:21:28 +0000 @@ -75,6 +75,11 @@ #include #endif +#ifdef USG5_4 +# include +# include +#endif + #ifdef HAVE_RES_INIT #include #include @@ -212,17 +217,13 @@ "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 @@ -251,7 +252,7 @@ #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); @@ -4836,7 +4837,7 @@ 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, @@ -6853,7 +6854,7 @@ # endif -# ifdef SIGIO +# ifdef USABLE_SIGIO /* Return nonzero if *MASK has a bit set that corresponds to one of the keyboard input descriptors. */ === modified file 'src/sound.c' --- src/sound.c 2012-09-07 01:27:44 +0000 +++ src/sound.c 2012-09-13 02:21:28 +0000 @@ -314,7 +314,7 @@ int saved_errno = errno; turn_on_atimers (1); -#ifdef SIGIO +#ifdef USABLE_SIGIO { sigset_t unblocked; sigemptyset (&unblocked); @@ -732,7 +732,7 @@ vox_configure (struct sound_device *sd) { int val; -#ifdef SIGIO +#ifdef USABLE_SIGIO sigset_t blocked; #endif @@ -742,7 +742,7 @@ interrupted by a signal. Block the ones we know to cause troubles. */ turn_on_atimers (0); -#ifdef SIGIO +#ifdef USABLE_SIGIO sigemptyset (&blocked); sigaddset (&blocked, SIGIO); pthread_sigmask (SIG_BLOCK, &blocked, 0); @@ -778,7 +778,7 @@ } turn_on_atimers (1); -#ifdef SIGIO +#ifdef USABLE_SIGIO pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #endif } @@ -794,7 +794,7 @@ /* 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 +#ifdef USABLE_SIGIO sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGIO); @@ -806,7 +806,7 @@ ioctl (sd->fd, SNDCTL_DSP_SYNC, NULL); turn_on_atimers (1); -#ifdef SIGIO +#ifdef USABLE_SIGIO pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #endif === modified file 'src/sysdep.c' --- src/sysdep.c 2012-09-07 01:27:44 +0000 +++ src/sysdep.c 2012-09-13 02:21:28 +0000 @@ -107,9 +107,6 @@ 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 @@ -513,7 +510,7 @@ 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 @@ -642,120 +639,74 @@ } } -#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); + interrupts_deferred = 0; #endif - interrupts_deferred = 0; } 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; sigemptyset (&unblocked); -#ifdef SIGWINCH +# ifdef SIGWINCH sigaddset (&unblocked, SIGWINCH); -#endif +# endif sigaddset (&unblocked, SIGIO); pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); interrupts_deferred = 0; +#endif } void unrequest_sigio (void) { +#ifdef USABLE_SIGIO sigset_t blocked; if (noninteractive) return; -#if 0 /* XXX What's wrong with blocking SIGIO under X? */ - if (x_display_list) - return; -#endif - sigemptyset (&blocked); -#ifdef SIGWINCH +# ifdef SIGWINCH sigaddset (&blocked, SIGWINCH); -#endif +# 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"); -} - -void -unrequest_sigio (void) -{ - if (noninteractive || read_socket_hook) - return; - - croak ("unrequest_sigio"); -} - -#endif /* MSDOS */ -#endif /* FASYNC */ -#endif /* F_SETFL */ -#endif /* SIGIO */ +#endif +} + +void +ignore_sigio (void) +{ +#ifdef USABLE_SIGIO + signal (SIGIO, SIG_IGN); +#endif +} /* Getting and setting emacs_tty structures. */ @@ -2051,19 +2002,6 @@ } #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. */ === modified file 'src/syssignal.h' --- src/syssignal.h 2012-09-07 08:46:44 +0000 +++ src/syssignal.h 2012-09-13 02:21:28 +0000 @@ -34,27 +34,6 @@ extern void emacs_sigaction_init (struct sigaction *, signal_handler_t); -#if ! (defined TIOCNOTTY || defined USG5 || defined CYGWIN) -_Noreturn void croak (char *); -#endif - -/* Interrupt input is not used if there is no FIONREAD. */ -#include -#if defined BROKEN_SIGIO || ! defined FIONREAD || defined BROKEN_FIONREAD -# 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 - #if NSIG < NSIG_MINIMUM # undef NSIG # define NSIG NSIG_MINIMUM === modified file 'src/systty.h' --- src/systty.h 2012-09-07 08:46:44 +0000 +++ src/systty.h 2012-09-13 02:21:28 +0000 @@ -17,10 +17,8 @@ along with GNU Emacs. If not, see . */ /* Include the proper files. */ + #ifndef DOS_NT -#ifndef NO_TERMIO -#include -#endif /* not NO_TERMIO */ #include #include #endif /* not DOS_NT */ @@ -39,15 +37,6 @@ #include -/* Special cases - inhibiting the use of certain features. */ - -/* Allow configure to inhibit use of FIONREAD. */ -#ifdef BROKEN_FIONREAD -#undef FIONREAD -#undef ASYNC -#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! */ === modified file 'src/term.c' --- src/term.c 2012-09-07 01:27:44 +0000 +++ src/term.c 2012-09-13 02:21:28 +0000 @@ -2944,8 +2944,7 @@ emacs_close (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #else - /* Unknown system. */ - croak (); +# error "Unknown system." #endif /* ! TIOCNOTTY */ #endif /* ! USG */ } === modified file 'src/xterm.c' --- src/xterm.c 2012-09-11 03:32:41 +0000 +++ src/xterm.c 2012-09-13 02:21:28 +0000 @@ -7878,7 +7878,7 @@ { sigset_t unblocked; sigemptyset (&unblocked); -#ifdef SIGIO +#ifdef USABLE_SIGIO sigaddset (&unblocked, SIGIO); #endif sigaddset (&unblocked, SIGALRM); @@ -10421,10 +10421,8 @@ fcntl (connection, F_SETOWN, getpid ()); #endif /* ! defined (F_SETOWN) */ -#ifdef SIGIO if (interrupt_input) init_sigio (connection); -#endif /* ! defined (SIGIO) */ #ifdef USE_LUCID { ------------------------------------------------------------ revno: 110003 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-09-12 22:00:41 -0400 message: * lisp/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. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-12 20:51:46 +0000 +++ lisp/ChangeLog 2012-09-13 02:00:41 +0000 @@ -1,3 +1,27 @@ +2012-09-13 Stefan Monnier + + * 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 * info.el (Info-search): Don't check for isearch-mode and === modified file 'lisp/emacs-lisp/edebug.el' --- lisp/emacs-lisp/edebug.el 2012-09-12 19:16:36 +0000 +++ lisp/emacs-lisp/edebug.el 2012-09-13 02:00:41 +0000 @@ -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. @@ -237,7 +237,7 @@ (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 @@ -245,9 +245,8 @@ (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) @@ -337,9 +336,7 @@ (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 @@ -347,6 +344,7 @@ 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 @@ -621,19 +619,19 @@ ;; 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. +(defvar-local edebug-form-data nil + "A list of entries associating symbols with buffer regions. +This is an automatic buffer local variable. Each entry looks like: +\(SYMBOL BEGIN-MARKER 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.") + +;; FIXME: Use cl-defstruct. (defun edebug-make-form-data-entry (symbol begin end) (list symbol begin end)) @@ -648,7 +646,7 @@ (nth 2 entry)) (defsubst edebug-set-form-data-entry (entry name begin end) - (setcar entry name);; in case name is changed + (setcar entry name) ;; In case name is changed. (set-marker (nth 1 entry) begin) (set-marker (nth 2 entry) end)) @@ -1081,7 +1079,8 @@ ;; 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 @@ -1218,8 +1217,8 @@ (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) @@ -1232,13 +1231,11 @@ ;; 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) @@ -1514,18 +1511,18 @@ ;; 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)) + (funcall 'throw 'no-match args))) (defun edebug-match (cursor specs) @@ -1752,7 +1749,7 @@ 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) @@ -1841,7 +1838,7 @@ 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) @@ -1898,7 +1895,7 @@ (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 @@ -1983,6 +1980,8 @@ 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. @@ -2162,10 +2161,7 @@ ;; 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. @@ -2191,7 +2187,7 @@ ;;; 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. @@ -2205,19 +2201,18 @@ 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. @@ -2226,50 +2221,51 @@ ;; 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)) - (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 edebug-function edebug-args edebug-body)))) - - (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. @@ -2296,14 +2292,14 @@ (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)) @@ -2331,49 +2327,49 @@ -(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) + (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))) ;; 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) @@ -2387,19 +2383,18 @@ (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. @@ -2410,16 +2405,16 @@ (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 @@ -2430,7 +2425,7 @@ (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 @@ -2451,10 +2446,9 @@ (if (or (not (memq edebug-execution-mode '(go continue Continue-fast))) edebug-break (edebug-input-pending-p)) - (edebug-display)) ; <--------------- display + (edebug--display value offset-index arg-mode)) ; <---------- display - edebug-value - ))) + value))) ;; window-start now stored with each function. @@ -2487,7 +2481,7 @@ (defalias 'edebug-mark-marker 'mark-marker) -(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 @@ -2496,11 +2490,11 @@ ;; 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)) @@ -2509,12 +2503,12 @@ (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 @@ -2535,9 +2529,9 @@ (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. @@ -2561,7 +2555,7 @@ ;; 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) @@ -2569,7 +2563,7 @@ (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) '(?\( ?\# ?\` ))) @@ -2593,14 +2587,14 @@ (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 @@ -2618,7 +2612,7 @@ (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 @@ -2642,11 +2636,11 @@ (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) @@ -2775,7 +2769,7 @@ (defvar edebug-outside-last-nonmenu-event) (defvar edebug-outside-track-mouse) -(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. @@ -2866,7 +2860,7 @@ ) (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) @@ -3082,7 +3076,7 @@ ;; 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.") @@ -3517,11 +3511,10 @@ ;;; 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 @@ -3555,7 +3548,7 @@ (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) @@ -3609,18 +3602,18 @@ (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) + (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)))))) @@ -3628,17 +3621,17 @@ ;;; 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 @@ -3654,14 +3647,14 @@ (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." @@ -3676,7 +3669,7 @@ (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." @@ -3685,7 +3678,7 @@ '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)))))) @@ -3699,14 +3692,14 @@ "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") )) @@ -3898,20 +3891,17 @@ (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) )) @@ -3924,18 +3914,16 @@ ;; 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)) @@ -3997,8 +3985,8 @@ (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) @@ -4025,32 +4013,32 @@ ;; 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) )) @@ -4061,7 +4049,7 @@ (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) @@ -4083,7 +4071,7 @@ (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))) ------------------------------------------------------------ revno: 110002 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-09-12 18:22:08 -0700 message: 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. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-12 21:34:24 +0000 +++ src/ChangeLog 2012-09-13 01:22:08 +0000 @@ -1,3 +1,12 @@ +2012-09-13 Paul Eggert + + 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 More fixes for 'volatile' and setjmp/longjmp. === modified file 'src/emacsgtkfixed.c' --- src/emacsgtkfixed.c 2012-09-07 01:27:44 +0000 +++ src/emacsgtkfixed.c 2012-09-13 01:22:08 +0000 @@ -27,6 +27,11 @@ #include "frame.h" #include "xterm.h" +/* Silence a bogus diagnostic; see GNOME bug 683906. */ +#include +#undef G_STATIC_ASSERT +#define G_STATIC_ASSERT(x) verify (x) + #define EMACS_TYPE_FIXED emacs_fixed_get_type () #define EMACS_FIXED(obj) \ G_TYPE_CHECK_INSTANCE_CAST (obj, EMACS_TYPE_FIXED, EmacsFixed) === modified file 'src/image.c' --- src/image.c 2012-09-12 21:34:24 +0000 +++ src/image.c 2012-09-13 01:22:08 +0000 @@ -6140,6 +6140,9 @@ MY_JPEG_INVALID_IMAGE_SIZE, MY_JPEG_CANNOT_CREATE_X } failure_code; +#ifdef lint + FILE *fp; +#endif }; @@ -6392,6 +6395,8 @@ 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. */ mgr->cinfo.err = fn_jpeg_std_error (&mgr->pub); @@ -6430,6 +6435,9 @@ 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 (&mgr->cinfo, JPEG_LIB_VERSION, sizeof *&mgr->cinfo); ------------------------------------------------------------ revno: 110001 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-09-12 14:34:24 -0700 message: 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. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-12 19:16:36 +0000 +++ src/ChangeLog 2012-09-12 21:34:24 +0000 @@ -1,3 +1,19 @@ +2012-09-12 Paul Eggert + + 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 * keyboard.c (read_char, requeued_events_pending_p, Finput_pending_p) === modified file 'src/eval.c' --- src/eval.c 2012-09-12 00:14:50 +0000 +++ src/eval.c 2012-09-12 21:34:24 +0000 @@ -707,7 +707,7 @@ 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 @@ -1204,12 +1204,9 @@ 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); } === modified file 'src/image.c' --- src/image.c 2012-09-12 14:10:42 +0000 +++ src/image.c 2012-09-12 21:34:24 +0000 @@ -5591,20 +5591,31 @@ /* 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; @@ -5671,24 +5682,26 @@ png_ptr = fn_png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, my_png_error, my_png_warning); - if (!png_ptr) - { - if (fp) fclose (fp); - return 0; - } - - info_ptr = fn_png_create_info_struct (png_ptr); - if (!info_ptr) - { - fn_png_destroy_read_struct (&png_ptr, NULL, NULL); - if (fp) fclose (fp); - return 0; - } - - end_info = fn_png_create_info_struct (png_ptr); - if (!end_info) - { - fn_png_destroy_read_struct (&png_ptr, &info_ptr, NULL); + if (png_ptr) + { + info_ptr = fn_png_create_info_struct (png_ptr); + end_info = fn_png_create_info_struct (png_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 (&c->png_ptr, &c->info_ptr, &c->end_info); + png_ptr = 0; + } + if (! png_ptr) + { if (fp) fclose (fp); return 0; } @@ -5698,14 +5711,18 @@ 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); @@ -5821,8 +5838,8 @@ 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; @@ -5832,7 +5849,7 @@ if (fp) { fclose (fp); - fp = NULL; + c->fp = NULL; } /* Create an image and pixmap serving as mask if the PNG image @@ -5907,7 +5924,7 @@ #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); @@ -5936,6 +5953,13 @@ 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 @@ -6106,6 +6130,16 @@ { struct jpeg_error_mgr pub; 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; }; @@ -6113,6 +6147,7 @@ my_error_exit (j_common_ptr cinfo) { struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err; + mgr->failure_code = MY_JPEG_ERROR_EXIT; _longjmp (mgr->setjmp_buffer, 1); } @@ -6319,17 +6354,15 @@ 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; @@ -6361,24 +6394,33 @@ /* 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 (_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); @@ -6390,44 +6432,47 @@ /* 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; + _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; + _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; @@ -6437,15 +6482,15 @@ 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); } @@ -6457,21 +6502,21 @@ } /* 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))) @@ -6484,6 +6529,13 @@ 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 ------------------------------------------------------------ revno: 110000 committer: Juri Linkov branch nick: trunk timestamp: Wed 2012-09-12 23:51:46 +0300 message: Use Isearch lax whitespace mode in Info. http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00811.html * lisp/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. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-12 19:16:36 +0000 +++ lisp/ChangeLog 2012-09-12 20:51:46 +0000 @@ -1,3 +1,14 @@ +2012-09-12 Juri Linkov + + * 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 * emacs-lisp/debug.el (debugger-outer-unread-command-char, debug) === modified file 'lisp/info.el' --- lisp/info.el 2012-08-28 09:01:54 +0000 +++ lisp/info.el 2012-09-12 20:51:46 +0000 @@ -1882,9 +1882,7 @@ (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 (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 @@ (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 @@ (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 @@ '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) ------------------------------------------------------------ revno: 109999 committer: Jan D. branch nick: trunk timestamp: Wed 2012-09-12 22:21:39 +0200 message: * 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. diff: === modified file 'ChangeLog' --- ChangeLog 2012-09-11 07:45:38 +0000 +++ ChangeLog 2012-09-12 20:21:39 +0000 @@ -1,3 +1,11 @@ +2012-09-12 Jan Djärv + + * 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 * Makefile.in (install-arch-dep, install-arch-indep, install-doc): === modified file 'configure.ac' --- configure.ac 2012-09-11 02:28:27 +0000 +++ configure.ac 2012-09-12 20:21:39 +0000 @@ -138,7 +138,7 @@ 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 +146,13 @@ 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 @@ -1578,6 +1580,9 @@ 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 ;; @@ -1900,35 +1905,41 @@ 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"; then + if test "$USE_X_TOOLKIT" = "maybe" || test "$with_gtk" = "yes" || test "$with_gtk2" = "yes"; then + AC_MSG_ERROR($gtk3_pkg_errors$GTK_PKG_ERRORS) + fi fi fi -fi if test x"$pkg_check_gtk" = xyes; then ------------------------------------------------------------ revno: 109998 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-09-12 15:16:36 -0400 message: Remove unread-command-char. * src/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. * lisp/emacs-lisp/debug.el (debugger-outer-unread-command-char, debug) (debugger-env-macro): Remove support for unread-command-char. * lisp/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. * lisp/subr.el (set-temporary-overlay-map): Minimize slightly the impact of the temporary map re-appearing on emulation-mode-map-alists. * lisp/emacs-lisp/edebug.el (def-edebug-form-spec): Remove, it's been broken since 22.1. diff: === modified file 'doc/lispref/commands.texi' --- doc/lispref/commands.texi 2012-07-21 14:48:17 +0000 +++ doc/lispref/commands.texi 2012-09-12 19:16:36 +0000 @@ -2738,17 +2738,6 @@ 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 === modified file 'etc/NEWS' --- etc/NEWS 2012-09-12 00:14:50 +0000 +++ etc/NEWS 2012-09-12 19:16:36 +0000 @@ -638,7 +638,7 @@ *** `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 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-12 16:36:25 +0000 +++ lisp/ChangeLog 2012-09-12 19:16:36 +0000 @@ -1,3 +1,19 @@ +2012-09-12 Stefan Monnier + + * 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 Sync with Tramp 2.2.6. @@ -9,8 +25,8 @@ 2012-09-12 Martin Rudalics - * emacs-lisp/debug.el (debugger-previous-window-height): New - variable. + * 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) === modified file 'lisp/ehelp.el' --- lisp/ehelp.el 2012-01-19 07:21:25 +0000 +++ lisp/ehelp.el 2012-09-12 19:16:36 +0000 @@ -193,7 +193,9 @@ (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 @@ ;; 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)) === modified file 'lisp/emacs-lisp/debug.el' --- lisp/emacs-lisp/debug.el 2012-09-12 15:49:17 +0000 +++ lisp/emacs-lisp/debug.el 2012-09-12 19:16:36 +0000 @@ -110,10 +110,6 @@ (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) @@ -185,8 +181,6 @@ (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) @@ -221,8 +215,6 @@ (cursor-in-echo-area nil)) (unwind-protect (save-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. @@ -302,8 +294,6 @@ (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) @@ -605,16 +595,7 @@ (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 === modified file 'lisp/emacs-lisp/edebug.el' --- lisp/emacs-lisp/edebug.el 2012-09-12 13:12:48 +0000 +++ lisp/emacs-lisp/edebug.el 2012-09-12 19:16:36 +0000 @@ -235,11 +235,6 @@ ;;; 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) === modified file 'lisp/progmodes/ebrowse.el' --- lisp/progmodes/ebrowse.el 2012-07-11 23:13:41 +0000 +++ lisp/progmodes/ebrowse.el 2012-09-12 19:16:36 +0000 @@ -4210,7 +4210,7 @@ ;; 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) === modified file 'lisp/subr.el' --- lisp/subr.el 2012-09-11 16:45:31 +0000 +++ lisp/subr.el 2012-09-12 19:16:36 +0000 @@ -1250,11 +1250,6 @@ '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 @@ -3928,6 +3923,7 @@ (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)))))) === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-12 19:14:02 +0000 +++ src/ChangeLog 2012-09-12 19:16:36 +0000 @@ -1,3 +1,9 @@ +2012-09-12 Stefan Monnier + + * 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 * w32proc.c (sys_kill): If PID is our process ID and the signal is === modified file 'src/data.c' --- src/data.c 2012-09-11 15:42:50 +0000 +++ src/data.c 2012-09-12 19:16:36 +0000 @@ -1164,7 +1164,7 @@ 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. === modified file 'src/keyboard.c' --- src/keyboard.c 2012-09-12 00:14:50 +0000 +++ src/keyboard.c 2012-09-12 19:16:36 +0000 @@ -2366,15 +2366,6 @@ 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; @@ -2559,7 +2550,6 @@ && !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); @@ -2695,8 +2685,7 @@ && !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); @@ -10453,7 +10442,7 @@ int requeued_events_pending_p (void) { - return (!NILP (Vunread_command_events) || unread_command_char != -1); + return (!NILP (Vunread_command_events)); } @@ -10463,7 +10452,7 @@ 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); @@ -10651,7 +10640,6 @@ update_mode_lines++; Vunread_command_events = Qnil; - unread_command_char = -1; discard_tty_input (); @@ -10991,7 +10979,6 @@ 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. @@ -11378,12 +11365,11 @@ 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; @@ -11716,9 +11702,6 @@ 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' ------------------------------------------------------------ revno: 109997 fixes bug: http://debbugs.gnu.org/12426 committer: Eli Zaretskii branch nick: trunk timestamp: Wed 2012-09-12 22:14:02 +0300 message: Fix silent exit upon assertion violation on MS-Windows. src/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) diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-12 14:10:42 +0000 +++ src/ChangeLog 2012-09-12 19:14:02 +0000 @@ -1,3 +1,9 @@ +2012-09-12 Eli Zaretskii + + * 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 * image.c (jpeg_memory_src): Don't assume string len fits in unsigned. === modified file 'src/w32proc.c' --- src/w32proc.c 2012-09-07 08:20:07 +0000 +++ src/w32proc.c 2012-09-12 19:14:02 +0000 @@ -1429,6 +1429,9 @@ 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) { ------------------------------------------------------------ revno: 109996 committer: Michael Albinus branch nick: trunk timestamp: Wed 2012-09-12 18:39:10 +0200 message: Sync with Tramp 2.2.6. * tramp.texi (Bug Reports): Cleanup caches before a test run. * trampver.texi: Update release number. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2012-09-12 14:03:15 +0000 +++ doc/misc/ChangeLog 2012-09-12 16:39:10 +0000 @@ -1,3 +1,11 @@ +2012-09-12 Michael Albinus + + 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 * texinfo.tex: Merge from gnulib. === modified file 'doc/misc/tramp.texi' --- doc/misc/tramp.texi 2012-07-06 13:19:33 +0000 +++ doc/misc/tramp.texi 2012-09-12 16:39:10 +0000 @@ -2853,6 +2853,9 @@ 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*} === modified file 'doc/misc/trampver.texi' --- doc/misc/trampver.texi 2012-06-11 13:03:39 +0000 +++ doc/misc/trampver.texi 2012-09-12 16:39:10 +0000 @@ -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 ------------------------------------------------------------ revno: 109995 committer: Michael Albinus branch nick: trunk timestamp: Wed 2012-09-12 18:36:25 +0200 message: 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. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-12 15:49:17 +0000 +++ lisp/ChangeLog 2012-09-12 16:36:25 +0000 @@ -1,3 +1,12 @@ +2012-09-12 Michael Albinus + + 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 * emacs-lisp/debug.el (debugger-previous-window-height): New === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2012-08-20 14:06:06 +0000 +++ lisp/net/tramp.el 2012-09-12 16:36:25 +0000 @@ -3293,7 +3293,9 @@ ;; 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) === modified file 'lisp/net/trampver.el' --- lisp/net/trampver.el 2012-06-11 10:30:07 +0000 +++ lisp/net/trampver.el 2012-09-12 16:36:25 +0000 @@ -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))) ------------------------------------------------------------ revno: 109994 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-09-12 09:00:11 -0700 message: How to restore a mail from the mailman moderation message diff: === modified file 'admin/notes/bugtracker' --- admin/notes/bugtracker 2012-07-25 05:48:19 +0000 +++ admin/notes/bugtracker 2012-09-12 16:00:11 +0000 @@ -618,6 +618,16 @@ 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, ------------------------------------------------------------ revno: 109993 committer: martin rudalics branch nick: trunk timestamp: Wed 2012-09-12 17:49:17 +0200 message: Try to keep height of debugger window consistent. (Bug#8789) * 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) diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-12 13:12:48 +0000 +++ lisp/ChangeLog 2012-09-12 15:49:17 +0000 @@ -1,3 +1,10 @@ +2012-09-12 Martin Rudalics + + * 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 * emacs-lisp/edebug.el (edebug-enter): Don't mess with === modified file 'lisp/emacs-lisp/debug.el' --- lisp/emacs-lisp/debug.el 2012-09-12 00:14:50 +0000 +++ lisp/emacs-lisp/debug.el 2012-09-12 15:49:17 +0000 @@ -96,6 +96,9 @@ (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'.") @@ -234,7 +237,17 @@ . (,(when debugger-previous-window `(previous-window . ,debugger-previous-window))))) (setq debugger-window (selected-window)) - (setq debugger-previous-window debugger-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 @@ -262,6 +275,9 @@ (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 ------------------------------------------------------------ revno: 109992 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-09-12 07:10:42 -0700 message: * image.c (jpeg_memory_src): Don't assume string len fits in unsigned. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-12 00:14:50 +0000 +++ src/ChangeLog 2012-09-12 14:10:42 +0000 @@ -1,3 +1,7 @@ +2012-09-12 Paul Eggert + + * image.c (jpeg_memory_src): Don't assume string len fits in unsigned. + 2012-09-12 Stefan Monnier * eval.c: Add `inhibit-debugger'. === modified file 'src/image.c' --- src/image.c 2012-09-11 22:59:50 +0000 +++ src/image.c 2012-09-12 14:10:42 +0000 @@ -6181,7 +6181,7 @@ 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; ------------------------------------------------------------ revno: 109991 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-09-12 07:03:15 -0700 message: * texinfo.tex: Merge from gnulib. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2012-08-28 16:01:59 +0000 +++ doc/misc/ChangeLog 2012-09-12 14:03:15 +0000 @@ -1,3 +1,7 @@ +2012-09-12 Paul Eggert + + * texinfo.tex: Merge from gnulib. + 2012-08-06 Aurélien Aptel * url.texi (Parsed URLs): Adjust to the code's use of defstruct === modified file 'doc/misc/texinfo.tex' --- doc/misc/texinfo.tex 2012-08-14 03:15:52 +0000 +++ doc/misc/texinfo.tex 2012-09-12 14:03:15 +0000 @@ -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-05.06} % % 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 @@ -3269,6 +3269,20 @@ \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 @@ \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 @@ -5579,14 +5593,6 @@ % 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 @@ \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 @@ % % 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 @@ \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 ------------------------------------------------------------ revno: 109990 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12345 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-09-12 09:12:48 -0400 message: * lisp/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. (edebug-outside-unread-command-char): Remove all uses of unread-command-char. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-12 00:14:50 +0000 +++ lisp/ChangeLog 2012-09-12 13:12:48 +0000 @@ -1,5 +1,11 @@ 2012-09-12 Stefan Monnier + * 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. === modified file 'lisp/emacs-lisp/edebug.el' --- lisp/emacs-lisp/edebug.el 2012-08-15 16:29:11 +0000 +++ lisp/emacs-lisp/edebug.el 2012-09-12 13:12:48 +0000 @@ -2248,47 +2248,14 @@ (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))) + (cl-lexical-debug t)) (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)) + (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 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))) + (edebug-enter edebug-function edebug-args edebug-body)))) (let* ((edebug-data (get edebug-function 'edebug)) (edebug-def-mark (car edebug-data)) ; mark at def start @@ -2804,7 +2771,6 @@ ;; 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) @@ -2814,15 +2780,6 @@ (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 () ;; Start up a recursive edit inside of edebug. ;; The current buffer is the edebug-buffer, which is put into edebug-mode. @@ -2844,14 +2801,24 @@ (edebug-outside-map (current-local-map)) - (edebug-outside-standard-output standard-output) + (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)) + + (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 +2834,6 @@ ;; 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 +2843,17 @@ (last-nonmenu-event nil) (track-mouse nil) - ;; Bind again to outside values. + ;; 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,6 +2861,12 @@ (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?? ) @@ -2933,7 +2913,6 @@ 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,9 +2921,13 @@ 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 @@ -3562,7 +3545,6 @@ (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) @@ -3602,7 +3584,6 @@ 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 @@ -4240,7 +4221,7 @@ (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 (read-event))) ;; Yuck! This doesn't seem to work at all for me. (undo))) @@ -4357,13 +4338,6 @@ ;; 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. ------------------------------------------------------------ revno: 109989 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2012-09-11 20:14:50 -0400 message: * src/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. * src/xdisp.c (set_message): Don't bind Qinhibit_debug_on_message. (syms_of_xdisp): Remove inhibit-debug-on-message. * lisp/emacs-lisp/debug.el (debug): Don't bind debug-on-error since inhibit-debugger is bound instead. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-09-11 02:28:27 +0000 +++ etc/NEWS 2012-09-12 00:14:50 +0000 @@ -675,7 +675,15 @@ ** New error type and new function `user-error'. Doesn't trigger the debugger. -** New option `debugger-bury-or-kill'. +** 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'. @@ -1977,10 +1985,6 @@ *** Set `debug-on-event' to enter the debugger on events like SIGUSR1. This can be useful when `inhibit-quit' is set. -*** 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. - ** The new function `server-eval-at' allows evaluation of Lisp forms on named Emacs server instances. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-11 16:45:31 +0000 +++ lisp/ChangeLog 2012-09-12 00:14:50 +0000 @@ -1,3 +1,8 @@ +2012-09-12 Stefan Monnier + + * emacs-lisp/debug.el (debug): Don't bind debug-on-error since + inhibit-debugger is bound instead. + 2012-09-11 Bastien Guerry * subr.el (set-temporary-overlay-map): Add a docstring. @@ -24,8 +29,8 @@ 2012-09-10 Dan Nicolaescu - * vc/diff-mode.el (diff-mode-menu): Bind - diff-remove-trailing-whitespace. + * vc/diff-mode.el (diff-mode-menu): + Bind diff-remove-trailing-whitespace. 2012-09-10 Stefan Monnier === modified file 'lisp/emacs-lisp/debug.el' --- lisp/emacs-lisp/debug.el 2012-09-08 13:28:11 +0000 +++ lisp/emacs-lisp/debug.el 2012-09-12 00:14:50 +0000 @@ -162,8 +162,6 @@ (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*") === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-11 23:50:28 +0000 +++ src/ChangeLog 2012-09-12 00:14:50 +0000 @@ -1,3 +1,13 @@ +2012-09-12 Stefan Monnier + + * 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 Avoid _setjmp/_longjmp problems with local nonvolatile variables. === modified file 'src/composite.h' --- src/composite.h 2012-08-27 17:23:48 +0000 +++ src/composite.h 2012-09-12 00:14:50 +0000 @@ -113,7 +113,7 @@ && (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) \ === modified file 'src/eval.c' --- src/eval.c 2012-09-04 21:21:00 +0000 +++ src/eval.c 2012-09-12 00:14:50 +0000 @@ -69,7 +69,7 @@ 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; @@ -229,7 +229,7 @@ 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. */ @@ -1725,6 +1725,7 @@ /* 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 @@ -3467,7 +3468,7 @@ 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"); @@ -3482,6 +3483,12 @@ 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 @@ -3491,7 +3498,7 @@ 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, === modified file 'src/keyboard.c' --- src/keyboard.c 2012-09-11 22:59:50 +0000 +++ src/keyboard.c 2012-09-12 00:14:50 +0000 @@ -4133,7 +4133,7 @@ *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; @@ -4161,7 +4161,7 @@ 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); === modified file 'src/xdisp.c' --- src/xdisp.c 2012-09-11 04:22:03 +0000 +++ src/xdisp.c 2012-09-12 00:14:50 +0000 @@ -364,7 +364,6 @@ Lisp_Object Qcenter; static Lisp_Object Qmargin, Qpointer; static Lisp_Object Qline_height; -static Lisp_Object Qinhibit_debug_on_message; /* These setters are used only in this file, so they can be private. */ static inline void @@ -10590,8 +10589,6 @@ set_message (const char *s, Lisp_Object string, ptrdiff_t nbytes, int multibyte_p) { - ptrdiff_t count = SPECPDL_INDEX (); - message_enable_multibyte = ((s && multibyte_p) || (STRINGP (string) && STRING_MULTIBYTE (string))); @@ -10601,14 +10598,9 @@ message_buf_print = 0; help_echo_showing_p = 0; - if (NILP (Vinhibit_debug_on_message) && STRINGP (Vdebug_on_message) + if (STRINGP (Vdebug_on_message) && fast_string_match (Vdebug_on_message, string) >= 0) - { - specbind (Qinhibit_debug_on_message, Qt); - call_debugger (list2 (Qerror, string)); - } - - unbind_to (count, Qnil); + call_debugger (list2 (Qerror, string)); } @@ -12800,7 +12792,7 @@ 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); } @@ -29316,11 +29308,6 @@ 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; - - DEFVAR_LISP ("inhibit-debug-on-message", Vinhibit_debug_on_message, - doc: /* If non-nil, inhibit `debug-on-message' from entering the debugger. */); - Vinhibit_debug_on_message = Qnil; - DEFSYM(Qinhibit_debug_on_message, "inhibit-debug-on-message"); }