commit 439f3c3e567692b6823923d569a06ac206d1c3be (HEAD, refs/remotes/origin/master) Author: Katsumi Yamaoka Date: Tue Jul 19 07:34:54 2016 +0000 Make gif animation work (bug#24004) * lisp/image.el (image-animate-timeout): Fix the logic that tests if an animation is too big (bug#24004). diff --git a/lisp/image.el b/lisp/image.el index ad21936..08df7d4 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -792,9 +792,10 @@ If the image has a non-nil :speed property, it acts as a multiplier for the animation speed. A negative value means to animate in reverse." (when (and (buffer-live-p (plist-get (cdr image) :animate-buffer)) ;; Delayed more than two seconds more than expected. - (when (> (- (float-time) target-time) 2) - (message "Stopping animation; animation possibly too big") - nil)) + (or (<= (- (float-time) target-time) 2) + (progn + (message "Stopping animation; animation possibly too big") + nil))) (image-show-frame image n t) (let* ((speed (image-animate-get-speed image)) (time (float-time)) commit 99fe98d37a39d26f5dea424926d0e0a082655fe5 Author: Stefan Monnier Date: Mon Jul 18 21:04:39 2016 -0400 * lisp/simple.el (undo-amalgamate-change-group): New function * lisp/emulation/viper-cmd.el (viper-adjust-undo): Use it. (viper-set-complex-command-for-undo): Save current state with prepare-change-group. * lisp/emulation/viper-init.el (viper-undo-needs-adjustment) (viper-buffer-undo-list-mark): Remove. diff --git a/etc/NEWS b/etc/NEWS index 403a6b7..e01f180 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -458,6 +458,9 @@ function 'check-declare-errmsg' has been removed. * Lisp Changes in Emacs 25.2 +** New function undo-amalgamate-change-group to get rid of undo-boundaries +between two states. + ** New var `definition-prefixes' is a hashtable mapping prefixes to the files where corresponding definitions can be found. This can be used to fetch definitions that are not yet loaded, for example for `C-h f'. diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 3d9d1cc..3ce1b4d 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -1709,40 +1709,20 @@ invokes the command before that, etc." ;; The following two functions are used to set up undo properly. ;; In VI, unlike Emacs, if you open a line, say, and add a bunch of lines, ;; they are undone all at once. -(defun viper-adjust-undo () - (if viper-undo-needs-adjustment - (let ((inhibit-quit t) - tmp tmp2) - (setq viper-undo-needs-adjustment nil) - (when (listp buffer-undo-list) - (let ((had-boundary (null (car buffer-undo-list)))) - (if (setq tmp (memq viper-buffer-undo-list-mark buffer-undo-list)) - (progn - (setq tmp2 (cdr tmp)) ; the part after mark - - ;; cut tail from buffer-undo-list temporarily by direct - ;; manipulation with pointers in buffer-undo-list - (setcdr tmp nil) - - (setq buffer-undo-list (delq nil buffer-undo-list)) - (setq buffer-undo-list - (delq viper-buffer-undo-list-mark buffer-undo-list)) - ;; restore tail of buffer-undo-list - (setq buffer-undo-list (nconc buffer-undo-list tmp2))) - (setq buffer-undo-list (delq nil buffer-undo-list))) - ;; The top-level loop only adds boundaries if there has been - ;; modifications in the buffer, so make sure we don't accidentally - ;; drop the "final" boundary (bug#22295). - (if had-boundary (undo-boundary))))))) +(viper-deflocalvar viper--undo-change-group-handle nil) +(put 'viper--undo-change-group-handle 'permanent-local t) +(defun viper-adjust-undo () + (when viper--undo-change-group-handle + (undo-amalgamate-change-group + (prog1 viper--undo-change-group-handle + (setq viper--undo-change-group-handle nil))))) (defun viper-set-complex-command-for-undo () - (if (listp buffer-undo-list) - (if (not viper-undo-needs-adjustment) - (let ((inhibit-quit t)) - (setq buffer-undo-list - (cons viper-buffer-undo-list-mark buffer-undo-list)) - (setq viper-undo-needs-adjustment t))))) + (and (listp buffer-undo-list) + (not viper--undo-change-group-handle) + (setq viper--undo-change-group-handle + (prepare-change-group)))) ;;; Viper's destructive Command ring utilities diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index cd71925..ee09390 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -369,15 +369,6 @@ Use `\\[viper-set-expert-level]' to change this.") ;; VI-style Undo -;; Used to 'undo' complex commands, such as replace and insert commands. -(viper-deflocalvar viper-undo-needs-adjustment nil) -(put 'viper-undo-needs-adjustment 'permanent-local t) - -;; A mark that Viper puts on buffer-undo-list. Marks the beginning of a -;; complex command that must be undone atomically. If inserted, it is -;; erased by viper-change-state-to-vi and viper-repeat. -(defconst viper-buffer-undo-list-mark 'viper) - (defcustom viper-keep-point-on-undo nil "Non-nil means not to move point while undoing commands. This style is different from Emacs and Vi. Try it to see if diff --git a/lisp/simple.el b/lisp/simple.el index a757876..51c9100 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2958,6 +2958,41 @@ behavior." (undo-auto--boundary-ensure-timer)) ;; End auto-boundary section +(defun undo-amalgamate-change-group (handle) + "Amalgamate changes in change-group since HANDLE. +Remove all undo boundaries between the state of HANDLE and now. +HANDLE is as returned by `prepare-change-group'." + (dolist (elt handle) + (with-current-buffer (car elt) + (setq elt (cdr elt)) + (when (consp buffer-undo-list) + (let ((old-car (car-safe elt)) + (old-cdr (cdr-safe elt))) + (unwind-protect + (progn + ;; Temporarily truncate the undo log at ELT. + (when (consp elt) + (setcar elt t) (setcdr elt nil)) + (when + (or (null elt) ;The undo-log was empty. + ;; `elt' is still in the log: normal case. + (eq elt (last buffer-undo-list)) + ;; `elt' is not in the log any more, but that's because + ;; the log is "all new", so we should remove all + ;; boundaries from it. + (not (eq (last buffer-undo-list) (last old-cdr)))) + (cl-callf (lambda (x) (delq nil x)) + (if (car buffer-undo-list) + buffer-undo-list + ;; Preserve the undo-boundaries at either ends of the + ;; change-groups. + (cdr buffer-undo-list))))) + ;; Reset the modified cons cell ELT to its original content. + (when (consp elt) + (setcar elt old-car) + (setcdr elt old-cdr)))))))) + + (defcustom undo-ask-before-discard nil "If non-nil ask about discarding undo info for the current command. Normally, Emacs discards the undo info for the current command if commit 73f0715df53c6a12a3d9039ac1a1664d30c293ff Author: Noam Postavsky Date: Wed Jun 29 18:52:57 2016 -0400 Keep w32 environment settings internal only * src/emacs.c (main) [WINDOWSNT]: Move init_environment calls after the set_initial_environment call. This prevents Emacs' modifications to the environment from contaminating Vprocess_environment and Vinitial_environment (Bug #10980). * src/callproc.c (getenv_internal) [WINDOWSNT]: Consult Emacs' internal environment in as a fallback to Vprocess_environment. * test/src/callproc-tests.el (initial-environment-preserved): New Test. diff --git a/src/callproc.c b/src/callproc.c index 7008b91..e8d089c 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1375,6 +1375,20 @@ getenv_internal (const char *var, ptrdiff_t varlen, char **value, Vprocess_environment)) return *value ? 1 : 0; + /* On Windows we make some modifications to Emacs' enviroment + without recording them in Vprocess_environment. */ +#ifdef WINDOWSNT + { + char* tmpval = getenv (var); + if (tmpval) + { + *value = tmpval; + *valuelen = strlen (tmpval); + return 1; + } + } +#endif + /* For DISPLAY try to get the values from the frame or the initial env. */ if (strcmp (var, "DISPLAY") == 0) { diff --git a/src/emacs.c b/src/emacs.c index b221984..fa7ec01 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1349,16 +1349,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem globals_of_gfilenotify (); #endif -#ifdef WINDOWSNT - globals_of_w32 (); -#ifdef HAVE_W32NOTIFY - globals_of_w32notify (); -#endif - /* Initialize environment from registry settings. */ - init_environment (argv); - init_ntproc (dumping); /* must precede init_editfns. */ -#endif - #ifdef HAVE_NS /* Initialize the locale from user defaults. */ ns_init_locale (); @@ -1375,6 +1365,20 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem if (! dumping) set_initial_environment (); +#ifdef WINDOWSNT + globals_of_w32 (); +#ifdef HAVE_W32NOTIFY + globals_of_w32notify (); +#endif + /* Initialize environment from registry settings. Make sure to do + this only after calling set_initial_environment so that + Vinitial_environment and Vprocess_environment will contain only + variables from the parent process without modifications from + Emacs. */ + init_environment (argv); + init_ntproc (dumping); /* must precede init_editfns. */ +#endif + /* AIX crashes are reported in system versions 3.2.3 and 3.2.4 if this is not done. Do it after set_global_environment so that we don't pollute Vglobal_environment. */ diff --git a/test/src/callproc-tests.el b/test/src/callproc-tests.el new file mode 100644 index 0000000..46541ab --- /dev/null +++ b/test/src/callproc-tests.el @@ -0,0 +1,39 @@ +;;; callproc-tests.el --- callproc.c tests -*- lexical-binding: t -*- + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(eval-when-compile (require 'cl-lib)) + +(ert-deftest initial-environment-preserved () + "Check that `initial-environment' is not modified by Emacs (Bug #10980)." + (skip-unless (eq system-type 'windows-nt)) + (cl-destructuring-bind (initial-shell shell) + (with-temp-buffer + (let ((process-environment (cons "SHELL" process-environment))) + (call-process (expand-file-name invocation-name invocation-directory) + nil t nil + "--batch" "-Q" "--eval" + (prin1-to-string + '(progn (prin1 (getenv-internal "SHELL" initial-environment)) + (prin1 (getenv-internal "SHELL")))))) + (split-string-and-unquote (buffer-string))) + (should (equal initial-shell "nil")) + (should-not (equal initial-shell shell)))) commit 1879b9055eaf5c9f3fd126c2c21450cdd8c83262 Author: Nicolas Petton Date: Mon Jul 18 14:12:50 2016 +0200 Better documentation for cl-reduce (bug#24014) * lisp/emacs-lisp/cl-seq.el (cl-reduce): Explain what reducing means. diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el index 21aec6c..443a147 100644 --- a/lisp/emacs-lisp/cl-seq.el +++ b/lisp/emacs-lisp/cl-seq.el @@ -116,6 +116,16 @@ (defun cl-reduce (cl-func cl-seq &rest cl-keys) "Reduce two-argument FUNCTION across SEQ. \nKeywords supported: :start :end :from-end :initial-value :key + +Return the result of calling FUNCTION with the first and the +second element of SEQ, then calling FUNCTION with that result and +the third element of SEQ, then with that result and the fourth +element of SEQ, etc. + +If :INITIAL-VALUE is specified, it is added to the front of SEQ. +If SEQ is empty, return :INITIAL-VALUE and FUNCTION is not +called. + \n(fn FUNCTION SEQ [KEYWORD VALUE]...)" (cl--parsing-keywords (:from-end (:start 0) :end :initial-value :key) () (or (listp cl-seq) (setq cl-seq (append cl-seq nil)))