commit 551051596fe51d6e232315eeda8a0a79eb43bfdf (HEAD, refs/remotes/origin/master) Author: Philipp Stephani Date: Thu Jan 17 23:39:19 2019 +0100 Improve error data when passing a wrong type to 'sort' (Bug#34104) * src/fns.c (Fsort): Use 'list-or-vector-p' for error message. (syms_of_fns): Define 'list-or-vector-p'. * test/src/fns-tests.el (fns-tests-sort): Extend unit test. diff --git a/src/fns.c b/src/fns.c index 1ac60321c5..345211418c 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2084,7 +2084,7 @@ the second. */) else if (VECTORP (seq)) sort_vector (seq, predicate); else if (!NILP (seq)) - wrong_type_argument (Qsequencep, seq); + wrong_type_argument (Qlist_or_vector_p, seq); return seq; } @@ -5358,6 +5358,7 @@ Used by `featurep' and `require', and altered by `provide'. */); DEFSYM (Qsubfeatures, "subfeatures"); DEFSYM (Qfuncall, "funcall"); DEFSYM (Qplistp, "plistp"); + DEFSYM (Qlist_or_vector_p, "list-or-vector-p"); #ifdef HAVE_LANGINFO_CODESET DEFSYM (Qcodeset, "codeset"); diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 3d1a8b37b4..d6cc99e8e3 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -161,7 +161,10 @@ '(9 . "ppp") '(8 . "ttt") '(8 . "eee") '(9 . "fff")) (lambda (x y) (< (car x) (car y)))) [(8 . "xxx") (8 . "bbb") (8 . "ttt") (8 . "eee") - (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]))) + (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")])) + ;; Bug#34104 + (should (equal (should-error (sort "cba" #'<) :type 'wrong-type-argument) + '(wrong-type-argument list-or-vector-p "cba")))) (ert-deftest fns-tests-collate-sort () (skip-unless (fns-tests--collate-enabled-p)) commit 3e1255172334f3c0645d37eb92c05a628fa3d548 Author: Paul Eggert Date: Sat Jan 19 14:38:52 2019 -0800 pdumper-stats now returns s, not ms * doc/lispref/internals.texi (pdumper-stats): * src/pdumper.c (pdumper_load): Return seconds, not milliseconds. Minimize rounding errors in the usual case. diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 437657f243..06ff9f70bf 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -232,7 +232,7 @@ time it took to restore the Emacs state. The value is an alist @w{@code{((dumped-with-pdumper . t) (load-time . @var{time}) (dump-file-name . @var{file}))}}, where @var{file} is the name of the dump file, and @var{time} is the -time in milliseconds it took to restore the state from the dump file. +time in seconds it took to restore the state from the dump file. If the current session was not restored from a portable dump file, the value is nil. @end defun diff --git a/src/pdumper.c b/src/pdumper.c index 19a21329b1..4bbeabb828 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -5545,9 +5545,10 @@ pdumper_load (const char *dump_filename) struct timespec load_timespec = timespec_sub (current_timespec (), start_time); - dump_private.load_time = - (double) load_timespec.tv_sec * 1000.0 - + (double) load_timespec.tv_nsec * 0.000001; + ALLOW_IMPLICIT_CONVERSION; + double s = load_timespec.tv_sec, ns = load_timespec.tv_nsec; + DISALLOW_IMPLICIT_CONVERSION; + dump_private.load_time = (s * 1e9 + ns) / 1e9; dump_private.dump_filename = dump_filename_copy; dump_filename_copy = NULL; @@ -5569,7 +5570,7 @@ the return value is an alist of the form: ((dumped-with-pdumper . t) (load-time . TIME) (dump-file-name . FILE)) -where TIME is the time in milliseconds it took to restore Emacs state +where TIME is the time in seconds it took to restore Emacs state from the dump file, and FILE is the name of the dump file. Value is nil if this session was not started using a portable dump file.*/) (void) commit b821a70cb9467186afb55734a0e5cb4601909916 Author: Eli Zaretskii Date: Sat Jan 19 20:37:50 2019 +0200 ; Fix a recent change in pdumper.c * src/pdumper.c (Fpdumper_stats): Don't expand dump filename, as we don't record the directory relative to which it was specified. diff --git a/src/pdumper.c b/src/pdumper.c index 1c49167e02..19a21329b1 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -5581,18 +5581,21 @@ Value is nil if this session was not started using a portable dump file.*/) #ifdef WINDOWSNT char dump_fn_utf8[MAX_UTF8_PATH]; if (filename_from_ansi (dump_private.dump_filename, dump_fn_utf8) == 0) - dump_fn = DECODE_FILE (build_unibyte_string (dump_fn_utf8)); + { + dostounix_filename (dump_fn_utf8); + dump_fn = DECODE_FILE (build_unibyte_string (dump_fn_utf8)); + } else dump_fn = build_unibyte_string (dump_private.dump_filename); #else dump_fn = DECODE_FILE (build_unibyte_string (dump_private.dump_filename)); #endif - dump_fn = Fexpand_file_name (dump_fn, Qnil); - return CALLN (Flist, Fcons (Qdumped_with_pdumper, Qt), Fcons (Qload_time, make_float (dump_private.load_time)), + /* FIXME: dump_fn should be expanded relative to the + original pwd where Emacs started. */ Fcons (Qdump_file_name, dump_fn)); } commit 8e2b2a2b179c3ed170ad9de32a320e788c6a3a5e Author: Eli Zaretskii Date: Sat Jan 19 20:21:25 2019 +0200 Minor cleanup in pdumper.c * src/pdumper (subtract_timespec): Function removed. (pdumper_load): Use timespec_sub instead of subtract_timespec. diff --git a/src/pdumper.c b/src/pdumper.c index b51a3797dd..1c49167e02 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -5388,15 +5388,6 @@ enum dump_section NUMBER_DUMP_SECTIONS, }; -/* Subtract two timespecs, yielding a difference in milliseconds. */ -static double -subtract_timespec (struct timespec minuend, struct timespec subtrahend) -{ - return - 1000.0 * (double)(minuend.tv_sec - subtrahend.tv_sec) - + (double)(minuend.tv_nsec - subtrahend.tv_nsec) / 1.0e6; -} - /* Load a dump from DUMP_FILENAME. Return an error code. N.B. We run very early in initialization, so we can't use lisp, @@ -5552,8 +5543,11 @@ pdumper_load (const char *dump_filename) dump_hooks[i] (); initialized = true; - dump_private.load_time = subtract_timespec ( - current_timespec (), start_time); + struct timespec load_timespec = + timespec_sub (current_timespec (), start_time); + dump_private.load_time = + (double) load_timespec.tv_sec * 1000.0 + + (double) load_timespec.tv_nsec * 0.000001; dump_private.dump_filename = dump_filename_copy; dump_filename_copy = NULL; commit 8bb5939efaf61eb0dc944eff5023d3f2e6ff85a7 Author: Eli Zaretskii Date: Sat Jan 19 20:09:38 2019 +0200 Improve 'pdumper-stats' and its documentation * src/pdumper.c (Fpdumper_stats): Improve formatting and wording of the doc string. Decode the pdump file name and expand-file-name it. * doc/lispref/internals.texi (Building Emacs): Document 'pdumper-stats'. diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 66606da6ec..437657f243 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -225,6 +225,18 @@ Emacs was built without @code{unexec} support, this function will not be available. @end defun +@defun pdumper-stats +If the current Emacs session restored its state from a portable dump +file, this function returns information about the dump file and the +time it took to restore the Emacs state. The value is an alist +@w{@code{((dumped-with-pdumper . t) (load-time . @var{time}) +(dump-file-name . @var{file}))}}, +where @var{file} is the name of the dump file, and @var{time} is the +time in milliseconds it took to restore the state from the dump file. +If the current session was not restored from a portable dump file, the +value is nil. +@end defun + @node Pure Storage @section Pure Storage @cindex pure storage diff --git a/src/pdumper.c b/src/pdumper.c index cd242f7dc9..b51a3797dd 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -5568,23 +5568,38 @@ pdumper_load (const char *dump_filename) return err; } -DEFUN ("pdumper-stats", - Fpdumper_stats, Spdumper_stats, - 0, 0, 0, - doc: /* Return an alist of statistics about dump file that - started this Emacs, if any. Nil if this Emacs was not - started using a portable dumper dump file.*/) +DEFUN ("pdumper-stats", Fpdumper_stats, Spdumper_stats, 0, 0, 0, + doc: /* Return statistics about portable dumping used by this session. +If this Emacs sesion was started from a portable dump file, +the return value is an alist of the form: + + ((dumped-with-pdumper . t) (load-time . TIME) (dump-file-name . FILE)) + +where TIME is the time in milliseconds it took to restore Emacs state +from the dump file, and FILE is the name of the dump file. +Value is nil if this session was not started using a portable dump file.*/) (void) { if (!dumped_with_pdumper_p ()) return Qnil; - return CALLN ( - Flist, - Fcons (Qdumped_with_pdumper, Qt), - Fcons (Qload_time, make_float (dump_private.load_time)), - Fcons (Qdump_file_name, - build_unibyte_string (dump_private.dump_filename))); + Lisp_Object dump_fn; +#ifdef WINDOWSNT + char dump_fn_utf8[MAX_UTF8_PATH]; + if (filename_from_ansi (dump_private.dump_filename, dump_fn_utf8) == 0) + dump_fn = DECODE_FILE (build_unibyte_string (dump_fn_utf8)); + else + dump_fn = build_unibyte_string (dump_private.dump_filename); +#else + dump_fn = DECODE_FILE (build_unibyte_string (dump_private.dump_filename)); +#endif + + dump_fn = Fexpand_file_name (dump_fn, Qnil); + + return CALLN (Flist, + Fcons (Qdumped_with_pdumper, Qt), + Fcons (Qload_time, make_float (dump_private.load_time)), + Fcons (Qdump_file_name, dump_fn)); } #endif /* HAVE_PDUMPER */ commit 436c225f1b8ca48fa7c7e769fe6b7055f37af95d Author: Eli Zaretskii Date: Sat Jan 19 13:32:59 2019 +0200 Unbreak the macOS NS build * src/xdisp.c (expose_window_tree): Declare and define 'f' on NS as well. Reported by Herbert J. Skuhra . diff --git a/src/xdisp.c b/src/xdisp.c index 867e5db69b..ec8dd86230 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -32405,9 +32405,7 @@ expose_window (struct window *w, XRectangle *fr) static bool expose_window_tree (struct window *w, XRectangle *r) { -#ifndef HAVE_NS struct frame *f = XFRAME (w->frame); -#endif bool mouse_face_overwritten_p = false; while (w && !FRAME_GARBAGED_P (f)) commit 8198d4be6b219b3f186297d2917756a1f64d2ad7 Author: Dmitry Gutov Date: Sat Jan 19 03:57:58 2019 +0300 ; Update the commentary diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 754659d6c9..3603e751fe 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -45,8 +45,9 @@ ;; ;; Commands: ;; -;; `project-find-regexp' and `project-or-external-find-regexp' use the -;; current API, and thus will work in any project that has an adapter. +;; `project-find-file', `project-find-regexp' and +;; `project-or-external-find-regexp' use the current API, and thus +;; will work in any project that has an adapter. ;;; TODO: @@ -54,9 +55,6 @@ ;; filenotify.el (if supported) to invalidate. And avoiding caching ;; if it's not available (manual cache invalidation is not nice). ;; -;; * Allow the backend to override the file-listing logic? Maybe also -;; to delegate file name completion to an external tool. -;; ;; * Build tool related functionality. Start with a `project-build' ;; command, which should provide completions on tasks to run, and ;; maybe allow entering some additional arguments. This might commit b6af090022a7a94202e2a6e86605e1466794c224 Author: Dmitry Gutov Date: Sat Jan 19 03:46:07 2019 +0300 Misc ignore-related project.el changes * lisp/progmodes/project.el (project-ignores): Don't append the default ignores list, just use vc-directory-exclusion-list. (project--dir-ignores): Use the default ignores if the dir is outside of the current project. (project-files): Use project--dir-ignores to support external roots better. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index f795c36fa0..754659d6c9 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -184,7 +184,8 @@ to find the list of ignores for each directory." (require 'xref) (cl-mapcan (lambda (dir) - (project--files-in-directory dir (project-ignores project dir))) + (project--files-in-directory dir + (project--dir-ignores project dir))) (or dirs (project-roots project)))) (defun project--files-in-directory (dir ignores &optional files) @@ -283,7 +284,10 @@ backend implementation of `project-external-roots'.") entry)) (vc-call-backend backend 'ignore-completion-table root))) (project--value-in-dir 'project-vc-ignores root) - (cl-call-next-method)))) + (mapcar + (lambda (dir) + (concat dir "/")) + vc-directory-exclusion-list)))) (defun project-combine-directories (&rest lists-of-dirs) "Return a sorted and culled list of directory names. @@ -346,7 +350,8 @@ requires quoting, e.g. `\\[quoted-insert]'." (defun project--dir-ignores (project dir) (let* ((roots (project-roots project)) (root (cl-find dir roots :test #'file-in-directory-p))) - (when root + (if (not root) + (project-ignores nil nil) ;The defaults. (let ((ignores (project-ignores project root))) (if (file-equal-p root dir) ignores commit 7717778e8b1a04c51e49a15481257ef0ae385d62 Author: João Távora Date: Fri Jan 18 22:26:29 2019 +0000 Revert "Remove leftover from previous electric-layout-rules API" This is a backward-incompatible change, and removing it isn't really necessary. This reverts commit 942dad2b519cabddf6caea7641517507dc06944b. diff --git a/lisp/electric.el b/lisp/electric.el index e2f9f70743..f2061c2f52 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -414,6 +414,7 @@ If multiple rules match, only first one is executed.") ;; Not in a string or comment. (not (nth 8 (save-excursion (syntax-ppss pos))))) (goto-char pos) + (when (functionp rule) (setq rule (funcall rule))) (dolist (sym (if (symbolp rule) (list rule) rule)) (let* ((nl-after (lambda () commit 78725e49d2802d907c5b54417e6a91ed868c7c6e Author: Stefan Monnier Date: Fri Jan 18 17:20:21 2019 -0500 (electric-layout-post-self-insert-function-1): Simplify. Call electric--after-char-pos right from the start, and take advantage of the fact that it guarantees to return the right position or nil. diff --git a/lisp/electric.el b/lisp/electric.el index 6977a95034..e2f9f70743 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -394,28 +394,23 @@ If multiple rules match, only first one is executed.") ;; for edebug's sake, a separate function (defun electric-layout-post-self-insert-function-1 () - (let* (pos + (let* ((pos (electric--after-char-pos)) probe (rules electric-layout-rules) (rule (catch 'done - (while (setq probe (pop rules)) - (cond ((and (consp probe) - (eq (car probe) last-command-event)) - (throw 'done (cdr probe))) - ((functionp probe) - (let ((res - (save-excursion - (goto-char - (or pos (setq pos (electric--after-char-pos)))) - ;; Ensure probe is called at the - ;; promised place. FIXME: maybe warn if - ;; it isn't - (when (eq (char-before) last-command-event) - (funcall probe last-command-event))))) - (when res (throw 'done res))))))))) + (when pos + (while (setq probe (pop rules)) + (cond ((and (consp probe) + (eq (car probe) last-command-event)) + (throw 'done (cdr probe))) + ((functionp probe) + (let ((res + (save-excursion + (goto-char pos) + (funcall probe last-command-event)))) + (when res (throw 'done res)))))))))) (when (and rule - (or pos (setq pos (electric--after-char-pos))) ;; Not in a string or comment. (not (nth 8 (save-excursion (syntax-ppss pos))))) (goto-char pos) commit 0621591687c6f032077213e85280936e35e45af0 Author: João Távora Date: Fri Jan 18 22:05:36 2019 +0000 Ensure fns in electric-layout-rules are called in right position * lisp/electric.el (electric-layout-rules): Ensure rules are called from right spot. diff --git a/lisp/electric.el b/lisp/electric.el index 4791f8e18c..6977a95034 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -383,8 +383,8 @@ in the same place. Instead of the (CHAR . WHERE) form, a rule can also be just a function of a single argument, the character just inserted. It -should return a value compatible with WHERE if the rule matches, -or nil if it doesn't match. +is called at that position, and should return a value compatible with +WHERE if the rule matches, or nil if it doesn't match. If multiple rules match, only first one is executed.") @@ -408,7 +408,11 @@ If multiple rules match, only first one is executed.") (save-excursion (goto-char (or pos (setq pos (electric--after-char-pos)))) - (funcall probe last-command-event)))) + ;; Ensure probe is called at the + ;; promised place. FIXME: maybe warn if + ;; it isn't + (when (eq (char-before) last-command-event) + (funcall probe last-command-event))))) (when res (throw 'done res))))))))) (when (and rule (or pos (setq pos (electric--after-char-pos))) commit 942dad2b519cabddf6caea7641517507dc06944b Author: João Távora Date: Fri Jan 18 21:54:48 2019 +0000 Remove leftover from previous electric-layout-rules API An element of electric-layout-rules is either a function or a pair (CHAR . WHERE), and WHERE can't be a function anymore. * lisp/electric.el (electric-layout-post-self-insert-function-1): Remove leftover line. diff --git a/lisp/electric.el b/lisp/electric.el index e7ebdf5739..4791f8e18c 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -415,7 +415,6 @@ If multiple rules match, only first one is executed.") ;; Not in a string or comment. (not (nth 8 (save-excursion (syntax-ppss pos))))) (goto-char pos) - (when (functionp rule) (setq rule (funcall rule))) (dolist (sym (if (symbolp rule) (list rule) rule)) (let* ((nl-after (lambda () commit 7818bcdd6cd6e2fbc0b0efb35d3bb6588752c5a4 Author: Paul Eggert Date: Fri Jan 18 13:03:47 2019 -0800 Port to platforms where NULL is a pointer * src/image.c (x_create_x_image_and_pixmap): The Picture type is an integer, not a pointer. Come to think of it, Picture is really XID, and as far as I can tell, all-bits-one is the invalid XID, not all-bits-zero. However that is a bigger issue; for now, this patch just unbreaks the build. diff --git a/src/image.c b/src/image.c index e4b097588a..bcc61dfccd 100644 --- a/src/image.c +++ b/src/image.c @@ -2200,7 +2200,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, else { image_error ("Specified image bit depth is not supported by XRender"); - *picture = NULL; + *picture = 0; } } # endif commit 6bac9ea1770c0954adf5f4af660e94b5a0b09003 (refs/remotes/origin/scratch/resolve-cc-mode-and-e-p-m) Author: Eli Zaretskii Date: Fri Jan 18 17:58:47 2019 +0200 Improve documentation of portable dumping * src/pdumper.c (Fdump_emacs_portable): Improve the doc string and the error messages. * doc/lispref/internals.texi (Building Emacs): Document portable dumping and the 'dump-emacs-portable' function. diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index d7c1fb7e42..66606da6ec 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -48,24 +48,63 @@ environment. After this step, the Emacs executable is no longer @dfn{bare}. @cindex dumping Emacs +@cindex @option{--temacs} option, and dumping method Because it takes some time to load the standard Lisp files, the @file{temacs} executable usually isn't run directly by users. -Instead, as one of the last steps of building Emacs, the command -@samp{temacs -batch -l loadup dump} is run. The special @samp{dump} -argument causes @command{temacs} to dump out an executable program, -called @file{emacs}, which has all the standard Lisp files preloaded. -(The @samp{-batch} argument prevents @file{temacs} from trying to -initialize any of its data on the terminal, so that the tables of -terminal information are empty in the dumped Emacs.) +Instead, one of the last steps of building Emacs runs the command +@w{@samp{temacs -batch -l loadup --temacs=@var{dump-method}}}. The +special option @option{--temacs} tells @command{temacs} how to record +all the standard preloaded Lisp functions and variables, so that when +you subsequently run Emacs, it will start much faster. The +@option{--temacs} option requires an argument @var{dump-method}, which +can be one of the following: + +@table @samp +@item pdump +@cindex portable dump file +Record the preloaded Lisp data in a @dfn{portable dump} file. This +method produces an additional data file which Emacs will load at +startup. The portable dump file is usually called @file{emacs.pdmp}, +and is installed in the Emacs @code{data-directory} (@pxref{Help +Functions}). This method is the most preferred one, as it does not +require Emacs to employ any special techniques of memory allocation, +which might get in the way of various memory-layout techniques used by +modern systems to enhance security and privacy. + +@item pbootstrap +@cindex bootstrapping Emacs +Like @samp{pdump}, but used while @dfn{bootstrapping} Emacs, when no +previous Emacs binary and no @file{*.elc} byte-compiled Lisp files are +available. The produced portable dump file is usually named +@file{bootstrap-emacs.pdmp} in this case. + +@item dump +@cindex unexec +This method causes @command{temacs} to dump out an executable program, +called @file{emacs}, which has all the standard Lisp files already +preloaded into it. (The @samp{-batch} argument prevents +@command{temacs} from trying to initialize any of its data on the +terminal, so that the tables of terminal information are empty in the +dumped Emacs.) This method is also known as @dfn{unexec}, because it +produces a program file from a running process, and thus is in some +sense the opposite of executing a program to start a process. + +@item bootstrap +Like @samp{dump}, but used when bootstrapping Emacs with the +@code{unexec} method. +@end table @cindex preloaded Lisp files @vindex preloaded-file-list The dumped @file{emacs} executable (also called a @dfn{pure} Emacs) -is the one which is installed. The variable -@code{preloaded-file-list} stores a list of the Lisp files preloaded -into the dumped Emacs. If you port Emacs to a new operating system, -and are not able to implement dumping, then Emacs must load -@file{loadup.el} each time it starts. +is the one which is installed. If the portable dumping was used to +build Emacs, the @file{emacs} executable is actually an exact copy of +@file{temacs}, and the corresponding @file{emacs.pdmp} file is +installed as well. The variable @code{preloaded-file-list} stores a +list of the preloaded Lisp files recorded in the portable dump file or +in the dumped Emacs executable. If you port Emacs to a new operating +system, and are not able to implement dumping of any kind, then Emacs +must load @file{loadup.el} each time it starts. @cindex build details @cindex deterministic build @@ -161,14 +200,29 @@ In the unlikely event that you need a more general functionality than @code{custom-initialize-delay} provides, you can use @code{before-init-hook} (@pxref{Startup Summary}). +@defun dump-emacs-portable to-file &optional track-referrers +This function dumps the current state of Emacs into a portable dump +file @var{to-file}, using the @code{pdump} method. Normally, the +portable dump file is called @file{@var{emacs-name}.dmp}, where +@var{emacs-name} is the name of the Emacs executable file. The +optional argument @var{track-referrers}, if non-@code{nil}, causes the +portable dumping process keep additional information to help track +down the provenance of object types that are not yet supported by the +@code{pdump} method. + +If you want to use this function in an Emacs that was already dumped, +you must run Emacs with the @samp{-batch} option. +@end defun + @defun dump-emacs to-file from-file @cindex unexec This function dumps the current state of Emacs into an executable file -@var{to-file}. It takes symbols from @var{from-file} (this is normally -the executable file @file{temacs}). +@var{to-file}, using the @code{unexec} method. It takes symbols from +@var{from-file} (this is normally the executable file @file{temacs}). -If you want to use this function in an Emacs that was already dumped, -you must run Emacs with @samp{-batch}. +This function cannot be used in an Emacs that was already dumped. If +Emacs was built without @code{unexec} support, this function will not +be available. @end defun @node Pure Storage diff --git a/src/pdumper.c b/src/pdumper.c index db66e1ba26..cd242f7dc9 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -4033,7 +4033,7 @@ dump_drain_deferred_symbols (struct dump_context *ctx) DEFUN ("dump-emacs-portable", Fdump_emacs_portable, Sdump_emacs_portable, 1, 2, 0, - doc: /* Dump current state of Emacs into dump file FILENAME. + doc: /* Dump current state of Emacs into portable dump file FILENAME. If TRACK-REFERRERS is non-nil, keep additional debugging information that can help track down the provenance of unsupported object types. */) @@ -4048,10 +4048,10 @@ types. */) "unexpected results."); if (!main_thread_p (current_thread)) - error ("Function can be called only on main thread"); + error ("This function can be called only in the main thread"); if (!NILP (XCDR (Fall_threads ()))) - error ("No other threads can be running"); + error ("No other Lisp threads can be running when this function is called"); /* Clear out any detritus in memory. */ do { commit 957090b79531fbd7729e5d28c3496b9114c1f543 Merge: 5e3b0f5239 b6d78a0d80 Author: Glenn Morris Date: Fri Jan 18 07:50:47 2019 -0800 Merge from origin/emacs-26 b6d78a0 (origin/emacs-26) Fix a typo in ELisp manual c9f6f86 Prevent redrawing if frame is garbaged 00ba226 Attempt to fix hangs on MS-Windows due to C-g b26d637 Fix Calc graph output on MS-Windows 03818b0 Fix a minor mistake in ELisp manual 6ac5985 ; Fix some trivial doc typos 21b9026 * etc/tutorials/TUTORIAL: Fix typo (bug#34049) d223727 Fix UI of Buffer-menu 0f71655 Reinitialize ispell-really-enchant when changing the speller 9845044 Speed up loading css-mode commit 5e3b0f5239027a413775d375f04376a3c97d0bf9 Author: Eli Zaretskii Date: Fri Jan 18 17:04:00 2019 +0200 Clean up memory allocation and unexec support on MS-Windows * src/w32heap.c (report_temacs_memory_usage): Condition on !CANNOT_DUMP, in addition to ENABLE_CHECKING. (init_heap): Accept an argument, which tells us what heap allocation method to use. (DUMPED_HEAP_SIZE) [CANNOT_DUMP]: Define to a small value, as we don't use dumped_data[] in this case. * src/w32heap.h (init_heap): Adjust prototype. : Remove declaration. * src/emacs.c (main) [WINDOWSNT]: Determine heap allocation method based on whether we are in temacs and whether unexec will be used to dump Emacs. Pass the heap allocation method to init_heap, which is now called after parsing the --temacs=METHOD option. * src/unexw32.c (unexec): Don't fiddle with using_dynamic_heap. : Remove definition. * src/w32proc.c (malloc_before_init, realloc_before_init) (free_before_init): New functions, to catch memory allocation before heap allocation method is set up. diff --git a/src/emacs.c b/src/emacs.c index 834f55b6f3..b9f5039724 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -871,8 +871,25 @@ main (int argc, char **argv) #endif #if defined WINDOWSNT || defined HAVE_NTGUI + /* Grab our malloc arena space now, before anything important + happens. This relies on the static heap being needed only in + temacs and only if we are going to dump with unexec. */ + bool use_dynamic_heap = false; + if (strstr (argv[0], "temacs") != NULL) + { + eassert (temacs); + /* Note that gflags are set at this point only if we have been + called with the --temacs=METHOD option. We assume here that + temacs is always called that way, otherwise the functions + that rely on gflags, like will_dump_with_pdumper_p below, + will not do their job. */ + use_dynamic_heap = will_dump_with_pdumper_p (); + } + else + use_dynamic_heap = true; + init_heap (use_dynamic_heap); /* Set global variables used to detect Windows version. Do this as - early as possible. (unexw32.c calls this function as well, but + early as possible. (w32proc.c calls this function as well, but the additional call here is harmless.) */ cache_system_info (); #ifdef WINDOWSNT diff --git a/src/unexw32.c b/src/unexw32.c index 6fa0fa055a..59feaa74b9 100644 --- a/src/unexw32.c +++ b/src/unexw32.c @@ -45,9 +45,6 @@ extern char *my_begbss_static; #include "w32heap.h" -/* Basically, our "initialized" flag. */ -BOOL using_dynamic_heap = FALSE; - void get_section_info (file_data *p_file); void copy_executable_and_dump_data (file_data *, file_data *); void dump_bss_and_heap (file_data *p_infile, file_data *p_outfile); @@ -649,15 +646,8 @@ unexec (const char *new_name, const char *old_name) exit (1); } - /* Set the flag (before dumping). */ - using_dynamic_heap = TRUE; - copy_executable_and_dump_data (&in_file, &out_file); - /* Unset it because it is plain wrong to keep it after dumping. - Malloc can still occur! */ - using_dynamic_heap = FALSE; - /* Patch up header fields; profiler is picky about this. */ { PIMAGE_DOS_HEADER dos_header; diff --git a/src/w32heap.c b/src/w32heap.c index 3de8f245cc..8a2c1b5877 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -28,7 +28,7 @@ Memory allocation scheme for w32/w64: - Buffers are mmap'ed using a very simple emulation of mmap/munmap - - During the temacs phase: + - During the temacs phase, if unexec is to be used: * we use a private heap declared to be stored into the `dumped_data' * unfortunately, this heap cannot be made growable, so the size of blocks it can allocate is limited to (0x80000 - pagesize) @@ -37,7 +37,7 @@ We use a very simple first-fit scheme to reuse those blocks. * we check that the private heap does not cross the area used by the bigger chunks. - - During the emacs phase: + - During the emacs phase, or always if pdumper is used: * we create a private heap for new memory blocks * we make sure that we never free a block that has been dumped. Freeing a dumped block could work in principle, but may prove @@ -115,10 +115,16 @@ typedef struct _RTL_HEAP_PARAMETERS { than half of the size stated below. It would be nice to find a way to build only the first bootstrap-emacs.exe with the large size, and reset that to a lower value afterwards. */ -#if defined _WIN64 || defined WIDE_EMACS_INT -# define DUMPED_HEAP_SIZE (23*1024*1024) +#ifdef CANNOT_DUMP +/* We don't use dumped_data[] when CANNOT_DUMP, so define to a small + size that won't matter. */ +# define DUMPED_HEAP_SIZE 10 #else -# define DUMPED_HEAP_SIZE (13*1024*1024) +# if defined _WIN64 || defined WIDE_EMACS_INT +# define DUMPED_HEAP_SIZE (23*1024*1024) +# else +# define DUMPED_HEAP_SIZE (13*1024*1024) +# endif #endif static unsigned char dumped_data[DUMPED_HEAP_SIZE]; @@ -173,8 +179,8 @@ static DWORD blocks_number = 0; static unsigned char *bc_limit; /* Handle for the private heap: - - inside the dumped_data[] array before dump, - - outside of it after dump. + - inside the dumped_data[] array before dump with unexec, + - outside of it after dump, or always if pdumper is used. */ HANDLE heap = NULL; @@ -188,8 +194,8 @@ free_fn the_free_fn; http://stackoverflow.com/questions/307060/what-is-the-purpose-of-allocating-pages-in-the-pagefile-with-createfilemapping */ /* This is the function to commit memory when the heap allocator - claims for new memory. Before dumping, we allocate space - from the fixed size dumped_data[] array. + claims for new memory. Before dumping with unexec, we allocate + space from the fixed size dumped_data[] array. */ static NTSTATUS NTAPI dumped_data_commit (PVOID Base, PVOID *CommitAddress, PSIZE_T CommitSize) @@ -223,22 +229,14 @@ typedef enum _HEAP_INFORMATION_CLASS { typedef WINBASEAPI BOOL (WINAPI * HeapSetInformation_Proc)(HANDLE,HEAP_INFORMATION_CLASS,PVOID,SIZE_T); #endif -#ifdef HAVE_PDUMPER -BOOL using_dynamic_heap = FALSE; -#endif - void -init_heap (void) +init_heap (bool use_dynamic_heap) { -#ifdef HAVE_PDUMPER - using_dynamic_heap = TRUE; -#endif - if (using_dynamic_heap) + /* FIXME: Remove the condition, the 'else' branch below, and all the + related definitions and code, including dumped_data[], when unexec + support is removed from Emacs. */ + if (use_dynamic_heap) { -#ifndef MINGW_W64 - unsigned long enable_lfh = 2; -#endif - /* After dumping, use a new private heap. We explicitly enable the low fragmentation heap (LFH) here, for the sake of pre Vista versions. Note: this will harmlessly fail on Vista and @@ -255,6 +253,7 @@ init_heap (void) heap = HeapCreate (0, 0, 0); #ifndef MINGW_W64 + unsigned long enable_lfh = 2; /* Set the low-fragmentation heap for OS before Vista. */ HMODULE hm_kernel32dll = LoadLibrary ("kernel32.dll"); HeapSetInformation_Proc s_pfn_Heap_Set_Information = @@ -283,7 +282,7 @@ init_heap (void) the_free_fn = free_after_dump; } } - else + else /* Before dumping with unexec: use static heap. */ { /* Find the RtlCreateHeap function. Headers for this function are provided with the w32 DDK, but the function is available @@ -362,6 +361,8 @@ malloc_after_dump (size_t size) return p; } +/* FIXME: The *_before_dump functions should be removed when pdumper + becomes the only dumping method. */ void * malloc_before_dump (size_t size) { @@ -596,7 +597,7 @@ free_after_dump_9x (void *ptr) } } -#ifdef ENABLE_CHECKING +#if !defined (CANNOT_DUMP) && defined (ENABLE_CHECKING) void report_temacs_memory_usage (void) { diff --git a/src/w32heap.h b/src/w32heap.h index 6b9dca38a3..13f7a6325b 100644 --- a/src/w32heap.h +++ b/src/w32heap.h @@ -31,7 +31,6 @@ along with GNU Emacs. If not, see . extern unsigned char *get_data_start (void); extern unsigned char *get_data_end (void); extern size_t reserved_heap_size; -extern BOOL using_dynamic_heap; extern void *mmap_realloc (void **, size_t); extern void mmap_free (void **); @@ -43,7 +42,7 @@ extern void report_temacs_memory_usage (void); extern void *sbrk (ptrdiff_t size); /* Initialize heap structures for sbrk on startup. */ -extern void init_heap (void); +extern void init_heap (bool); /* ----------------------------------------------------------------- */ /* Useful routines for manipulating memory-mapped files. */ diff --git a/src/w32proc.c b/src/w32proc.c index a5d08f6011..05e6c46b33 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -81,6 +81,36 @@ static sigset_t sig_mask; static CRITICAL_SECTION crit_sig; +/* Catch memory allocation before the heap allocation scheme is set + up. These functions should never be called, unless code is added + early on in 'main' that runs before init_heap is called. */ +_Noreturn void * malloc_before_init (size_t); +_Noreturn void * realloc_before_init (void *, size_t); +_Noreturn void free_before_init (void *); + +_Noreturn void * +malloc_before_init (size_t size) +{ + fprintf (stderr, + "error: 'malloc' called before setting up heap allocation; exiting.\n"); + exit (-1); +} + +_Noreturn void * +realloc_before_init (void *ptr, size_t size) +{ + fprintf (stderr, + "error: 'realloc' called before setting up heap allocation; exiting.\n"); + exit (-1); +} + +_Noreturn void +free_before_init (void *ptr) +{ + fprintf (stderr, + "error: 'free' called before setting up heap allocation; exiting.\n"); + exit (-1); +} extern BOOL ctrl_c_handler (unsigned long type); @@ -110,12 +140,13 @@ _start (void) DebugBreak (); #endif + the_malloc_fn = malloc_before_init; + the_realloc_fn = realloc_before_init; + the_free_fn = free_before_init; + /* Cache system info, e.g., the NT page size. */ cache_system_info (); - /* Grab our malloc arena space now, before CRT starts up. */ - init_heap (); - /* This prevents ctrl-c's in shells running while we're suspended from having us exit. */ SetConsoleCtrlHandler ((PHANDLER_ROUTINE) ctrl_c_handler, TRUE); commit f943409183559b0af0e89f52bf0a93f8431c2dcf Author: Eli Zaretskii Date: Fri Jan 18 11:56:47 2019 +0200 ; * etc/NEWS: Fix description of pdumper. diff --git a/etc/NEWS b/etc/NEWS index 10bcc5a2ec..9d91a30a58 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -67,9 +67,9 @@ Randomization (ASLR) feature, a security technique used by most modern operating systems. Portable dumping can be disabled at configure time via the configure -option '--with-pdumper=no' (but we don't recommend that, unless the -portable dumping doesn't work on your system for some reason---please -report such systems to the Emacs developers as bugs). +option '--with-dumping=unexec' (but we don't recommend that, unless +the portable dumping doesn't work on your system for some +reason---please report such systems to the Emacs developers as bugs). When built with the portable dumping support (which is the default), Emacs looks for the 'emacs.pdmp' file, generated during the build, in commit b6d78a0d8019a92f94ce3fc41ddb0886f8b70d85 Author: Eli Zaretskii Date: Fri Jan 18 10:51:57 2019 +0200 Fix a typo in ELisp manual * doc/lispref/nonascii.texi (Converting Representations): Fix inconsistency between @defun and the argument description of 'byte-to-string'. (Bug#34119) diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi index ab15ea7d9b..66d12033d8 100644 --- a/doc/lispref/nonascii.texi +++ b/doc/lispref/nonascii.texi @@ -287,12 +287,11 @@ unibyte string, it is returned unchanged. Use this function for characters. @end defun -@c FIXME: Should '@var{character}' be '@var{byte}'? @defun byte-to-string byte @cindex byte to string This function returns a unibyte string containing a single byte of -character data, @var{character}. It signals an error if -@var{character} is not an integer between 0 and 255. +character data, @var{byte}. It signals an error if @var{byte} is not +an integer between 0 and 255. @end defun @defun multibyte-char-to-unibyte char commit c9f6f86814165ae277fe1618135151d0cdf84b8e Author: Alan Third Date: Fri Jan 11 16:52:59 2019 +0000 Prevent redrawing if frame is garbaged * src/nsterm.m ([EmacsView viewWillDraw]): Cancel drawing if the frame has been garbaged. * src/xdisp.c (expose_window_tree, expose_frame): Remove NS only exceptions. diff --git a/src/nsterm.m b/src/nsterm.m index c09f684daf..bbd2c84214 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -8077,6 +8077,14 @@ - (instancetype)toggleToolbar: (id)sender } +- (void)viewWillDraw +{ + /* If the frame has been garbaged there's no point in redrawing + anything. */ + if (FRAME_GARBAGED_P (emacsframe)) + [self setNeedsDisplay:NO]; +} + - (void)drawRect: (NSRect)rect { const NSRect *rectList; diff --git a/src/xdisp.c b/src/xdisp.c index 94ce1c29a0..0c3754a338 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -32266,14 +32266,7 @@ expose_window_tree (struct window *w, XRectangle *r) struct frame *f = XFRAME (w->frame); bool mouse_face_overwritten_p = false; - /* NS toolkits may have aleady modified the frame in expectation of - a successful redraw, so don't bail out here if the frame is - garbaged. */ - while (w -#if !defined (HAVE_NS) - && !FRAME_GARBAGED_P (f) -#endif - ) + while (w && !FRAME_GARBAGED_P (f)) { mouse_face_overwritten_p |= (WINDOWP (w->contents) @@ -32301,16 +32294,11 @@ expose_frame (struct frame *f, int x, int y, int w, int h) TRACE ((stderr, "expose_frame ")); -#if !defined (HAVE_NS) - /* No need to redraw if frame will be redrawn soon except under NS - where the toolkit may have already modified the frame in - expectation of us redrawing it. */ if (FRAME_GARBAGED_P (f)) { TRACE ((stderr, " garbaged\n")); return; } -#endif /* If basic faces haven't been realized yet, there is no point in trying to redraw anything. This can happen when we get an expose commit 00ba2267ede311da0cd53261780fb0b781ca42dd Author: Eli Zaretskii Date: Mon Jan 14 17:36:04 2019 +0200 Attempt to fix hangs on MS-Windows due to C-g * src/w32uniscribe.c (uniscribe_otf_capability): Set inhibit-quit around calls to otf_features, because the latter cons Lisp data structures while we are in a critical section. * src/xdisp.c (ALLOCATE_HDC) [HAVE_NTGUI]: Set inhibit-quit. (RELEASE_HDC) [HAVE_NTGUI]: Restore inhibit-quit. (OPTIONAL_HDC, DECLARE_HDC): Remove macros, their job is now done by ALLOCATE_HDC and by a single #ifdef. (draw_glyphs): Adapt to the above changes in macros. (Bug#34059) diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 33959cd05c..28050d6ac7 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -176,6 +176,11 @@ uniscribe_otf_capability (struct font *font) Lisp_Object features; f = XFRAME (selected_frame); + /* Prevent quitting while we cons the lists in otf_features. + That's because get_frame_dc acquires the critical section, so we + cannot quit before we release it in release_frame_dc. */ + Lisp_Object prev_quit = Vinhibit_quit; + Vinhibit_quit = Qt; context = get_frame_dc (f); old_font = SelectObject (context, FONT_HANDLE (font)); @@ -186,6 +191,7 @@ uniscribe_otf_capability (struct font *font) SelectObject (context, old_font); release_frame_dc (f, context); + Vinhibit_quit = prev_quit; return capability; } diff --git a/src/xdisp.c b/src/xdisp.c index 274ab8ddf5..94ce1c29a0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -25619,22 +25619,28 @@ dump_glyph_string (struct glyph_string *s) face-override for drawing S. */ #ifdef HAVE_NTGUI -#define OPTIONAL_HDC(hdc) HDC hdc, -#define DECLARE_HDC(hdc) HDC hdc; -#define ALLOCATE_HDC(hdc, f) hdc = get_frame_dc ((f)) -#define RELEASE_HDC(hdc, f) release_frame_dc ((f), (hdc)) -#endif - -#ifndef OPTIONAL_HDC -#define OPTIONAL_HDC(hdc) -#define DECLARE_HDC(hdc) -#define ALLOCATE_HDC(hdc, f) -#define RELEASE_HDC(hdc, f) +/* We set inhibit-quit here due to paranoia: get_frame_dc acquires the + critical section, and we cannot QUIT while we hold the critical + section. If any of the code run by callers of ALLOCATE_HDC happens + to call Lisp (might be possible due to all the hooks lying around), + we must prevent it from quitting. */ +# define ALLOCATE_HDC(hdc, f) \ + Lisp_Object prev_quit = Vinhibit_quit; \ + Vinhibit_quit = Qt; \ + HDC hdc = get_frame_dc ((f)) +# define RELEASE_HDC(hdc, f) \ + release_frame_dc ((f), (hdc)); \ + Vinhibit_quit = prev_quit +#else +# define ALLOCATE_HDC(hdc, f) +# define RELEASE_HDC(hdc, f) #endif static void init_glyph_string (struct glyph_string *s, - OPTIONAL_HDC (hdc) +#ifdef HAVE_NTGUI + HDC hdc, +#endif XChar2b *char2b, struct window *w, struct glyph_row *row, enum glyph_row_area area, int start, enum draw_glyphs_face hl) { @@ -26674,7 +26680,6 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, struct glyph_string *clip_head = NULL, *clip_tail = NULL; int i, j, x_reached, last_x, area_left = 0; struct frame *f = XFRAME (WINDOW_FRAME (w)); - DECLARE_HDC (hdc); ALLOCATE_HDC (hdc, f); commit b26d6373c48ca26a7cfc81fd03ec8d7f50c13962 Author: Eli Zaretskii Date: Sun Jan 13 17:50:16 2019 +0200 Fix Calc graph output on MS-Windows The previous code relied on "pgnuplot" executable, which is no longer provided with Gnuplot 5.x. * lisp/calc/calc.el (calc-gnuplot-name): Set to "pgnuplot" on MS-Windows only if such an executable exists. * lisp/calc/calc-graph.el (calc-graph-w32-p): New defsubst. (calc-graph-plot, calc-graph-command, calc-gnuplot-command) (calc-graph-init): Call calc-graph-w32-p wherever we need to do something special for invoking gnuplot on MS-Windows, instead of comparing against calc-gnuplot-name. (calc-graph-plot): Set the terminal to "qt" on MS-Windows when pgnuplot.exe is not available. (calc-graph-kill): Delete the temporary files only after killing the gnuplot process, otherwise the deletion might fail on MS-Windows because the files are still in use. diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el index ff7f12d9fa..317f403ead 100644 --- a/lisp/calc/calc-graph.el +++ b/lisp/calc/calc-graph.el @@ -65,6 +65,9 @@ (defvar calc-graph-no-wait nil) (defvar calc-gnuplot-trail-mark) +(defsubst calc-graph-w32-p () + (eq system-type 'windows-nt)) + (defun calc-graph-fast (many) (interactive "P") (let ((calc-graph-no-auto-view t)) @@ -376,8 +379,13 @@ ;; Check MS-Windows before X, in case they have ;; $DISPLAY set for some reason (e.g., Cygwin or ;; whatever) - ((string= calc-gnuplot-name "pgnuplot") - "windows") + ((string= calc-gnuplot-name "pgnuplot") + "windows") + ;; Versions of gnuplot that come without pgnuplot + ;; only work on MS-Windows with "qt" as the + ;; terminal, for some reason. + ((calc-graph-w32-p) + "qt") ((or (eq window-system 'x) (getenv "DISPLAY")) "x11") ((>= calc-gnuplot-version 3) @@ -1321,14 +1329,13 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (calc-graph-init) (calc-graph-view-trail) (calc-gnuplot-command cmd) - (or (string= calc-gnuplot-name "pgnuplot") + (or (calc-graph-w32-p) (progn (accept-process-output) (calc-graph-view-trail))))) (defun calc-graph-kill (&optional no-view) (interactive) - (calc-graph-delete-temps) (if (calc-gnuplot-alive) (calc-wrapper (or no-view (calc-graph-view-trail)) @@ -1337,7 +1344,8 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (sit-for 1) (if (process-status calc-gnuplot-process) (delete-process calc-gnuplot-process)) - (setq calc-gnuplot-process nil)))) + (setq calc-gnuplot-process nil))) + (calc-graph-delete-temps)) (defun calc-graph-quit () (interactive) @@ -1404,7 +1412,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (defun calc-gnuplot-command (&rest args) (calc-graph-init) (let ((cmd (concat (mapconcat 'identity args " ") "\n"))) - (or (string= calc-gnuplot-name "pgnuplot") + (or (calc-graph-w32-p) (accept-process-output)) (with-current-buffer calc-gnuplot-buffer (calc-gnuplot-check-for-errors) @@ -1416,7 +1424,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (process-send-string calc-gnuplot-process cmd) (if (get-buffer-window calc-gnuplot-buffer) (calc-graph-view-trail)) - (or (string= calc-gnuplot-name "pgnuplot") + (or (calc-graph-w32-p) (accept-process-output (and (not calc-graph-no-wait) calc-gnuplot-process))) (calc-gnuplot-check-for-errors) @@ -1445,8 +1453,9 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (setq origin (point))) (setq calc-graph-last-device nil) (setq calc-graph-last-output nil) - (if (string= calc-gnuplot-name "pgnuplot") - (let ((version-str (shell-command-to-string "pgnuplot -V"))) + (if (calc-graph-w32-p) + (let ((version-str + (shell-command-to-string (concat calc-gnuplot-name " -V")))) (if (string-match "gnuplot \\([0-9]+\\)\\." version-str) (setq calc-gnuplot-version (string-to-number (substring version-str @@ -1457,11 +1466,11 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (let ((args (append (and calc-gnuplot-display (not (equal calc-gnuplot-display (getenv "DISPLAY"))) - (not (string= calc-gnuplot-name "pgnuplot")) + (not (calc-graph-w32-p)) (list "-display" calc-gnuplot-display)) (and calc-gnuplot-geometry - (not (string= calc-gnuplot-name "pgnuplot")) + (not (calc-graph-w32-p)) (list "-geometry" calc-gnuplot-geometry))))) (setq calc-gnuplot-process @@ -1475,7 +1484,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (error "Sorry, can't find \"%s\" on your system" calc-gnuplot-name))) (with-current-buffer calc-gnuplot-buffer - (while (and (not (string= calc-gnuplot-name "pgnuplot")) + (while (and (not (calc-graph-w32-p)) (not (save-excursion (goto-char origin) (search-forward "gnuplot> " nil t))) @@ -1483,7 +1492,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (accept-process-output calc-gnuplot-process)) (or (memq (process-status calc-gnuplot-process) '(run stop)) (error "Unable to start GNUPLOT process")) - (if (not (string= calc-gnuplot-name "pgnuplot")) + (if (not (calc-graph-w32-p)) (if (save-excursion (goto-char origin) (re-search-forward diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index ef850a44fe..1d403b7394 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -395,10 +395,17 @@ This is not required to be present for user-written mode annotations." (string :tag "Closing annotation delimiter")))) (defcustom calc-gnuplot-name - (if (eq system-type 'windows-nt) "pgnuplot" "gnuplot") + (if (and (eq system-type 'windows-nt) + ;; Gnuplot v4.x on MS-Windows came with a special + ;; pipe-enabled gnuplot executable for batch-mode + ;; execution; newer versions allow using gnuplot.exe. + (executable-find "pgnuplot")) + "pgnuplot" + "gnuplot") "Name of GNUPLOT program, for calc-graph features." :group 'calc - :type '(string)) + :type '(string) + :version "26.2") (defcustom calc-gnuplot-plot-command nil commit 03818b0a9509e5e54aaee8a40c25f7da099fb7df Author: Eli Zaretskii Date: Sun Jan 13 17:40:50 2019 +0200 Fix a minor mistake in ELisp manual * doc/lispref/buffers.texi (Modification Time): Fix documentation of 'visited-file-modtime'. (Bug#34055) diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi index 8d8fc97a60..d97a095f68 100644 --- a/doc/lispref/buffers.texi +++ b/doc/lispref/buffers.texi @@ -661,7 +661,8 @@ visiting a file or if the time has been explicitly cleared by too. For instance, in a Dired buffer listing a directory, it returns the last modification time of that directory, as recorded by Dired. -If the buffer is not visiting a file, this function returns @minus{}1. +If the buffer is visiting a file that doesn't exist, this function +returns @minus{}1. @end defun @defun set-visited-file-modtime &optional time commit 6ac5985418e5e6e164ff7cbf3fdc5778c30da5e3 Author: Glenn Morris Date: Sat Jan 12 14:47:33 2019 -0800 ; Fix some trivial doc typos diff --git a/doc/emacs/ChangeLog.1 b/doc/emacs/ChangeLog.1 index 439ef51acb..99faff1623 100644 --- a/doc/emacs/ChangeLog.1 +++ b/doc/emacs/ChangeLog.1 @@ -83,7 +83,7 @@ 2014-12-08 Eric S. Raymond - * maintaining.texi: Suopport fo Arch has been moved to obosolete, + * maintaining.texi: Support for Arch has been moved to obsolete, remove references that imply otherwise. 2014-11-29 Paul Eggert diff --git a/lisp/ChangeLog.12 b/lisp/ChangeLog.12 index 3b72cb680c..0c0349c9d9 100644 --- a/lisp/ChangeLog.12 +++ b/lisp/ChangeLog.12 @@ -8873,7 +8873,7 @@ 2006-06-06 Nick Roberts * progmodes/gud.el (gud-running): Fix doc string. - (gud-menu-map): Use :visible instead fo :enable for debugger test. + (gud-menu-map): Use :visible instead of :enable for debugger test. (gud-tooltip-modes): Add python-mode. (gud-tooltip-print-command): Add pdb. Remove perldb. diff --git a/lisp/ChangeLog.7 b/lisp/ChangeLog.7 index f4b96ec909..b3686af0d0 100644 --- a/lisp/ChangeLog.7 +++ b/lisp/ChangeLog.7 @@ -12376,7 +12376,7 @@ when turning on Encoded-kbd mode, and recover it when turning off Encoded-kbd mode. Set encoded-kbd-iso2022-designations correctly. (encoded-kbd-self-insert-iso2022-7bit): Call charset-dimension - instead fo charset-bytes. + instead of charset-bytes. (encoded-kbd-self-insert-iso2022-8bit): Likewise. * language/china-util.el (setup-chinese-gb-environment): Do not diff --git a/lisp/dired.el b/lisp/dired.el index bfbb87ec2c..c831c5e93d 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1694,7 +1694,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." ;; Make menu bar items. - ;; No need to fo this, now that top-level items are fewer. + ;; No need to do this, now that top-level items are fewer. ;;;; ;; Get rid of the Edit menu bar item to save space. ;(define-key map [menu-bar edit] 'undefined) diff --git a/lisp/erc/ChangeLog.1 b/lisp/erc/ChangeLog.1 index fbb64ea06e..97b5d3f97b 100644 --- a/lisp/erc/ChangeLog.1 +++ b/lisp/erc/ChangeLog.1 @@ -11443,7 +11443,7 @@ * erc.el: * Added command-names to completion (erc-command-table) * New variable erc-auto-query. When set, every arriving message to you will open a query buffer for that sender if not already open. - * Compatibility function fo non-existing line-beginning|end-position functions in XEmacs. + * Compatibility function for non-existing line-beginning|end-position functions in XEmacs. 2001-10-03 Mario Lang diff --git a/src/ChangeLog.11 b/src/ChangeLog.11 index cdc119ede7..46ab8b9f32 100644 --- a/src/ChangeLog.11 +++ b/src/ChangeLog.11 @@ -23186,7 +23186,7 @@ Delete argument prop_index. (font_property_table): Change arguments to validator. Change Callers. (font_lispy_object): Delete. - (font_at): Use font_find_object instead fo font_lispy_object. + (font_at): Use font_find_object instead of font_lispy_object. 2008-02-01 Kenichi Handa diff --git a/src/ChangeLog.4 b/src/ChangeLog.4 index 02da8c0caf..ab2807c125 100644 --- a/src/ChangeLog.4 +++ b/src/ChangeLog.4 @@ -5135,7 +5135,7 @@ (BSTRING): Deleted because they are stubs to the memory funcs. (memmove): Defined as safe_bcopy since memcpy is not safe. (HAVE_X_WINDOWS): Does not conditionally define anything any more. - Added support fo the GNU C compiler bundled with R3V7. + Added support for the GNU C compiler bundled with R3V7. 1993-07-26 Richard Stallman (rms@mole.gnu.ai.mit.edu) commit 21b902692828d25bae492c42167281bf1b178bd1 Author: Stephen Berman Date: Sat Jan 12 16:14:49 2019 +0100 * etc/tutorials/TUTORIAL: Fix typo (bug#34049) diff --git a/etc/tutorials/TUTORIAL b/etc/tutorials/TUTORIAL index 48ba5dbc07..3f5f116648 100644 --- a/etc/tutorials/TUTORIAL +++ b/etc/tutorials/TUTORIAL @@ -704,7 +704,7 @@ Emacs deletes its auto save file. If the computer crashes, you can recover your auto-saved editing by finding the file normally (the file you were editing, not the auto save file) and then typing M-x recover-this-file . When it -asks fo confirmation, type yes to go ahead and recover the +asks for confirmation, type yes to go ahead and recover the auto-save data. commit d223727a7a15048b9963ebeb83b15962454aff0f Author: Devon Sean McCullough Date: Sat Jan 5 10:36:22 2019 -0500 Fix UI of Buffer-menu * lisp/buff-menu.el (Buffer-menu-execute): Don't remove entries of buffers whose killing the user didn't confirm. (Bug#33669) diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index f0b96b0c5e..5f88986636 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -475,10 +475,10 @@ Buffers marked with \\`\\[Buffer-menu-delete]' are deleted (save-buffer)) (tabulated-list-set-col 2 " " t)) (error (warn "Error saving %s" buffer)))) - (if delete - (unless (eq buffer (current-buffer)) - (kill-buffer buffer) - (tabulated-list-delete-entry)) + (if (and delete + (not (eq buffer (current-buffer))) + (kill-buffer buffer)) + (tabulated-list-delete-entry) (forward-line 1))))))))) (defun Buffer-menu-select () commit 0f716557c529479a7d86d751e972ebdae1bec5e1 Author: Philip K Date: Wed Jan 9 00:37:48 2019 +0100 Reinitialize ispell-really-enchant when changing the speller * lisp/textmodes/ispell.el (ispell-check-version): Reset also ispell-really-enchant. (Bug#34019) Copyright-paperwork-exempt: yes diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index c5d8e4f78c..656c9fad93 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -723,6 +723,7 @@ Otherwise returns the library directory name, if that is defined." ;; Make sure these variables are (re-)initialized to the default value (setq ispell-really-aspell nil ispell-really-hunspell nil + ispell-really-enchant nil ispell-encoding8-command nil) (goto-char (point-min)) commit 9845044fb659735251269213e6e4e6debdd08eee Author: Leo Liu Date: Tue Jan 8 05:15:24 2019 +0800 Speed up loading css-mode lisp/textmodes/css-mode.el: Remove (require 'eww) which is redundant and slow. (Bug#33939) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 016f0e8fc8..67a0c9f7a5 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -32,7 +32,6 @@ ;;; Code: -(require 'eww) (require 'cl-lib) (require 'color) (require 'seq)