Now on revision 110967. ------------------------------------------------------------ revno: 110967 [merge] committer: Glenn Morris branch nick: trunk timestamp: Tue 2012-11-20 20:47:55 -0800 message: Merge from emacs-24; up to r110931 diff: === modified file 'ChangeLog' --- ChangeLog 2012-11-20 08:29:04 +0000 +++ ChangeLog 2012-11-21 04:47:55 +0000 @@ -1,3 +1,7 @@ +2012-11-21 Glenn Morris + + * configure.ac (--enable-profiling): Doc fix. + 2012-11-20 Paul Eggert Improve static checking of integer overflow and stack smashing. === modified file 'configure.ac' --- configure.ac 2012-11-20 08:29:04 +0000 +++ configure.ac 2012-11-21 04:47:55 +0000 @@ -329,10 +329,15 @@ fi) +dnl The name of this option is unfortunate. It predates, and has no +dnl relation to, the "sampling-based elisp profiler" added in 24.3. +dnl Actually, it stops it working. +dnl http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00393.html AC_ARG_ENABLE(profiling, [AS_HELP_STRING([--enable-profiling], - [build emacs with profiling support. - This might not work on all platforms])], + [build emacs with low-level, gprof profiling support. + Mainly useful for debugging Emacs itself. May not work on + all platforms. Stops profiler.el working.])], [ac_enable_profiling="${enableval}"],[]) if test x$ac_enable_profiling != x ; then PROFILING_CFLAGS="-DPROFILING=1 -pg" === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2012-11-18 01:52:36 +0000 +++ doc/emacs/ChangeLog 2012-11-21 04:47:55 +0000 @@ -1,3 +1,9 @@ +2012-11-21 Dani Moncayo + + * display.texi (Auto Scrolling): Fix some inaccuracies, plus + clarifications (Bug#12865). + (Horizontal Scrolling): Clarifications. + 2012-11-18 Dani Moncayo * mark.texi (Disabled Transient Mark): Doc fixes (Bug#12746). === modified file 'doc/emacs/display.texi' --- doc/emacs/display.texi 2012-11-07 20:43:38 +0000 +++ doc/emacs/display.texi 2012-11-18 06:27:43 +0000 @@ -213,59 +213,62 @@ @node Auto Scrolling @section Automatic Scrolling +@cindex automatic scrolling Emacs performs @dfn{automatic scrolling} when point moves out of the -visible portion of the text. +visible portion of the text. Normally, automatic scrolling centers +point vertically in the window, but there are several ways to alter +this behavior. @vindex scroll-conservatively - Normally, this centers point vertically within the window. However, -if you set @code{scroll-conservatively} to a small number @var{n}, -then if you move point just a little off the screen (less than @var{n} -lines), Emacs scrolls the text just far enough to bring point back on -screen. If doing so fails to make point visible, Emacs centers point -in the window. By default, @code{scroll-conservatively} is@tie{}0. -If you set @code{scroll-conservatively} to a large number (larger than -100), Emacs will never center point as result of scrolling, even if -point moves far away from the text previously displayed in the window. -With such a large value, Emacs will always scroll text just enough for -bringing point into view, so point will end up at the top or bottom of -the window, depending on the scroll direction. + If you set @code{scroll-conservatively} to a small number @var{n}, +then moving point just a little off the screen (no more than @var{n} +lines) causes Emacs to scroll just enough to bring point back on +screen; if doing so fails to make point visible, Emacs scrolls just +far enough to center point in the window. If you set +@code{scroll-conservatively} to a large number (larger than 100), +automatic scrolling never centers point, no matter how far point +moves; Emacs always scrolls text just enough to bring point into view, +either at the top or bottom of the window depending on the scroll +direction. By default, @code{scroll-conservatively} is@tie{}0, which +means to always center point in the window. @vindex scroll-step - An alternative way of controlling how Emacs scrolls text is by -customizing the variable @code{scroll-step}. Its value determines how -many lines to scroll the window when point moves off the screen. If -moving by that number of lines fails to bring point back into view, -point is centered instead. The default value is zero, which causes -point to always be centered after scrolling. - - Since both @code{scroll-conservatively} and @code{scroll-step} -control automatic scrolling in contradicting ways, you should set only -one of them. If you customize both, the value of -@code{scroll-conservatively} takes precedence. + Another way to control automatic scrolling is to customize the +variable @code{scroll-step}. Its value determines the number of lines +by which to automatically scroll, when point moves off the screen. If +scrolling by that number of lines fails to bring point back into view, +point is centered instead. The default value is zero, which (by +default) causes point to always be centered after scrolling. @cindex aggressive scrolling @vindex scroll-up-aggressively @vindex scroll-down-aggressively - When the window does scroll by a distance longer than -@code{scroll-step}, you can control how aggressively it scrolls by -setting the variables @code{scroll-up-aggressively} and -@code{scroll-down-aggressively}. The value of -@code{scroll-up-aggressively} should be either @code{nil}, or a -fraction @var{f} between 0 and 1. A fraction specifies where on the -screen to put point when scrolling upward, i.e.@: forward. When point -goes off the window end, the new start position is chosen to put point -@var{f} parts of the window height from the bottom margin. Thus, -larger @var{f} means more aggressive scrolling: more new text is -brought into view. The default value, @code{nil}, is equivalent to -0.5. - - Likewise, @code{scroll-down-aggressively} is used for scrolling -down, i.e.@: backward. The value specifies how far point should be -placed from the top margin of the window; thus, as with -@code{scroll-up-aggressively}, a larger value is more aggressive. - - These two variables are ignored if either @code{scroll-step} or -@code{scroll-conservatively} are set to a non-zero value. + A third way to control automatic scrolling is to customize the +variables @code{scroll-up-aggressively} and +@code{scroll-down-aggressively}, which directly specify the vertical +position of point after scrolling. The value of +@code{scroll-up-aggressively} should be either @code{nil} (the +default), or a floating point number @var{f} between 0 and 1. The +latter means that when point goes below the bottom window edge (i.e.@: +scrolling forward), Emacs scrolls the window so that point is @var{f} +parts of the window height from the bottom window edge. Thus, larger +@var{f} means more aggressive scrolling: more new text is brought into +view. The default value, @code{nil}, is equivalent to 0.5. + + Likewise, @code{scroll-down-aggressively} is used when point goes +above the bottom window edge (i.e.@: scrolling backward). The value +specifies how far point should be from the top margin of the window +after scrolling. Thus, as with @code{scroll-up-aggressively}, a +larger value is more aggressive. + + Note that the variables @code{scroll-conservatively}, +@code{scroll-step}, and @code{scroll-up-aggressively} / +@code{scroll-down-aggressively} control automatic scrolling in +contradictory ways. Therefore, you should pick no more than one of +these methods to customize automatic scrolling. In case you customize +multiple variables, the order of priority is: +@code{scroll-conservatively}, then @code{scroll-step}, and finally +@code{scroll-up-aggressively} / @code{scroll-down-aggressively}. @vindex scroll-margin The variable @code{scroll-margin} restricts how close point can come @@ -295,10 +298,10 @@ @vindex hscroll-margin The variable @code{hscroll-margin} controls how close point can get -to the window's edges before automatic scrolling occurs. It is -measured in columns. For example, if the value is 5, then moving -point within 5 columns of an edge causes horizontal scrolling away -from that edge. +to the window's left and right edges before automatic scrolling +occurs. It is measured in columns. For example, if the value is 5, +then moving point within 5 columns of an edge causes horizontal +scrolling away from that edge. @vindex hscroll-step The variable @code{hscroll-step} determines how many columns to === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-11-18 01:52:36 +0000 +++ doc/lispref/ChangeLog 2012-11-21 04:47:55 +0000 @@ -1,3 +1,20 @@ +2012-11-21 Glenn Morris + + * debugging.texi (Profiling): New section. + (Debugging): Mention profiling in the introduction. + * tips.texi (Compilation Tips): Move profiling to separate section. + * elisp.texi: Add Profiling to detailed menu. + +2012-11-21 Martin Rudalics + + * windows.texi (Display Action Functions): Fix recently added + example. Suggested by Michael Heerdegen. + +2012-11-21 Paul Eggert + + Minor cleanup for times as lists of four integers. + * os.texi (Time Parsing): Time values can now be four integers. + 2012-11-18 Glenn Morris * loading.texi (How Programs Do Loading): Add eager macro expansion. === modified file 'doc/lispref/debugging.texi' --- doc/lispref/debugging.texi 2012-11-11 01:16:25 +0000 +++ doc/lispref/debugging.texi 2012-11-21 01:52:03 +0000 @@ -32,6 +32,9 @@ @item You can use the ERT package to write regression tests for the program. @xref{Top,the ERT manual,, ERT, ERT: Emacs Lisp Regression Testing}. + +@item +You can profile the program to get hints about how to make it more efficient. @end itemize Other useful tools for debugging input and output problems are the @@ -43,6 +46,7 @@ * Edebug:: A source-level Emacs Lisp debugger. * Syntax Errors:: How to find syntax errors. * Test Coverage:: Ensuring you have tested all branches in your code. +* Profiling:: Measuring the resources that your code uses. @end menu @node Debugger @@ -809,3 +813,63 @@ Edebug also has a coverage testing feature (@pxref{Coverage Testing}). These features partly duplicate each other, and it would be cleaner to combine them. + + +@node Profiling +@section Profiling +@cindex profiling +@cindex measuring resource usage +@cindex memory usage + +If your program is working correctly, but you want to make it run more +quickly or efficiently, the first thing to do is @dfn{profile} your +code so that you know how it is using resources. If you find that one +particular function is responsible for a significant portion of the +runtime, you can start looking for ways to optimize that piece. + +Emacs has built-in support for this. To begin profiling, type +@kbd{M-x profiler-start}. You can choose to profile by processor +usage, memory usage, or both. After doing some work, type +@kbd{M-x profiler-report} to display a summary buffer for each +resource that you chose to profile. The names of the report buffers +include the times at which the reports were generated, so you can +generate another report later on without erasing previous results. +When you have finished profiling, type @kbd{M-x profiler-stop} (there +is a small overhead associated with profiling). + +The profiler report buffer shows, on each line, a function that was +called, followed by how much resource (processor or memory) it used in +absolute and percentage times since profiling started. If a given +line has a @samp{+} symbol at the left-hand side, you can expand that +line by typing @key{RET}, in order to see the function(s) called by +the higher-level function. Pressing @key{RET} again will collapse +back to the original state. + +Press @kbd{j} or @kbd{mouse-2} to jump to the definition of a function. +Press @kbd{d} to view a function's documentation. +You can save a profile to a file using @kbd{C-x C-w}. +You can compare two profiles using @kbd{=}. + +@c FIXME reversed calltree? + +@cindex @file{elp.el} +@cindex timing programs +The @file{elp} library offers an alternative approach. See the file +@file{elp.el} for instructions. + +@cindex @file{benchmark.el} +@cindex benchmarking +You can check the speed of individual Emacs Lisp forms using the +@file{benchmark} library. See the functions @code{benchmark-run} and +@code{benchmark-run-compiled} in @file{benchmark.el}. + +@c Not worth putting in the printed manual. +@ifnottex +@cindex --enable-profiling option of configure +For low-level profiling of Emacs itself, you can build it using the +@option{--enable-profiling} option of @command{configure}. When Emacs +exits, it generates a file @file{gmon.out} that you can examine using +the @command{gprof} utility. This feature is mainly useful for +debugging Emacs. It actually stops the Lisp-level @kbd{M-x +profiler-@dots{}} commands described above from working. +@end ifnottex === modified file 'doc/lispref/elisp.texi' --- doc/lispref/elisp.texi 2012-11-07 09:41:52 +0000 +++ doc/lispref/elisp.texi 2012-11-20 08:02:54 +0000 @@ -617,6 +617,7 @@ * Edebug:: A source-level Emacs Lisp debugger. * Syntax Errors:: How to find syntax errors. * Test Coverage:: Ensuring you have tested all branches in your code. +* Profiling:: Measuring the resources that your code uses. The Lisp Debugger === modified file 'doc/lispref/os.texi' --- doc/lispref/os.texi 2012-11-08 07:50:43 +0000 +++ doc/lispref/os.texi 2012-11-21 04:47:55 +0000 @@ -1373,8 +1373,8 @@ @node Time Parsing @section Parsing and Formatting Times - These functions convert time values (lists of two or three integers) -to text in a string, and vice versa. + These functions convert time values to text in a string, and vice versa. +Time values are lists of two to four integers (@pxref{Time of Day}). @defun date-to-time string This function parses the time-string @var{string} and returns the === modified file 'doc/lispref/tips.texi' --- doc/lispref/tips.texi 2012-10-22 02:18:58 +0000 +++ doc/lispref/tips.texi 2012-11-20 08:02:54 +0000 @@ -460,18 +460,8 @@ @itemize @bullet @item -@cindex profiling -@cindex timing programs -@cindex @file{elp.el} -Profile your program with the @file{elp} library. See the file -@file{elp.el} for instructions. - -@item -@cindex @file{benchmark.el} -@cindex benchmarking -Check the speed of individual Emacs Lisp forms using the -@file{benchmark} library. See the functions @code{benchmark-run} and -@code{benchmark-run-compiled} in @file{benchmark.el}. +Profile your program, to find out where the time is being spent. +@xref{Profiling}. @item Use iteration rather than recursion whenever possible. === modified file 'doc/lispref/windows.texi' --- doc/lispref/windows.texi 2012-11-18 01:52:36 +0000 +++ doc/lispref/windows.texi 2012-11-21 04:47:55 +0000 @@ -2038,7 +2038,8 @@ follows: If `*foo*' already appears on a visible or iconified frame, it will reuse its window. Otherwise, it will try to pop up a new window or, if that is impossible, a new frame. If all these steps fail, it -will try to use some existing window. +will proceed using whatever @code{display-buffer-base-action} and +@code{display-buffer-fallback-action} prescribe. Furthermore, @code{display-buffer} will try to adjust a reused window (provided `*foo*' was put by @code{display-buffer} there before) or a === modified file 'etc/NEWS' --- etc/NEWS 2012-11-20 20:06:17 +0000 +++ etc/NEWS 2012-11-21 04:47:55 +0000 @@ -847,7 +847,7 @@ ** New sampling-based Elisp profiler. Try M-x profiler-start, do some work, and then call M-x profiler-report. When finished, use M-x profiler-stop. The sampling rate can be based on -CPU time (only supported on some systems) or memory allocations. +CPU time or memory allocations. +++ ** CL-style generalized variables are now in core Elisp. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-20 19:32:20 +0000 +++ lisp/ChangeLog 2012-11-21 04:47:55 +0000 @@ -1,3 +1,46 @@ +2012-11-21 Eli Zaretskii + + * simple.el (line-move): Don't call line-move-partial if + scroll-conservatively is in effect. (Bug#12927) + +2012-11-21 Stefan Monnier + + * eshell/em-cmpl.el (eshell-pcomplete): Refine fix for bug#12838: + Fallback on completion-at-point rather than + pcomplete-expand-and-complete, and only if pcomplete actually failed. + (eshell-cmpl-initialize): Setup completion-at-point. + + * pcomplete.el (pcomplete--entries): Obey pcomplete-ignore-case. + + * emacs-lisp/ert.el (ert--expand-should-1): Adapt to cl-lib. + +2012-11-21 Michael Albinus + + * net/tramp-sh.el (tramp-do-copy-or-rename-file): If both files + are remote, check out-of-band property for both. + +2012-11-21 Stefan Monnier + + * window.el (switch-to-buffer): Re-add the warning that was lost in the + code rewrite. + +2012-11-21 Paul Eggert + + More minor time fixes. + * calendar/time-date.el: Commentary fix. + * net/tramp-sh.el (tramp-do-file-attributes-with-ls): Undo last change; + too much other code depends on (0 0) time stamps. + * net/tramp.el (tramp-time-less-p, tramp-time-subtract): + Add a couple of FIXME comments. + + Minor cleanup for times as lists of four integers. + * files.el (dir-locals-directory-cache): + * ps-bdf.el (bdf-file-mod-time, bdf-read-font-info): + Doc fixes. + * net/tramp-sh.el (tramp-do-file-attributes-with-ls): + * ps-bdf.el (bdf-file-newer-than-time): + Process four-integers time stamps, not two. Doc fixes. + 2012-11-20 Stefan Monnier * uniquify.el (uniquify-managed): Use defvar-local. === modified file 'lisp/calendar/time-date.el' --- lisp/calendar/time-date.el 2012-11-19 16:17:49 +0000 +++ lisp/calendar/time-date.el 2012-11-21 04:47:55 +0000 @@ -30,11 +30,10 @@ ;; value equal to HIGH * 2^16 + LOW + USEC * 10^-6 + PSEC * 10^-12 ;; seconds, where missing components are treated as zero. HIGH can be ;; negative, either because the value is a time difference, or because -;; the machine supports negative time stamps that fall before the -;; epoch. The macro `with-decoded-time-value' and the -;; function `encode-time-value' make it easier to deal with these -;; three formats. See `time-subtract' for an example of how to use -;; them. +;; the machine supports negative time stamps that fall before the epoch. +;; The macro `with-decoded-time-value' and the function +;; `encode-time-value' make it easier to deal with these formats. +;; See `time-subtract' for an example of how to use them. ;;; Code: === modified file 'lisp/emacs-lisp/ert.el' --- lisp/emacs-lisp/ert.el 2012-09-24 15:58:20 +0000 +++ lisp/emacs-lisp/ert.el 2012-11-19 17:02:20 +0000 @@ -388,16 +388,11 @@ (defun ert--expand-should-1 (whole form inner-expander) "Helper function for the `should' macro and its variants." (let ((form - ;; If `cl-macroexpand' isn't bound, the code that we're - ;; compiling doesn't depend on cl and thus doesn't need an - ;; environment arg for `macroexpand'. - (if (fboundp 'cl-macroexpand) - ;; Suppress warning about run-time call to cl function: we - ;; only call it if it's fboundp. - (with-no-warnings - (cl-macroexpand form (and (boundp 'cl-macro-environment) - cl-macro-environment))) - (macroexpand form)))) + (macroexpand form (cond + ((boundp 'macroexpand-all-environment) + macroexpand-all-environment) + ((boundp 'cl-macro-environment) + cl-macro-environment))))) (cond ((or (atom form) (ert--special-operator-p (car form))) (let ((value (ert--gensym "value-"))) === modified file 'lisp/eshell/em-cmpl.el' --- lisp/eshell/em-cmpl.el 2012-11-15 07:59:46 +0000 +++ lisp/eshell/em-cmpl.el 2012-11-19 19:22:07 +0000 @@ -297,6 +297,8 @@ (define-key eshell-command-map [? ] 'pcomplete-expand) (define-key eshell-mode-map [tab] 'eshell-pcomplete) (define-key eshell-mode-map [(control ?i)] 'eshell-pcomplete) + (add-hook 'completion-at-point-functions + #'pcomplete-completions-at-point nil t) ;; jww (1999-10-19): Will this work on anything but X? (if (featurep 'xemacs) (define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse) @@ -452,9 +454,9 @@ (defun eshell-pcomplete () "Eshell wrapper for `pcomplete'." (interactive) - (if eshell-cmpl-ignore-case - (pcomplete-expand-and-complete) ; hack workaround for bug#12838 - (pcomplete))) + (condition-case nil + (pcomplete) + (text-read-only (completion-at-point)))) ; Workaround for bug#12838. (provide 'em-cmpl) === modified file 'lisp/files.el' --- lisp/files.el 2012-11-19 18:27:25 +0000 +++ lisp/files.el 2012-11-21 04:47:55 +0000 @@ -3433,7 +3433,7 @@ CLASS is the name of a variable class (a symbol). MTIME is the recorded modification time of the directory-local variables file associated with this entry. This time is a list -of two integers (the same format as `file-attributes'), and is +of integers (the same format as `file-attributes'), and is used to test whether the cache entry is still valid. Alternatively, MTIME can be nil, which means the entry is always considered valid.") === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2012-10-09 12:49:02 +0000 +++ lisp/net/tramp-sh.el 2012-11-19 15:25:10 +0000 @@ -1270,9 +1270,10 @@ res-uid ;; 3. File gid. res-gid - ;; 4. Last access time, as a list of two integers. First - ;; integer has high-order 16 bits of time, second has low 16 - ;; bits. + ;; 4. Last access time, as a list of integers. Normally this + ;; would be in the same format as `current-time', but the + ;; subseconds part is not currently implemented, and (0 0) + ;; denotes an unknown time. ;; 5. Last modification time, likewise. ;; 6. Last status change time, likewise. '(0 0) '(0 0) '(0 0) ;CCC how to find out? @@ -1980,6 +1981,7 @@ (error "Unknown operation `%s', must be `copy' or `rename'" op)) (let ((t1 (tramp-tramp-file-p filename)) (t2 (tramp-tramp-file-p newname)) + (length (nth 7 (file-attributes (file-truename filename)))) (context (and preserve-selinux-context (apply 'file-selinux-context (list filename)))) pr tm) @@ -2009,8 +2011,9 @@ ok-if-already-exists keep-date preserve-uid-gid)) ;; Try out-of-band operation. - ((tramp-method-out-of-band-p - v1 (nth 7 (file-attributes (file-truename filename)))) + ((and + (tramp-method-out-of-band-p v1 length) + (tramp-method-out-of-band-p v2 length)) (tramp-do-copy-or-rename-file-out-of-band op filename newname keep-date)) @@ -2038,8 +2041,7 @@ ;; If the Tramp file has an out-of-band method, the ;; corresponding copy-program can be invoked. - ((tramp-method-out-of-band-p - v (nth 7 (file-attributes (file-truename filename)))) + ((tramp-method-out-of-band-p v length) (tramp-do-copy-or-rename-file-out-of-band op filename newname keep-date)) === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2012-11-08 15:10:08 +0000 +++ lisp/net/tramp.el 2012-11-21 04:47:55 +0000 @@ -3767,6 +3767,7 @@ ("oct" . 10) ("nov" . 11) ("dec" . 12)) "Alist mapping month names to integers.") +;; FIXME: Shouldn't this also look at any subseconds parts of T1 and T2? ;;;###tramp-autoload (defun tramp-time-less-p (t1 t2) "Say whether time value T1 is less than time value T2." @@ -3776,6 +3777,7 @@ (and (= (car t1) (car t2)) (< (nth 1 t1) (nth 1 t2))))) +;; FIXME: Shouldn't this also look at any subseconds parts of T1 and T2? (defun tramp-time-subtract (t1 t2) "Subtract two time values. Return the difference in the format of a time value." === modified file 'lisp/pcomplete.el' --- lisp/pcomplete.el 2012-09-28 16:02:31 +0000 +++ lisp/pcomplete.el 2012-11-19 19:22:07 +0000 @@ -833,7 +833,8 @@ . ,(lambda (comps) (sort comps pcomplete-compare-entry-function))) ,@(cdr (completion-file-name-table s p a))) - (let ((completion-ignored-extensions nil)) + (let ((completion-ignored-extensions nil) + (completion-ignore-case pcomplete-ignore-case)) (completion-table-with-predicate #'comint-completion-file-name-table pred 'strict s p a)))))) === modified file 'lisp/ps-bdf.el' --- lisp/ps-bdf.el 2012-01-19 07:21:25 +0000 +++ lisp/ps-bdf.el 2012-11-18 02:13:19 +0000 @@ -70,20 +70,15 @@ (defsubst bdf-file-mod-time (filename) "Return modification time of FILENAME. -The value is a list of two integers, the first integer has high-order -16 bits, the second has low 16 bits." +The value is a list of integers in the same format as `current-time'." (nth 5 (file-attributes filename))) (defun bdf-file-newer-than-time (filename mod-time) "Return non-nil if and only if FILENAME is newer than MOD-TIME. -MOD-TIME is a modification time as a list of two integers, the first -integer has high-order 16 bits, the second has low 16 bits." - (let* ((new-mod-time (bdf-file-mod-time filename)) - (new-time (car new-mod-time)) - (time (car mod-time))) - (or (> new-time time) - (and (= new-time time) - (> (nth 1 new-mod-time) (nth 1 mod-time)))))) +MOD-TIME is a modification time as a list of integers in the same +format as `current-time'." + (let ((new-mod-time (bdf-file-mod-time filename))) + (time-less-p mod-time new-mod-time))) (defun bdf-find-file (bdfname) "Return a buffer visiting a bdf file BDFNAME. @@ -178,8 +173,8 @@ (BDFFILE MOD-TIME FONT-BOUNDING-BOX RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR) -MOD-TIME is last modification time as a list of two integers, the -first integer has high-order 16 bits, the second has low 16 bits. +MOD-TIME is last modification time as a list of integers in the +same format as `current-time'. SIZE is a size of the font on 72 dpi device. This value is got from SIZE record of the font. === modified file 'lisp/simple.el' --- lisp/simple.el 2012-10-07 22:31:58 +0000 +++ lisp/simple.el 2012-11-20 17:44:04 +0000 @@ -4583,6 +4583,9 @@ (unless (and auto-window-vscroll try-vscroll ;; Only vscroll for single line moves (= (abs arg) 1) + ;; Under scroll-conservatively, the display engine + ;; does this better. + (zerop scroll-conservatively) ;; But don't vscroll in a keyboard macro. (not defining-kbd-macro) (not executing-kbd-macro) === modified file 'lisp/window.el' --- lisp/window.el 2012-11-17 02:03:58 +0000 +++ lisp/window.el 2012-11-19 03:16:03 +0000 @@ -5870,7 +5870,12 @@ :version "24.3") (defun switch-to-buffer (buffer-or-name &optional norecord force-same-window) - "Switch to buffer BUFFER-OR-NAME in the selected window. + "Display buffer BUFFER-OR-NAME in the selected window. + +WARNING: This is NOT the way to work on another buffer temporarily +within a Lisp program! Use `set-buffer' instead. That avoids +messing with the window-buffer correspondences. + If the selected window cannot display the specified buffer (e.g. if it is a minibuffer window or strongly dedicated to another buffer), call `pop-to-buffer' to select the buffer in === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-11-18 16:54:31 +0000 +++ nt/ChangeLog 2012-11-21 04:47:55 +0000 @@ -1,3 +1,11 @@ +2012-11-21 Eli Zaretskii + + * nmake.defs: Use !if, not !ifdef. For the details, see + http://lists.gnu.org/archive/html/help-emacs-windows/2012-11/msg00027.html + + * inc/stdint.h (INTPTR_MIN): + (PTRDIFF_MIN) [!__GNUC__]: Define for MSVC. + 2012-11-18 Eli Zaretskii * inc/unistd.h: Don't include fcntl.h and don't define O_RDWR. === modified file 'nt/inc/stdint.h' --- nt/inc/stdint.h 2012-01-05 09:46:05 +0000 +++ nt/inc/stdint.h 2012-11-20 17:07:55 +0000 @@ -37,6 +37,7 @@ #define INT64_MAX 9223372036854775807i64 #define INT64_MIN (~INT64_MAX) #define INTPTR_MAX INT64_MAX +#define INTPTR_MIN INT64_MIN #define UINTMAX_MAX UINT64_MAX #define UINTMAX_MIN UINT64_MIN #define INTMAX_MAX INT64_MAX @@ -51,6 +52,7 @@ #define INT32_MAX 2147483647 #define INT32_MIN (~INT32_MAX) #define INTPTR_MAX INT32_MAX +#define INTPTR_MIN INT32_MIN #define UINTMAX_MAX UINT32_MAX #define UINTMAX_MIN UINT32_MIN #define INTMAX_MAX INT32_MAX @@ -60,6 +62,7 @@ #endif #define PTRDIFF_MAX INTPTR_MAX +#define PTRDIFF_MIN INTPTR_MIN #endif /* !__GNUC__ */ === modified file 'nt/nmake.defs' --- nt/nmake.defs 2012-09-30 21:36:42 +0000 +++ nt/nmake.defs 2012-11-20 17:13:10 +0000 @@ -116,7 +116,7 @@ USE_CRT_DLL = 1 -!ifdef USE_CRT_DLL +!if USE_CRT_DLL libc = msvcrt$(D).lib EMACS_EXTRA_C_FLAGS= -D_DLL -D_MT -DUSE_CRT_DLL=1 !else === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-20 20:06:17 +0000 +++ src/ChangeLog 2012-11-21 04:47:55 +0000 @@ -1,3 +1,24 @@ +2012-11-21 Ken Brown + + * emacs.c (main): Set the G_SLICE environment variable for all + Cygwin builds, not just GTK builds. See + https://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00368.html. + +2012-11-21 Eli Zaretskii + + * w32.c (FILE_DEVICE_FILE_SYSTEM, METHOD_BUFFERED) + (FILE_ANY_ACCESS, CTL_CODE, FSCTL_GET_REPARSE_POINT) [_MSC_VER]: + Define for the MSVC compiler. + + * w32term.h (EnumSystemLocalesW) [_MSC_VER]: Add a missing semi-colon. + + * fileio.c (Fsubstitute_in_file_name, Ffile_name_directory) + (Fexpand_file_name) [DOS_NT]: Pass encoded file name to + dostounix_filename. Prevents crashes down the road, because + dostounix_filename assumes it gets a unibyte string. Reported by + Michel de Ruiter , see + http://lists.gnu.org/archive/html/help-emacs-windows/2012-11/msg00017.html + 2012-11-20 Stefan Monnier Conflate Qnil and Qunbound for `symbol-function'. === modified file 'src/emacs.c' --- src/emacs.c 2012-11-17 22:12:47 +0000 +++ src/emacs.c 2012-11-21 04:47:55 +0000 @@ -715,7 +715,7 @@ stack_base = &dummy; #endif -#if defined (USE_GTK) && defined (G_SLICE_ALWAYS_MALLOC) +#ifdef G_SLICE_ALWAYS_MALLOC /* This is used by the Cygwin build. */ setenv ("G_SLICE", "always-malloc", 1); #endif === modified file 'src/fileio.c' --- src/fileio.c 2012-11-14 04:55:41 +0000 +++ src/fileio.c 2012-11-21 04:47:55 +0000 @@ -315,6 +315,7 @@ register const char *beg; #else register char *beg; + Lisp_Object tem_fn; #endif register const char *p; Lisp_Object handler; @@ -374,10 +375,13 @@ p = beg + strlen (beg); } } - dostounix_filename (beg); -#endif /* DOS_NT */ - + tem_fn = ENCODE_FILE (make_specified_string (beg, -1, p - beg, + STRING_MULTIBYTE (filename))); + dostounix_filename (SSDATA (tem_fn)); + return DECODE_FILE (tem_fn); +#else /* DOS_NT */ return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename)); +#endif /* DOS_NT */ } DEFUN ("file-name-nondirectory", Ffile_name_nondirectory, @@ -951,7 +955,18 @@ #ifdef DOS_NT /* Make sure directories are all separated with /, but avoid allocation of a new string when not required. */ - dostounix_filename (nm); + if (multibyte) + { + Lisp_Object tem_name = make_specified_string (nm, -1, strlen (nm), + multibyte); + + tem_name = ENCODE_FILE (tem_name); + dostounix_filename (SSDATA (tem_name)); + tem_name = DECODE_FILE (tem_name); + memcpy (nm, SSDATA (tem_name), SBYTES (tem_name) + 1); + } + else + dostounix_filename (nm); #ifdef WINDOWSNT if (IS_DIRECTORY_SEP (nm[1])) { @@ -1305,10 +1320,13 @@ target[0] = '/'; target[1] = ':'; } - dostounix_filename (target); -#endif /* DOS_NT */ - - result = make_specified_string (target, -1, o - target, multibyte); + result = make_specified_string (target, -1, o - target, multibyte); + result = ENCODE_FILE (result); + dostounix_filename (SSDATA (result)); + result = DECODE_FILE (result); +#else /* !DOS_NT */ + result = make_specified_string (target, -1, o - target, multibyte); +#endif /* !DOS_NT */ } /* Again look to see if the file name has special constructs in it @@ -1587,8 +1605,18 @@ memcpy (nm, SDATA (filename), SBYTES (filename) + 1); #ifdef DOS_NT - dostounix_filename (nm); - substituted = (strcmp (nm, SDATA (filename)) != 0); + { + Lisp_Object encoded_filename = ENCODE_FILE (filename); + Lisp_Object tem_fn; + + dostounix_filename (SDATA (encoded_filename)); + tem_fn = DECODE_FILE (encoded_filename); + nm = alloca (SBYTES (tem_fn) + 1); + memcpy (nm, SDATA (tem_fn), SBYTES (tem_fn) + 1); + substituted = (memcmp (nm, SDATA (filename), SBYTES (filename)) != 0); + if (substituted) + filename = tem_fn; + } #endif endp = nm + SBYTES (filename); === modified file 'src/w32.c' --- src/w32.c 2012-11-17 22:12:47 +0000 +++ src/w32.c 2012-11-21 04:47:55 +0000 @@ -119,9 +119,10 @@ #include #ifdef _MSC_VER -/* MSVC doesn't provide the definition of REPARSE_DATA_BUFFER, except - on ntifs.h, which cannot be included because it triggers conflicts - with other Windows API headers. So we define it here by hand. */ +/* MSVC doesn't provide the definition of REPARSE_DATA_BUFFER and the + associated macros, except on ntifs.h, which cannot be included + because it triggers conflicts with other Windows API headers. So + we define it here by hand. */ typedef struct _REPARSE_DATA_BUFFER { ULONG ReparseTag; @@ -149,6 +150,12 @@ } DUMMYUNIONNAME; } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; +#define FILE_DEVICE_FILE_SYSTEM 9 +#define METHOD_BUFFERED 0 +#define FILE_ANY_ACCESS 0x00000000 +#define CTL_CODE(t,f,m,a) (((t)<<16)|((a)<<14)|((f)<<2)|(m)) +#define FSCTL_GET_REPARSE_POINT \ + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) #endif /* TCP connection support. */ === modified file 'src/w32term.h' --- src/w32term.h 2012-11-18 01:52:36 +0000 +++ src/w32term.h 2012-11-21 04:47:55 +0000 @@ -751,7 +751,7 @@ typedef BOOL (CALLBACK *LOCALE_ENUMPROCA)(LPSTR); typedef BOOL (CALLBACK *LOCALE_ENUMPROCW)(LPWSTR); BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA,DWORD); -BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD) +BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD); #ifdef UNICODE #define EnumSystemLocales EnumSystemLocalesW #else ------------------------------------------------------------ revno: 110966 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2012-11-20 15:06:17 -0500 message: Conflate Qnil and Qunbound for `symbol-function'. * src/alloc.c (Fmake_symbol): Initialize `function' to Qnil. * src/lread.c (init_obarray): Set `function' fields to Qnil. * src/eval.c (Fcommandp): Ignore Qunbound. (Fautoload, eval_sub, Fapply, Ffuncall, Fmacroexpand): * src/data.c (Ffset, Ffboundp, indirect_function, Findirect_function): Test NILP rather than Qunbound. (Ffmakunbound): Set to Qnil. (Fsymbol_function): Never signal an error. (Finteractive_form): Ignore Qunbound. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-11-20 19:30:37 +0000 +++ etc/NEWS 2012-11-20 20:06:17 +0000 @@ -52,6 +52,10 @@ * Incompatible Lisp Changes in Emacs 24.4 +** nil and "unbound" are indistinguishable in symbol-function. +`symbol-function' never signals `void-function' any more. +`fboundp' returns non-nil if the symbol was `fset' to nil. + ** `defadvice' does not honor the `freeze' flag and cannot advise special-forms any more. === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-20 11:41:57 +0000 +++ src/ChangeLog 2012-11-20 20:06:17 +0000 @@ -1,3 +1,16 @@ +2012-11-20 Stefan Monnier + + Conflate Qnil and Qunbound for `symbol-function'. + * alloc.c (Fmake_symbol): Initialize `function' to Qnil. + * lread.c (init_obarray): Set `function' fields to Qnil. + * eval.c (Fcommandp): Ignore Qunbound. + (Fautoload, eval_sub, Fapply, Ffuncall, Fmacroexpand): + * data.c (Ffset, Ffboundp, indirect_function, Findirect_function): + Test NILP rather than Qunbound. + (Ffmakunbound): Set to Qnil. + (Fsymbol_function): Never signal an error. + (Finteractive_form): Ignore Qunbound. + 2012-11-20 Paul Eggert * eval.c (interactive_p): Remove no-longer-used decl. === modified file 'src/alloc.c' --- src/alloc.c 2012-11-12 01:09:34 +0000 +++ src/alloc.c 2012-11-20 20:06:17 +0000 @@ -3212,7 +3212,7 @@ DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, doc: /* Return a newly allocated uninterned symbol whose name is NAME. -Its value and function definition are void, and its property list is nil. */) +Its value is void, and its function definition and property list are nil. */) (Lisp_Object name) { register Lisp_Object val; @@ -3249,7 +3249,7 @@ set_symbol_plist (val, Qnil); p->redirect = SYMBOL_PLAINVAL; SET_SYMBOL_VAL (p, Qunbound); - set_symbol_function (val, Qunbound); + set_symbol_function (val, Qnil); set_symbol_next (val, NULL); p->gcmarkbit = 0; p->interned = SYMBOL_UNINTERNED; === modified file 'src/data.c' --- src/data.c 2012-11-12 02:08:06 +0000 +++ src/data.c 2012-11-20 20:06:17 +0000 @@ -543,12 +543,13 @@ return (EQ (valcontents, Qunbound) ? Qnil : Qt); } +/* FIXME: Make it an alias for function-symbol! */ DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, doc: /* Return t if SYMBOL's function definition is not void. */) (register Lisp_Object symbol) { CHECK_SYMBOL (symbol); - return EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt; + return NILP (XSYMBOL (symbol)->function) ? Qnil : Qt; } DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, @@ -564,14 +565,14 @@ } DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, - doc: /* Make SYMBOL's function definition be void. + doc: /* Make SYMBOL's function definition be nil. Return SYMBOL. */) (register Lisp_Object symbol) { CHECK_SYMBOL (symbol); if (NILP (symbol) || EQ (symbol, Qt)) xsignal1 (Qsetting_constant, symbol); - set_symbol_function (symbol, Qunbound); + set_symbol_function (symbol, Qnil); return symbol; } @@ -580,9 +581,7 @@ (register Lisp_Object symbol) { CHECK_SYMBOL (symbol); - if (!EQ (XSYMBOL (symbol)->function, Qunbound)) return XSYMBOL (symbol)->function; - xsignal1 (Qvoid_function, symbol); } DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, @@ -613,7 +612,7 @@ function = XSYMBOL (symbol)->function; - if (!NILP (Vautoload_queue) && !EQ (function, Qunbound)) + if (!NILP (Vautoload_queue) && !NILP (function)) Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); if (AUTOLOADP (function)) @@ -714,7 +713,7 @@ { Lisp_Object fun = indirect_function (cmd); /* Check cycles. */ - if (NILP (fun) || EQ (fun, Qunbound)) + if (NILP (fun)) return Qnil; /* Use an `interactive-form' property if present, analogous to the @@ -2008,10 +2007,10 @@ for (;;) { - if (!SYMBOLP (hare) || EQ (hare, Qunbound)) + if (!SYMBOLP (hare) || NILP (hare)) break; hare = XSYMBOL (hare)->function; - if (!SYMBOLP (hare) || EQ (hare, Qunbound)) + if (!SYMBOLP (hare) || NILP (hare)) break; hare = XSYMBOL (hare)->function; @@ -2038,10 +2037,10 @@ /* Optimize for no indirection. */ result = object; - if (SYMBOLP (result) && !EQ (result, Qunbound) + if (SYMBOLP (result) && !NILP (result) && (result = XSYMBOL (result)->function, SYMBOLP (result))) result = indirect_function (result); - if (!EQ (result, Qunbound)) + if (!NILP (result)) return result; if (NILP (noerror)) === modified file 'src/eval.c' --- src/eval.c 2012-11-20 08:32:19 +0000 +++ src/eval.c 2012-11-20 20:06:17 +0000 @@ -875,7 +875,7 @@ if (NILP (tem)) { def = XSYMBOL (sym)->function; - if (!EQ (def, Qunbound)) + if (!NILP (def)) continue; } break; @@ -890,7 +890,7 @@ GCPRO1 (form); def = Fautoload_do_load (def, sym, Qmacro); UNGCPRO; - if (EQ (def, Qunbound) || !CONSP (def)) + if (!CONSP (def)) /* Not defined or definition not suitable. */ break; if (!EQ (XCAR (def), Qmacro)) @@ -1715,12 +1715,12 @@ fun = function; - fun = indirect_function (fun); /* Check cycles. */ - if (NILP (fun) || EQ (fun, Qunbound)) + fun = indirect_function (fun); /* Check cycles. */ + if (NILP (fun)) return Qnil; /* Check an `interactive-form' property if present, analogous to the - function-documentation property. */ + function-documentation property. */ fun = function; while (SYMBOLP (fun)) { @@ -1780,7 +1780,7 @@ CHECK_STRING (file); /* If function is defined and not as an autoload, don't override. */ - if (!EQ (XSYMBOL (function)->function, Qunbound) + if (!NILP (XSYMBOL (function)->function) && !AUTOLOADP (XSYMBOL (function)->function)) return Qnil; @@ -1959,7 +1959,7 @@ /* Optimize for no indirection. */ fun = original_fun; - if (SYMBOLP (fun) && !EQ (fun, Qunbound) + if (SYMBOLP (fun) && !NILP (fun) && (fun = XSYMBOL (fun)->function, SYMBOLP (fun))) fun = indirect_function (fun); @@ -2081,7 +2081,7 @@ val = apply_lambda (fun, original_args); else { - if (EQ (fun, Qunbound)) + if (NILP (fun)) xsignal1 (Qvoid_function, original_fun); if (!CONSP (fun)) xsignal1 (Qinvalid_function, original_fun); @@ -2155,10 +2155,10 @@ numargs += nargs - 2; /* Optimize for no indirection. */ - if (SYMBOLP (fun) && !EQ (fun, Qunbound) + if (SYMBOLP (fun) && !NILP (fun) && (fun = XSYMBOL (fun)->function, SYMBOLP (fun))) fun = indirect_function (fun); - if (EQ (fun, Qunbound)) + if (NILP (fun)) { /* Let funcall get the error. */ fun = args[0]; @@ -2632,7 +2632,7 @@ /* Optimize for no indirection. */ fun = original_fun; - if (SYMBOLP (fun) && !EQ (fun, Qunbound) + if (SYMBOLP (fun) && !NILP (fun) && (fun = XSYMBOL (fun)->function, SYMBOLP (fun))) fun = indirect_function (fun); @@ -2720,7 +2720,7 @@ val = funcall_lambda (fun, numargs, args + 1); else { - if (EQ (fun, Qunbound)) + if (NILP (fun)) xsignal1 (Qvoid_function, original_fun); if (!CONSP (fun)) xsignal1 (Qinvalid_function, original_fun); === modified file 'src/lisp.h' --- src/lisp.h 2012-11-14 04:55:41 +0000 +++ src/lisp.h 2012-11-20 20:06:17 +0000 @@ -1104,7 +1104,7 @@ union Lisp_Fwd *fwd; } val; - /* Function value of the symbol or Qunbound if not fboundp. */ + /* Function value of the symbol or Qnil if not fboundp. */ Lisp_Object function; /* The symbol's property list. */ === modified file 'src/lread.c' --- src/lread.c 2012-11-14 04:55:41 +0000 +++ src/lread.c 2012-11-20 20:06:17 +0000 @@ -3957,12 +3957,13 @@ /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil, so those two need to be fixed manually. */ SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound); - set_symbol_function (Qunbound, Qunbound); + set_symbol_function (Qunbound, Qnil); set_symbol_plist (Qunbound, Qnil); SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil); XSYMBOL (Qnil)->constant = 1; XSYMBOL (Qnil)->declared_special = 1; set_symbol_plist (Qnil, Qnil); + set_symbol_function (Qnil, Qnil); Qt = intern_c_string ("t"); SET_SYMBOL_VAL (XSYMBOL (Qt), Qt); ------------------------------------------------------------ revno: 110965 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2012-11-20 14:32:20 -0500 message: * lisp/uniquify.el (uniquify-managed): Use defvar-local. (rename-buffer, create-file-buffer): Advise with advice-add. (uniquify-unload-function): Unadvise accordingly. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-20 19:30:37 +0000 +++ lisp/ChangeLog 2012-11-20 19:32:20 +0000 @@ -1,5 +1,9 @@ 2012-11-20 Stefan Monnier + * uniquify.el (uniquify-managed): Use defvar-local. + (rename-buffer, create-file-buffer): Advise with advice-add. + (uniquify-unload-function): Unadvise accordingly. + * emacs-lisp/trace.el: Rewrite, use nadvice and lexical-binding. (trace-buffer): Don't purecopy. (trace-entry-message, trace-exit-message): Add `context' arg. === modified file 'lisp/uniquify.el' --- lisp/uniquify.el 2012-07-10 11:51:54 +0000 +++ lisp/uniquify.el 2012-11-20 19:32:20 +0000 @@ -183,10 +183,9 @@ ;; Internal variables used free (defvar uniquify-possibly-resolvable nil) -(defvar uniquify-managed nil +(defvar-local uniquify-managed nil "Non-nil if the name of this buffer is managed by uniquify. It actually holds the list of `uniquify-item's corresponding to the conflict.") -(make-variable-buffer-local 'uniquify-managed) (put 'uniquify-managed 'permanent-local t) ;; Used in desktop.el to save the non-uniquified buffer name @@ -464,27 +463,34 @@ ;; rename-buffer and create-file-buffer. (Setting find-file-hook isn't ;; sufficient.) -(defadvice rename-buffer (after rename-buffer-uniquify activate) +(advice-add 'rename-buffer :around #'uniquify--rename-buffer-advice) +(defun uniquify--rename-buffer-advice (rb-fun newname &optional unique &rest args) "Uniquify buffer names with parts of directory name." + (let ((retval (apply rb-fun newname unique args))) (uniquify-maybe-rerationalize-w/o-cb) - (if (null (ad-get-arg 1)) ; no UNIQUE argument. + (if (null unique) ;; Mark this buffer so it won't be renamed by uniquify. (setq uniquify-managed nil) (when uniquify-buffer-name-style ;; Rerationalize w.r.t the new name. (uniquify-rationalize-file-buffer-names - (ad-get-arg 0) + newname (uniquify-buffer-file-name (current-buffer)) (current-buffer)) - (setq ad-return-value (buffer-name (current-buffer)))))) - -(defadvice create-file-buffer (after create-file-buffer-uniquify activate) + (setq retval (buffer-name (current-buffer))))) + retval)) + + +(advice-add 'create-file-buffer :around #'uniquify--create-file-buffer-advice) +(defun uniquify--create-file-buffer-advice (cfb-fun filename &rest args) "Uniquify buffer names with parts of directory name." + (let ((retval (apply cfb-fun filename args))) (if uniquify-buffer-name-style - (let ((filename (expand-file-name (directory-file-name (ad-get-arg 0))))) + (let ((filename (expand-file-name (directory-file-name filename)))) (uniquify-rationalize-file-buffer-names (file-name-nondirectory filename) - (file-name-directory filename) ad-return-value)))) + (file-name-directory filename) retval))) + retval)) ;;; The End @@ -496,9 +502,8 @@ (set-buffer buf) (when uniquify-managed (push (cons buf (uniquify-item-base (car uniquify-managed))) buffers))) - (dolist (fun '(rename-buffer create-file-buffer)) - (ad-remove-advice fun 'after (intern (concat (symbol-name fun) "-uniquify"))) - (ad-update fun)) + (advice-remove 'rename-buffer #'uniquify--rename-buffer-advice) + (advice-remove 'create-file-buffer #'uniquify--create-file-buffer-advice) (dolist (buf buffers) (set-buffer (car buf)) (rename-buffer (cdr buf) t)))) ------------------------------------------------------------ revno: 110964 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2012-11-20 14:30:37 -0500 message: * lisp/emacs-lisp/trace.el: Rewrite, use nadvice and lexical-binding. (trace-buffer): Don't purecopy. (trace-entry-message, trace-exit-message): Add `context' arg. (trace--timer): New var. (trace-make-advice): Adjust for use in nadvice. Add `context' argument. Delay `display-buffer' via a timer. (trace-function-internal): Use advice-add. (trace--read-args): New function. (trace-function-foreground, trace-function-background): Use it. (trace-function): Rename to trace-function-foreground and redefine as an alias to that new name. (untrace-function, untrace-all): Adjust to the use of nadvice. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-11-19 16:17:49 +0000 +++ etc/NEWS 2012-11-20 19:30:37 +0000 @@ -32,6 +32,15 @@ +++ ** New function `ses-rename-cell' to give SES cells arbitrary names. +** trace-function was largely rewritten. +New features include: +- no prompting for the destination buffer, unless a prefix-arg was used. +- additionally to prompting for a destination buffer, when a prefix-arg is + used, the user can enter a "context", i.e. Lisp expression whose value at the + time the function is entered/exited will be printed along with the function + name and arguments. Useful to trace the value of (current-buffer) or + (point) when the function is invoked. + * New Modes and Packages in Emacs 24.4 ** New nadvice.el package offering lighter-weight advice facilities. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-20 19:05:20 +0000 +++ lisp/ChangeLog 2012-11-20 19:30:37 +0000 @@ -1,5 +1,18 @@ 2012-11-20 Stefan Monnier + * emacs-lisp/trace.el: Rewrite, use nadvice and lexical-binding. + (trace-buffer): Don't purecopy. + (trace-entry-message, trace-exit-message): Add `context' arg. + (trace--timer): New var. + (trace-make-advice): Adjust for use in nadvice. + Add `context' argument. Delay `display-buffer' via a timer. + (trace-function-internal): Use advice-add. + (trace--read-args): New function. + (trace-function-foreground, trace-function-background): Use it. + (trace-function): Rename to trace-function-foreground and redefine as + an alias to that new name. + (untrace-function, untrace-all): Adjust to the use of nadvice. + * emacs-lisp/bytecomp.el (byte-compile): Fix handling of closures. * emacs-lisp/byte-run.el (defun-declarations-alist): Fix last change. === modified file 'lisp/emacs-lisp/trace.el' --- lisp/emacs-lisp/trace.el 2012-07-17 08:38:12 +0000 +++ lisp/emacs-lisp/trace.el 2012-11-20 19:30:37 +0000 @@ -1,4 +1,4 @@ -;;; trace.el --- tracing facility for Emacs Lisp functions +;;; trace.el --- tracing facility for Emacs Lisp functions -*- lexical-binding: t -*- ;; Copyright (C) 1993, 1998, 2000-2012 Free Software Foundation, Inc. @@ -151,18 +151,15 @@ ;;; Code: -(require 'advice) - (defgroup trace nil "Tracing facility for Emacs Lisp functions." :prefix "trace-" :group 'lisp) ;;;###autoload -(defcustom trace-buffer (purecopy "*trace-output*") +(defcustom trace-buffer "*trace-output*" "Trace output will by default go to that buffer." - :type 'string - :group 'trace) + :type 'string) ;; Current level of traced function invocation: (defvar trace-level 0) @@ -176,78 +173,109 @@ (defvar inhibit-trace nil "If non-nil, all tracing is temporarily inhibited.") -(defun trace-entry-message (function level argument-bindings) - ;; Generates a string that describes that FUNCTION has been entered at - ;; trace LEVEL with ARGUMENT-BINDINGS. - (format "%s%s%d -> %s: %s\n" - (mapconcat 'char-to-string (make-string (1- level) ?|) " ") - (if (> level 1) " " "") - level - function - (let ((print-circle t)) - (mapconcat (lambda (binding) - (concat - (symbol-name (ad-arg-binding-field binding 'name)) - "=" - ;; do this so we'll see strings: - (prin1-to-string - (ad-arg-binding-field binding 'value)))) - argument-bindings - " ")))) - -(defun trace-exit-message (function level value) - ;; Generates a string that describes that FUNCTION has been exited at - ;; trace LEVEL and that it returned VALUE. - (format "%s%s%d <- %s: %s\n" - (mapconcat 'char-to-string (make-string (1- level) ?|) " ") - (if (> level 1) " " "") - level - function - ;; do this so we'll see strings: - (let ((print-circle t)) (prin1-to-string value)))) - -(defun trace-make-advice (function buffer background) - ;; Builds the piece of advice to be added to FUNCTION's advice info - ;; so that it will generate the proper trace output in BUFFER - ;; (quietly if BACKGROUND is t). - (ad-make-advice - trace-advice-name nil t - `(advice - lambda () - (let ((trace-level (1+ trace-level)) - (trace-buffer (get-buffer-create ,buffer))) - (unless inhibit-trace - (with-current-buffer trace-buffer - (set (make-local-variable 'window-point-insertion-type) t) - ,(unless background '(display-buffer trace-buffer)) - (goto-char (point-max)) - ;; Insert a separator from previous trace output: - (if (= trace-level 1) (insert trace-separator)) - (insert - (trace-entry-message - ',function trace-level ad-arg-bindings)))) - ad-do-it - (unless inhibit-trace - (with-current-buffer trace-buffer - ,(unless background '(display-buffer trace-buffer)) - (goto-char (point-max)) - (insert - (trace-exit-message - ',function trace-level ad-return-value)))))))) - -(defun trace-function-internal (function buffer background) - ;; Adds trace advice for FUNCTION and activates it. - (ad-add-advice - function - (trace-make-advice function (or buffer trace-buffer) background) - 'around 'last) - (ad-activate function nil)) +(defun trace-entry-message (function level args context) + "Generate a string that describes that FUNCTION has been entered. +LEVEL is the trace level, ARGS is the list of arguments passed to FUNCTION, +and CONTEXT is a string describing the dynamic context (e.g. values of +some global variables)." + (let ((print-circle t)) + (format "%s%s%d -> %S%s\n" + (mapconcat 'char-to-string (make-string (1- level) ?|) " ") + (if (> level 1) " " "") + level + (cons function args) + context))) + +(defun trace-exit-message (function level value context) + "Generate a string that describes that FUNCTION has exited. +LEVEL is the trace level, VALUE value returned by FUNCTION, +and CONTEXT is a string describing the dynamic context (e.g. values of +some global variables)." + (let ((print-circle t)) + (format "%s%s%d <- %s: %S%s\n" + (mapconcat 'char-to-string (make-string (1- level) ?|) " ") + (if (> level 1) " " "") + level + function + ;; Do this so we'll see strings: + value + context))) + +(defvar trace--timer nil) + +(defun trace-make-advice (function buffer background context) + "Build the piece of advice to be added to trace FUNCTION. +FUNCTION is the name of the traced function. +BUFFER is the buffer where the trace should be printed. +BACKGROUND if nil means to display BUFFER. +CONTEXT if non-nil should be a function that returns extra info that should +be printed along with the arguments in the trace." + (lambda (body &rest args) + (let ((trace-level (1+ trace-level)) + (trace-buffer (get-buffer-create buffer)) + (ctx (funcall context))) + (unless inhibit-trace + (with-current-buffer trace-buffer + (set (make-local-variable 'window-point-insertion-type) t) + (unless (or background trace--timer + (get-buffer-window trace-buffer 'visible)) + (setq trace--timer + ;; Postpone the display to some later time, in case we + ;; can't actually do it now. + (run-with-timer 0 nil + (lambda () + (setq trace--timer nil) + (display-buffer trace-buffer))))) + (goto-char (point-max)) + ;; Insert a separator from previous trace output: + (if (= trace-level 1) (insert trace-separator)) + (insert + (trace-entry-message + function trace-level args ctx)))) + (let ((result)) + (unwind-protect + (setq result (list (apply body args))) + (unless inhibit-trace + (let ((ctx (funcall context))) + (with-current-buffer trace-buffer + (unless background (display-buffer trace-buffer)) + (goto-char (point-max)) + (insert + (trace-exit-message + function + trace-level + (if result (car result) '\!non-local\ exit\!) + ctx)))))) + (car result))))) + +(defun trace-function-internal (function buffer background context) + "Add trace advice for FUNCTION." + (advice-add + function :around + (trace-make-advice function (or buffer trace-buffer) background + (or context (lambda () ""))) + `((name . ,trace-advice-name)))) (defun trace-is-traced (function) - (ad-find-advice function 'around trace-advice-name)) + (advice-member-p trace-advice-name function)) + +(defun trace--read-args (prompt) + (cons + (intern (completing-read prompt obarray 'fboundp t)) + (when current-prefix-arg + (list + (read-buffer "Output to buffer: " trace-buffer) + (let ((exp + (let ((minibuffer-completing-symbol t)) + (read-from-minibuffer "Context expression: " + nil read-expression-map t + 'read-expression-history)))) + `(lambda () + (let ((print-circle t)) + (concat " [" (prin1-to-string ,exp) "]")))))))) ;;;###autoload -(defun trace-function (function &optional buffer) +(defun trace-function-foreground (function &optional buffer context) "Traces FUNCTION with trace output going to BUFFER. For every call of FUNCTION Lisp-style trace messages that display argument and return values will be inserted into BUFFER. This function generates the @@ -255,14 +283,11 @@ there might be!! The trace BUFFER will popup whenever FUNCTION is called. Do not use this to trace functions that switch buffers or do any other display oriented stuff, use `trace-function-background' instead." - (interactive - (list - (intern (completing-read "Trace function: " obarray 'fboundp t)) - (read-buffer "Output to buffer: " trace-buffer))) - (trace-function-internal function buffer nil)) + (interactive (trace--read-args "Trace function: ")) + (trace-function-internal function buffer nil context)) ;;;###autoload -(defun trace-function-background (function &optional buffer) +(defun trace-function-background (function &optional buffer context) "Traces FUNCTION with trace output going quietly to BUFFER. When this tracing is enabled, every call to FUNCTION writes a Lisp-style trace message (showing the arguments and return value) @@ -272,12 +297,11 @@ the window or buffer configuration. BUFFER defaults to `trace-buffer'." - (interactive - (list - (intern - (completing-read "Trace function in background: " obarray 'fboundp t)) - (read-buffer "Output to buffer: " trace-buffer))) - (trace-function-internal function buffer t)) + (interactive (trace--read-args "Trace function in background: ")) + (trace-function-internal function buffer t context)) + +;;;###autoload +(defalias 'trace-function 'trace-function-foreground) (defun untrace-function (function) "Untraces FUNCTION and possibly activates all remaining advice. @@ -285,16 +309,14 @@ activated only if the advice of FUNCTION is currently active. If FUNCTION was not traced this is a noop." (interactive - (list (ad-read-advised-function "Untrace function" 'trace-is-traced))) - (when (trace-is-traced function) - (ad-remove-advice function 'around trace-advice-name) - (ad-update function))) + (list (intern (completing-read "Untrace function: " + obarray #'trace-is-traced t)))) + (advice-remove function trace-advice-name)) (defun untrace-all () "Untraces all currently traced functions." (interactive) - (ad-do-advised-functions (function) - (untrace-function function))) + (mapatoms #'untrace-function)) (provide 'trace) ------------------------------------------------------------ revno: 110963 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2012-11-20 14:05:20 -0500 message: * lisp/emacs-lisp/bytecomp.el (byte-compile): Fix handling of closures. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-20 17:54:00 +0000 +++ lisp/ChangeLog 2012-11-20 19:05:20 +0000 @@ -1,5 +1,7 @@ 2012-11-20 Stefan Monnier + * emacs-lisp/bytecomp.el (byte-compile): Fix handling of closures. + * emacs-lisp/byte-run.el (defun-declarations-alist): Fix last change. * subr.el (called-interactively-p-functions): New var. === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2012-11-09 15:56:51 +0000 +++ lisp/emacs-lisp/bytecomp.el 2012-11-20 19:05:20 +0000 @@ -2509,8 +2509,8 @@ (when (symbolp form) (unless (memq (car-safe fun) '(closure lambda)) (error "Don't know how to compile %S" fun)) - (setq fun (byte-compile--reify-function fun)) - (setq lexical-binding (eq (car fun) 'closure))) + (setq lexical-binding (eq (car fun) 'closure)) + (setq fun (byte-compile--reify-function fun))) (unless (eq (car-safe fun) 'lambda) (error "Don't know how to compile %S" fun)) ;; Expand macros. ------------------------------------------------------------ revno: 110962 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2012-11-20 12:54:00 -0500 message: * lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Fix last change. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-11-20 04:24:09 +0000 +++ lisp/ChangeLog 2012-11-20 17:54:00 +0000 @@ -1,5 +1,7 @@ 2012-11-20 Stefan Monnier + * emacs-lisp/byte-run.el (defun-declarations-alist): Fix last change. + * subr.el (called-interactively-p-functions): New var. (internal--called-interactively-p--get-frame): New macro. (called-interactively-p, interactive-p): Rewrite in Lisp. === modified file 'lisp/emacs-lisp/byte-run.el' --- lisp/emacs-lisp/byte-run.el 2012-11-19 21:30:55 +0000 +++ lisp/emacs-lisp/byte-run.el 2012-11-20 17:54:00 +0000 @@ -88,7 +88,7 @@ ,(if (eq (car-safe compiler-function) 'lambda) `(lambda ,(append (cadr compiler-function) args) ,@(cddr compiler-function)) - #',compiler-function))))) + `#',compiler-function))))) (list 'doc-string #'(lambda (f _args pos) (list 'put (list 'quote f) ''doc-string-elt (list 'quote pos)))) ------------------------------------------------------------ revno: 110961 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2012-11-20 15:41:57 +0400 message: Tiny adjustment around the previous redisplay change. * xdisp.c (window_outdated): New function. (text_outside_line_unchanged_p, redisplay_window): Use it. (redisplay_internal): Likewise. Fix indentation. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-20 08:32:19 +0000 +++ src/ChangeLog 2012-11-20 11:41:57 +0000 @@ -8,6 +8,9 @@ (buffer_shared_and_changed): New function. (prepare_menu_bars, redisplay_internal): Use it to decide whether all windows or frames should be updated. + (window_outdated): New function. + (text_outside_line_unchanged_p, redisplay_window): Use it. + (redisplay_internal): Likewise. Fix indentation. 2012-11-20 Stefan Monnier === modified file 'src/xdisp.c' --- src/xdisp.c 2012-11-20 07:53:04 +0000 +++ src/xdisp.c 2012-11-20 11:41:57 +0000 @@ -10888,7 +10888,7 @@ return window_height_changed_p; } -/* True if the current buffer is shown in more than +/* Nonzero if the current buffer is shown in more than one window and was modified since last display. */ static int @@ -10897,6 +10897,17 @@ return (buffer_shared > 1 && UNCHANGED_MODIFIED < MODIFF); } +/* Nonzero if W doesn't reflect the actual state of + current buffer due to its text or overlays change. */ + +static int +window_outdated (struct window *w) +{ + eassert (XBUFFER (w->buffer) == current_buffer); + return (w->last_modified < MODIFF + || w->last_overlay_modified < OVERLAY_MODIFF); +} + /*********************************************************************** Mode Lines and Frame Titles ***********************************************************************/ @@ -12622,8 +12633,7 @@ int unchanged_p = 1; /* If text or overlays have changed, see where. */ - if (w->last_modified < MODIFF - || w->last_overlay_modified < OVERLAY_MODIFF) + if (window_outdated (w)) { /* Gap in the line? */ if (GPT < start || Z - GPT < end) @@ -13134,9 +13144,7 @@ if (!NILP (w->column_number_displayed) /* This alternative quickly identifies a common case where no change is needed. */ - && !(PT == w->last_point - && w->last_modified >= MODIFF - && w->last_overlay_modified >= OVERLAY_MODIFF) + && !(PT == w->last_point && !window_outdated (w)) && (XFASTINT (w->column_number_displayed) != current_column ())) w->update_mode_line = 1; @@ -13198,18 +13206,16 @@ } } else if (EQ (selected_window, minibuf_window) - && (current_buffer->clip_changed - || w->last_modified < MODIFF - || w->last_overlay_modified < OVERLAY_MODIFF) + && (current_buffer->clip_changed || window_outdated (w)) && resize_mini_window (w, 0)) { /* Resized active mini-window to fit the size of what it is showing if its contents might have changed. */ must_finish = 1; -/* FIXME: this causes all frames to be updated, which seems unnecessary - since only the current frame needs to be considered. This function needs - to be rewritten with two variables, consider_all_windows and - consider_all_frames. */ + /* FIXME: this causes all frames to be updated, which seems unnecessary + since only the current frame needs to be considered. This function + needs to be rewritten with two variables, consider_all_windows and + consider_all_frames. */ consider_all_windows_p = 1; ++windows_or_buffers_changed; ++update_mode_lines; @@ -13264,9 +13270,7 @@ || FETCH_BYTE (BYTEPOS (tlbufpos)) == '\n')) /* Former continuation line has disappeared by becoming empty. */ goto cancel; - else if (w->last_modified < MODIFF - || w->last_overlay_modified < OVERLAY_MODIFF - || MINI_WINDOW_P (w)) + else if (window_outdated (w) || MINI_WINDOW_P (w)) { /* We have to handle the case of continuation around a wide-column character (see the comment in indent.c around @@ -15517,8 +15521,7 @@ = (!NILP (w->window_end_valid) && !current_buffer->clip_changed && !current_buffer->prevent_redisplay_optimizations_p - && w->last_modified >= MODIFF - && w->last_overlay_modified >= OVERLAY_MODIFF); + && !window_outdated (w)); /* Run the window-bottom-change-functions if it is possible that the text on the screen has changed @@ -15540,8 +15543,7 @@ buffer_unchanged_p = (!NILP (w->window_end_valid) && !current_buffer->clip_changed - && w->last_modified >= MODIFF - && w->last_overlay_modified >= OVERLAY_MODIFF); + && !window_outdated (w)); /* When windows_or_buffers_changed is non-zero, we can't rely on the window end being valid, so set it to nil there. */ @@ -15566,9 +15568,7 @@ if (!NILP (w->column_number_displayed) /* This alternative quickly identifies a common case where no change is needed. */ - && !(PT == w->last_point - && w->last_modified >= MODIFF - && w->last_overlay_modified >= OVERLAY_MODIFF) + && !(PT == w->last_point && !window_outdated (w)) && (XFASTINT (w->column_number_displayed) != current_column ())) update_mode_line = 1; @@ -15810,8 +15810,7 @@ && (CHARPOS (startp) < ZV /* Avoid starting at end of buffer. */ || CHARPOS (startp) == BEGV - || (w->last_modified >= MODIFF - && w->last_overlay_modified >= OVERLAY_MODIFF))) + || !window_outdated (w))) { int d1, d2, d3, d4, d5, d6; ------------------------------------------------------------ revno: 110960 committer: Glenn Morris branch nick: trunk timestamp: Tue 2012-11-20 06:17:33 -0500 message: Auto-commit of generated files. diff: === modified file 'autogen/configure' --- autogen/configure 2012-11-18 11:19:05 +0000 +++ autogen/configure 2012-11-20 11:17:33 +0000 @@ -7257,6 +7257,8 @@ nw="$nw -Wfloat-equal" # warns about high-quality code nw="$nw -Winline" # OK to ignore 'inline' nw="$nw -Wjump-misses-init" # We sometimes safely jump over init. + nw="$nw -Wstrict-overflow" # OK to optimize assuming that + # signed overflow has undefined behavior nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations @@ -7264,11 +7266,38 @@ # . nw="$nw -Wshadow" - # The following lines should be removable at some point. - nw="$nw -Wstack-protector" - nw="$nw -Wstrict-overflow" + # The following line should be removable at some point. nw="$nw -Wsuggest-attribute=pure" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use -Wstack-protector" >&5 +$as_echo_n "checking whether to use -Wstack-protector... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if (1 <= __LONG_MAX__ >> 31 >> 31 \ + && 4 < __GNUC__ + (7 < __GNUC_MINOR__ + (2 <= __GNUC_PATCHLEVEL__))) + /* OK */ + #else + #error "Not GCC, or GCC before 4.7.2, or 'long int' has < 64 bits." + #endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + nw="$nw -Wstack-protector" +fi +rm -f conftest.err conftest.$ac_ext + if test -n "$GCC"; then ------------------------------------------------------------ revno: 110959 committer: Paul Eggert branch nick: trunk timestamp: Tue 2012-11-20 00:32:19 -0800 message: * eval.c (interactive_p): Remove no-longer-used decl. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-20 07:53:04 +0000 +++ src/ChangeLog 2012-11-20 08:32:19 +0000 @@ -1,3 +1,7 @@ +2012-11-20 Paul Eggert + + * eval.c (interactive_p): Remove no-longer-used decl. + 2012-11-20 Dmitry Antipov * xdisp.c (buffer_shared): Adjust comment. === modified file 'src/eval.c' --- src/eval.c 2012-11-20 04:24:09 +0000 +++ src/eval.c 2012-11-20 08:32:19 +0000 @@ -114,7 +114,6 @@ Lisp_Object inhibit_lisp_code; static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); -static bool interactive_p (void); static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); /* Functions to set Lisp_Object slots of struct specbinding. */ ------------------------------------------------------------ revno: 110958 committer: Paul Eggert branch nick: trunk timestamp: Tue 2012-11-20 00:31:19 -0800 message: * emacsclient.c (handle_sigcont, handle_sigtstp): Use raise (sig) rather than kill (getpid (), sig), as it's simpler and safer. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-11-17 23:16:24 +0000 +++ lib-src/ChangeLog 2012-11-20 08:31:19 +0000 @@ -1,3 +1,8 @@ +2012-11-20 Paul Eggert + + * emacsclient.c (handle_sigcont, handle_sigtstp): Use raise (sig) + rather than kill (getpid (), sig), as it's simpler and safer. + 2012-11-17 Juanma Barranquero * makefile.w32-in (SYSWAIT_H): New macro. === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2012-09-17 11:55:05 +0000 +++ lib-src/emacsclient.c 2012-11-20 08:31:19 +0000 @@ -1138,7 +1138,7 @@ else { /* We are in the background; cancel the continue. */ - kill (getpid (), SIGSTOP); + raise (SIGSTOP); } signal (signalnum, handle_sigcont); @@ -1165,7 +1165,7 @@ sigprocmask (SIG_BLOCK, NULL, &set); sigdelset (&set, signalnum); signal (signalnum, SIG_DFL); - kill (getpid (), signalnum); + raise (signalnum); sigprocmask (SIG_SETMASK, &set, NULL); /* Let's the above signal through. */ signal (signalnum, handle_sigtstp); ------------------------------------------------------------ revno: 110957 committer: Paul Eggert branch nick: trunk timestamp: Tue 2012-11-20 00:29:04 -0800 message: Omit -Wstrict-overflow as it does not play well with --enable-checking. diff: === modified file 'ChangeLog' --- ChangeLog 2012-11-19 23:39:28 +0000 +++ ChangeLog 2012-11-20 08:29:04 +0000 @@ -1,8 +1,8 @@ -2012-11-19 Paul Eggert +2012-11-20 Paul Eggert Improve static checking of integer overflow and stack smashing. - * configure.ac (WARN_CFLAGS): Add -Wstack-protector and - -Wstrict-overflow if using GCC 4.7.2 or later on a platform with + * configure.ac (WARN_CFLAGS): Add -Wstack-protector + if using GCC 4.7.2 or later on a platform with at least 64-bit long int. This improves static checking on these platforms, when configured with --enable-gcc-warnings. === modified file 'configure.ac' --- configure.ac 2012-11-19 23:39:28 +0000 +++ configure.ac 2012-11-20 08:29:04 +0000 @@ -710,6 +710,8 @@ nw="$nw -Wfloat-equal" # warns about high-quality code nw="$nw -Winline" # OK to ignore 'inline' nw="$nw -Wjump-misses-init" # We sometimes safely jump over init. + nw="$nw -Wstrict-overflow" # OK to optimize assuming that + # signed overflow has undefined behavior nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations @@ -720,7 +722,7 @@ # The following line should be removable at some point. nw="$nw -Wsuggest-attribute=pure" - AC_MSG_CHECKING([whether to use -Wstack-protector -Wstrict-overflow]) + AC_MSG_CHECKING([whether to use -Wstack-protector]) AC_PREPROC_IFELSE( [AC_LANG_PROGRAM( [[#if (1 <= __LONG_MAX__ >> 31 >> 31 \ @@ -732,8 +734,7 @@ ]])], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) - nw="$nw -Wstack-protector" - nw="$nw -Wstrict-overflow"]) + nw="$nw -Wstack-protector"]) gl_MANYWARN_ALL_GCC([ws]) gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw]) ------------------------------------------------------------ revno: 110956 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2012-11-20 11:53:04 +0400 message: * xdisp.c (buffer_shared): Adjust comment. (buffer_shared_and_changed): New function. (prepare_menu_bars, redisplay_internal): Use it to decide whether all windows or frames should be updated. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-20 04:24:09 +0000 +++ src/ChangeLog 2012-11-20 07:53:04 +0000 @@ -1,3 +1,10 @@ +2012-11-20 Dmitry Antipov + + * xdisp.c (buffer_shared): Adjust comment. + (buffer_shared_and_changed): New function. + (prepare_menu_bars, redisplay_internal): Use it to + decide whether all windows or frames should be updated. + 2012-11-20 Stefan Monnier * eval.c (Finteractive_p, Fcalled_interactively_p, interactive_p): Remove. === modified file 'src/xdisp.c' --- src/xdisp.c 2012-11-14 11:13:33 +0000 +++ src/xdisp.c 2012-11-20 07:53:04 +0000 @@ -515,9 +515,8 @@ static int overlay_arrow_seen; -/* Number of windows showing the buffer of the selected window (or - another buffer with the same base buffer). keyboard.c refers to - this. */ +/* Number of windows showing the buffer of the selected + window (or another buffer with the same base buffer). */ int buffer_shared; @@ -10889,8 +10888,15 @@ return window_height_changed_p; } - - +/* True if the current buffer is shown in more than + one window and was modified since last display. */ + +static int +buffer_shared_and_changed (void) +{ + return (buffer_shared > 1 && UNCHANGED_MODIFIED < MODIFF); +} + /*********************************************************************** Mode Lines and Frame Titles ***********************************************************************/ @@ -11196,7 +11202,7 @@ /* Update the menu bar item lists, if appropriate. This has to be done before any actual redisplay or generation of display lines. */ all_windows = (update_mode_lines - || buffer_shared > 1 + || buffer_shared_and_changed () || windows_or_buffers_changed); if (all_windows) { @@ -13116,7 +13122,7 @@ if ((SAVE_MODIFF < MODIFF) != w->last_had_star) { w->update_mode_line = 1; - if (buffer_shared > 1) + if (buffer_shared_and_changed ()) update_mode_lines++; } @@ -13141,7 +13147,8 @@ /* The variable buffer_shared is set in redisplay_window and indicates that we redisplay a buffer in different windows. See there. */ - consider_all_windows_p = (update_mode_lines || buffer_shared > 1 + consider_all_windows_p = (update_mode_lines + || buffer_shared_and_changed () || cursor_type_changed); /* If specs for an arrow have changed, do thorough redisplay @@ -13433,7 +13440,7 @@ } CHARPOS (this_line_start_pos) = 0; - consider_all_windows_p |= buffer_shared > 1; + consider_all_windows_p |= buffer_shared_and_changed (); ++clear_face_cache_count; #ifdef HAVE_WINDOW_SYSTEM ++clear_image_cache_count; ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.