diff --git a/ChangeLog b/ChangeLog index cd31e9547215a55bdccbba24e36892ef60f1971a..33dafaaea4c8f48ab8ac1a2045656ac2f83e05ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/configure.ac b/configure.ac index 01fe72d1ee65521e3e13c9516237dca608842940..343a9e7cfb53bcac6553e2530a94b8abfae3255a 100644 --- a/configure.ac +++ b/configure.ac @@ -329,10 +329,15 @@ if test "${enableval}" != "no"; then 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" diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index dc5fa539cd1c7620586191f516c8a7c0749e1095..af22f0628d1e92bd712fa3e89e0df301374b7849 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -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). diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index b6ab4913f9c41e1fbef4b60c59f272e1224a323d..876c46bdf1a9f3e95457e49c08fddbce4e89b32f 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -213,59 +213,62 @@ entire current defun onto the screen if possible. @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 @@ the cursor is left at the edge instead.) @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 diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index a5295adc36830586ae1ee3e95bcafbd2649c679e..db896984c865fb9c0b2e571ea6cb2b4cc33efcf7 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -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. diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 11532b19781e108f41696e8f6bf4fe3d19d973c7..3439a8ae152f9adc8857557fb52d044bd9df8f0b 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi @@ -32,6 +32,9 @@ program. @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 @@ function (@pxref{Terminal Output}). * 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 @@ never return. If it ever does return, you get a run-time error. 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 diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index a70558bf09f7451fcd8bd0e6bdd1e32c24377ef1..cb00b5e9889a5af217932c45223f16701aee7d7c 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -617,6 +617,7 @@ Debugging Lisp Programs * 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 diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 2f06e207fc462fe37d0e6fc40cee99a771eb5be8..7552aaccc53bfebdc5af267a7c86f6b5a85e6be5 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1373,8 +1373,8 @@ on others, years as early as 1901 do work. @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 diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index 4336baa128fbbecc3df22c67b752d304cbabf998..bba416d5614115f93f4e3474951104f9b7a4e205 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -460,18 +460,8 @@ Lisp programs. @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. diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index b8581b1cc62d6445d4de8bdf4110d75d0c5d3e6f..e515b24db932a8521fa11c2923946b9d513f6f8c 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -2038,7 +2038,8 @@ Evaluating the form above will cause @code{display-buffer} to proceed as 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 diff --git a/etc/NEWS b/etc/NEWS index a66a3858e0ece487449b22f4dc710cbb5ea2abfc..090715587d37b7653f3906457c2727f73d418a83 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -847,7 +847,7 @@ are deprecated and will be removed eventually. ** 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. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3e35c8a9fcb42dd81d1793b08cef5ce73ebedc18..05f86ca22c0e542d834485c7fbecb7d795a9c516 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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. diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index b953a6fb2b0d87d029557d5f6af74f4bad74de9a..9cac659d848a6521cae14fb6a4a1a4bd2b84dda1 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el @@ -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: diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index ff00be7a2371b2c81af2414ab6113ad3df21dd4f..9cbf417d876ff33fbdcaf7e61f824c04d3605d24 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -388,16 +388,11 @@ DATA is displayed to the user and should state the reason of the failure." (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-"))) diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index aa8aae2d24535e9d6ff7c9502243a3152cd9f391..b4c86e39e86a2b1a5f296c501dee400c58477de9 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el @@ -297,6 +297,8 @@ to writing a completion function." (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 @@ to writing a completion function." (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) diff --git a/lisp/files.el b/lisp/files.el index 40eddec469b4ed039e71c2848dac0ee85aee3c3e..496f9bf8fa47fa7306a4130e16c3789f95258b4b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3433,7 +3433,7 @@ DIR is the name of the directory. 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.") diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index ec321d0050639342be52e2c0089b31444273a7dc..07da0b3dc16722f92d7e6e73f41824a1d45c1ae6 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1270,9 +1270,10 @@ target of the symlink differ." 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 @@ file names." (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 @@ file names." 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 @@ file names." ;; 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)) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index caaae5d553e5b3d54e1c5470746ef85e4615f8e9..d6f2177b03b5a56fa43381f902888ded23207abf 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3767,6 +3767,7 @@ Invokes `password-read' if available, `read-passwd' else." ("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 @@ Invokes `password-read' if available, `read-passwd' else." (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." diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 9e55976a8bd7f148a311ec5655213d26b7360a42..13cf7356e7ffb3758645718ab98101826a2d0e92 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el @@ -833,7 +833,8 @@ this is `comint-dynamic-complete-functions'." . ,(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)))))) diff --git a/lisp/ps-bdf.el b/lisp/ps-bdf.el index a82e03ceda7a8bed178055b7aec4dad0275db25f..477aee1b2daca5d594e4a01f8bd763f65fb9013d 100644 --- a/lisp/ps-bdf.el +++ b/lisp/ps-bdf.el @@ -70,20 +70,15 @@ for BDFNAME." (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 @@ FONT-INFO is a list of the following format: (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. diff --git a/lisp/simple.el b/lisp/simple.el index aed945d6e133eb8bd53dc241aa108801f5c2cac3..5867561da267d9a5aa0ebfa582dbdc57bdabfd89 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4583,6 +4583,9 @@ lines." (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) diff --git a/lisp/window.el b/lisp/window.el index d378ea5ff146563c655caaca6c5d21fe6f42a0e8..52909fa9e5fedcaed2892c73afa111a9798bd94b 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -5870,7 +5870,12 @@ the selected window or never appeared in it before, or if :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 diff --git a/nt/ChangeLog b/nt/ChangeLog index 4f9e8a2663c2f4e5f0131bf57ecfc82a807ebf65..0eda3a699d600486eb4d605a8a19183819a84262 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -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. diff --git a/nt/inc/stdint.h b/nt/inc/stdint.h index 5c53fa18b554a9447ec7e3bdd0922bbb063bdbed..97c9bbdaee90bfcedd1e0dc4bee985abd2702496 100644 --- a/nt/inc/stdint.h +++ b/nt/inc/stdint.h @@ -37,6 +37,7 @@ typedef unsigned __int64 uint64_t; #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 @@ typedef unsigned int uint32_t; #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 @@ typedef unsigned int uint32_t; #endif #define PTRDIFF_MAX INTPTR_MAX +#define PTRDIFF_MIN INTPTR_MIN #endif /* !__GNUC__ */ diff --git a/nt/nmake.defs b/nt/nmake.defs index 48809afc7716dc50aae7501715f76a3ebbfc61f6..16a787ea30a2cbd2028c7622d62d68beacbba378 100644 --- a/nt/nmake.defs +++ b/nt/nmake.defs @@ -116,7 +116,7 @@ RC_INCLUDE = -i 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 diff --git a/src/ChangeLog b/src/ChangeLog index 332656fcf00164926b4194f74507ce25d13c83c3..c16a4dc87ce37740f5493ed31bbad8ed44794470 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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'. diff --git a/src/emacs.c b/src/emacs.c index d69dbfda7bfbdccef80ff066a13233f69d058b55..b2b193e3a4fe013d03f366dad631c5cc893f771c 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -715,7 +715,7 @@ main (int argc, char **argv) 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 diff --git a/src/fileio.c b/src/fileio.c index 572f6d8ef832beff91be92e51b34de511c7d3423..e1a7cf55e280f8c7adaa2b84f65b82bc2e919ab5 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -315,6 +315,7 @@ Given a Unix syntax file name, returns a string ending in slash. */) register const char *beg; #else register char *beg; + Lisp_Object tem_fn; #endif register const char *p; Lisp_Object handler; @@ -374,10 +375,13 @@ Given a Unix syntax file name, returns a string ending in slash. */) 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 @@ filesystem tree, not (expand-file-name ".." dirname). */) #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 @@ filesystem tree, not (expand-file-name ".." dirname). */) target[0] = '/'; target[1] = ':'; } - dostounix_filename (target); -#endif /* DOS_NT */ - 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 @@ those `/' is discarded. */) 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); diff --git a/src/w32.c b/src/w32.c index 94cf472a4aeaffd1b597cb92f02522275f77c1b8..b51022c60013b0b560f8748d5274245a99389be7 100644 --- a/src/w32.c +++ b/src/w32.c @@ -119,9 +119,10 @@ typedef struct _PROCESS_MEMORY_COUNTERS_EX { #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 @@ typedef struct _REPARSE_DATA_BUFFER { } 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. */ diff --git a/src/w32term.h b/src/w32term.h index 83535b8faa3e00f9deb0e95fad6aa8f2f33b37e2..ce709c1231d87feebe7ab2a3658accfb6876b869 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -751,7 +751,7 @@ extern int w32_system_caret_y; 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