commit b6a57fb80c49bcd9163966d612671a5256f3a1a8 (HEAD, refs/remotes/origin/master) Author: Glenn Morris Date: Tue Apr 18 20:52:22 2017 -0400 Tweak bytecomp's loading of cl-extra * lisp/emacs-lisp/bytecomp.el: Don't force load of cl-extra in a post-bootstrap emacs where cl-loaddefs does exist. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 2c2996ebab..f0f938da43 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -124,11 +124,13 @@ (require 'backquote) (require 'macroexp) (require 'cconv) +(require 'cl-lib) ;; During bootstrap, cl-loaddefs.el is not created yet, so loading cl-lib ;; doesn't setup autoloads for things like cl-every, which is why we have to -;; require cl-extra instead (bug#18804). -(require 'cl-extra) +;; require cl-extra as well (bug#18804). +(or (fboundp 'cl-every) + (require 'cl-extra)) (or (fboundp 'defsubst) ;; This really ought to be loaded already! commit 0f8343394675480f18c121520eed2203bbe1d6ec Author: Glenn Morris Date: Tue Apr 18 19:07:28 2017 -0400 Avoid unnecessary loading of subr-x at run-time * lisp/doc-view.el, lisp/filenotify.el, lisp/info-look.el: * lisp/svg.el, lisp/emacs-lisp/byte-opt.el, lisp/net/shr.el: * lisp/textmodes/sgml-mode.el, test/lisp/dom-tests.el: No need to load subr-x at run-time. * lisp/gnus/nnheader.el: No need to load subr-x. ; * lisp/emacs-lisp/subr-x.el, lisp/gnus/message.el, lisp/net/nsm.el: ; Comments. diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 172ea163c1..2eb555821d 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -140,7 +140,7 @@ (require 'dired) (require 'image-mode) (require 'jka-compr) -(require 'subr-x) +(eval-when-compile (require 'subr-x)) ;;;; Customization Options diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 004f2e2865..2a240f502c 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -185,7 +185,7 @@ (require 'bytecomp) (eval-when-compile (require 'cl-lib)) (require 'macroexp) -(require 'subr-x) +(eval-when-compile (require 'subr-x)) (defun byte-compile-log-lap-1 (format &rest args) ;; Newer byte codes for stack-ref make the slot 0 non-nil again. diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 5ad482d1ea..c0e5ae5984 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -30,6 +30,9 @@ ;; Do not document these functions in the lispref. ;; http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01006.html +;; NB If you want to use this library, it's almost always correct to use: +;; (eval-when-compile (require 'subr-x)) + ;;; Code: (require 'pcase) diff --git a/lisp/filenotify.el b/lisp/filenotify.el index 8bbe348f33..0a45db8219 100644 --- a/lisp/filenotify.el +++ b/lisp/filenotify.el @@ -28,7 +28,7 @@ ;;; Code: (require 'cl-lib) -(require 'subr-x) +(eval-when-compile (require 'subr-x)) (defconst file-notify--library (cond diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index a8f2b143f2..0f8fdfc9c7 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -49,7 +49,7 @@ (require 'mm-util) (require 'rfc2047) (require 'puny) -(require 'subr-x) +(require 'subr-x) ; read-multiple-choice (autoload 'mailclient-send-it "mailclient") diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el index cc3dccea25..4440f17c2b 100644 --- a/lisp/gnus/nnheader.el +++ b/lisp/gnus/nnheader.el @@ -40,7 +40,6 @@ (require 'mail-utils) (require 'mm-util) (require 'gnus-util) -(require 'subr-x) (autoload 'gnus-range-add "gnus-range") (autoload 'gnus-remove-from-range "gnus-range") ;; FIXME none of these are used explicitly in this file. diff --git a/lisp/info-look.el b/lisp/info-look.el index 694bcb462c..6963c78270 100644 --- a/lisp/info-look.el +++ b/lisp/info-look.el @@ -43,7 +43,7 @@ ;;; Code: (require 'info) -(require 'subr-x) +(eval-when-compile (require 'subr-x)) (defgroup info-lookup nil "Major mode sensitive help agent." diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el index ccb596f4dd..8d3463ef0a 100644 --- a/lisp/net/nsm.el +++ b/lisp/net/nsm.el @@ -25,7 +25,7 @@ ;;; Code: (require 'cl-lib) -(require 'subr-x) +(require 'subr-x) ; read-multiple-choice (defvar nsm-permanent-host-settings nil) (defvar nsm-temporary-host-settings nil) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 7472c4133a..6b62a05227 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -33,7 +33,7 @@ (eval-when-compile (require 'cl)) (eval-when-compile (require 'url)) ;For url-filename's setf handler. (require 'browse-url) -(require 'subr-x) +(eval-when-compile (require 'subr-x)) (require 'dom) (require 'seq) (require 'svg) diff --git a/lisp/svg.el b/lisp/svg.el index 65e031b387..2295e5f8d4 100644 --- a/lisp/svg.el +++ b/lisp/svg.el @@ -27,7 +27,7 @@ (require 'cl-lib) (require 'xml) (require 'dom) -(require 'subr-x) +(eval-when-compile (require 'subr-x)) (defun svg-create (width height &rest args) "Create a new, empty SVG image with dimensions WIDTHxHEIGHT. diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index a6965fa32d..1f99786ae7 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -34,7 +34,7 @@ (require 'dom) (require 'seq) -(require 'subr-x) +(eval-when-compile (require 'subr-x)) (eval-when-compile (require 'skeleton) (require 'cl-lib)) diff --git a/test/lisp/dom-tests.el b/test/lisp/dom-tests.el index 09114bd794..32d231a47e 100644 --- a/test/lisp/dom-tests.el +++ b/test/lisp/dom-tests.el @@ -26,7 +26,7 @@ (require 'dom) (require 'ert) -(require 'subr-x) +(eval-when-compile (require 'subr-x)) (defun dom-tests--tree () "Return a DOM tree for testing." commit d831312d668fbedeffe3711b13cd455309da84a1 Author: michael schuldt Date: Tue Apr 18 11:24:37 2017 -0700 Use iteration in math-factorial-iter * lisp/calc/calc-comb.el (math-factorial-iter): Use iteration instead of recursion to avoid max-specpdl-size problem. Copyright-paperwork-exempt: yes diff --git a/lisp/calc/calc-comb.el b/lisp/calc/calc-comb.el index c84ff23685..91fbb7b2b8 100644 --- a/lisp/calc/calc-comb.el +++ b/lisp/calc/calc-comb.el @@ -362,11 +362,13 @@ (math-gammap1-raw '(float -25 -2)))) (defun math-factorial-iter (count n f) - (if (= (% n 5) 1) - (math-working (format "factorial(%d)" (1- n)) f)) - (if (> count 0) - (math-factorial-iter (1- count) (1+ n) (math-mul n f)) - f)) + (while (> count 0) + (if (= (% n 5) 1) + (math-working (format "factorial(%d)" (1- n)) f)) + (setq count (1- count) + f (math-mul n f) + n (1+ n))) + f) (defun calcFunc-dfact (n) ; [I I] [F F] [Public] (cond ((Math-integer-negp n) commit 0c98dec5c9d0e0146a1519b9a7e099aae668c059 Author: Glenn Morris Date: Tue Apr 18 13:02:02 2017 -0400 * test/lisp/kmacro-tests.el: Require seq, for seq-concatenate. diff --git a/test/lisp/kmacro-tests.el b/test/lisp/kmacro-tests.el index 5124cbbf96..04a4271734 100644 --- a/test/lisp/kmacro-tests.el +++ b/test/lisp/kmacro-tests.el @@ -24,6 +24,7 @@ ;;; Code: (require 'kmacro) +(require 'seq) (require 'ert) (require 'ert-x) commit 491531b20d05a0f2cc747aa01e697a764c34a99d Author: Glenn Morris Date: Tue Apr 18 12:52:33 2017 -0400 Avoid ert test failures * lisp/emacs-lisp/ert.el (ert--expand-should-1): Avoid errors related to undefined byte-compile-macro-environment. Somehow masked until very recently because loading seq (eg) loads bytecomp. http://hydra.nixos.org/build/51730765 diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 7eaf33a27d..f4c61e625d 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -275,6 +275,7 @@ DATA is displayed to the user and should state the reason for skipping." (defun ert--expand-should-1 (whole form inner-expander) "Helper function for the `should' macro and its variants." + (require 'bytecomp) ; FIXME? (let ((form (macroexpand form (append byte-compile-macro-environment (cond commit 861824dbecc96339c68b1e15008a21c31e04721b Author: Noam Postavsky Date: Sat Mar 25 22:41:34 2017 -0400 Fix find-library-name for load-history entries with nil FILE-NAME (Bug#26355) * lisp/emacs-lisp/find-func.el (find-library--from-load-history): Rename from find-library--from-load-path. Check for `load-history' entries with nil FILE-NAMEs. Simplify by not double checking for suffixes and making use of `locate-file'. diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 6699e3fd2b..d0acc14775 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -43,7 +43,7 @@ ;;; Code: -(require 'seq) +(eval-when-compile (require 'cl-lib)) ;;; User variables: @@ -203,43 +203,21 @@ LIBRARY should be a string (the name of the library)." (locate-file rel (or find-function-source-path load-path) load-file-rep-suffixes))))) - (find-library--from-load-path library) + (find-library--from-load-history library) (error "Can't find library %s" library))) -(defun find-library--from-load-path (library) +(defun find-library--from-load-history (library) ;; In `load-history', the file may be ".elc", ".el", ".el.gz", and - ;; LIBRARY may be "foo.el" or "foo", so make sure that we get all - ;; potential matches, and then see whether any of them lead us to an - ;; ".el" or an ".el.gz" file. - (let* ((elc-regexp "\\.el\\(c\\(\\..*\\)?\\)\\'") - (suffix-regexp - (concat "\\(" - (mapconcat 'regexp-quote (find-library-suffixes) "\\'\\|") - "\\|" elc-regexp "\\)\\'")) - (potentials - (mapcar - (lambda (entry) - (if (string-match suffix-regexp (car entry)) - (replace-match "" t t (car entry)) - (car entry))) - (seq-filter - (lambda (entry) - (string-match - (concat "\\`" - (regexp-quote - (replace-regexp-in-string suffix-regexp "" library)) - suffix-regexp) - (file-name-nondirectory (car entry)))) - load-history))) - result) - (dolist (file potentials) - (dolist (suffix (find-library-suffixes)) - (when (not result) - (cond ((file-exists-p file) - (setq result file)) - ((file-exists-p (concat file suffix)) - (setq result (concat file suffix))))))) - result)) + ;; LIBRARY may be "foo.el" or "foo". + (let ((load-re + (concat "\\(" (regexp-quote (file-name-sans-extension library)) "\\)" + (regexp-opt (get-load-suffixes)) "\\'"))) + (cl-loop + for (file . _) in load-history thereis + (and (stringp file) (string-match load-re file) + (let ((dir (substring file 0 (match-beginning 1))) + (basename (match-string 1 file))) + (locate-file basename (list dir) (find-library-suffixes))))))) (defvar find-function-C-source-directory (let ((dir (expand-file-name "src" source-directory))) commit a13eaddce2ddbe3ba0b7f4c81715bc0fcdba99f6 Author: Alan Third Date: Sun Apr 9 20:10:33 2017 +0100 Use vfork if possible on Darwin (bug#26397) Co-authored-by: YAMAMOTO Mitsuharu * src/conf_post.h (HAVE_WORKING_VFORK): Don't undef. (vfork): Don't define. * src/process.c (create_process) [DARWIN_OS]: Use fork if pty_flag is set, otherwise vfork. * src/callproc.c (call_process) [DARWIN_OS]: Use TIOCNOTTY to detach the controlling terminal instead of setsid. diff --git a/src/callproc.c b/src/callproc.c index 05048576ce..792556c8e0 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -52,6 +52,8 @@ along with GNU Emacs. If not, see . */ #include "syswait.h" #include "blockinput.h" #include "frame.h" +#include "systty.h" +#include "keyboard.h" #ifdef MSDOS #include "msdos.h" @@ -626,7 +628,18 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, { unblock_child_signal (&oldset); +#ifdef DARWIN_OS + /* Darwin doesn't let us run setsid after a vfork, so use + TIOCNOTTY when necessary. */ + int j = emacs_open (DEV_TTY, O_RDWR, 0); + if (j >= 0) + { + ioctl (j, TIOCNOTTY, 0); + emacs_close (j); + } +#else setsid (); +#endif /* Emacs ignores SIGPIPE, but the child should not. */ signal (SIGPIPE, SIG_DFL); diff --git a/src/conf_post.h b/src/conf_post.h index 30c948e39a..95ebd5511c 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -99,12 +99,6 @@ typedef bool bool_bf; #define realloc unexec_realloc #define free unexec_free #endif -/* The following solves the problem that Emacs hangs when evaluating - (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile - does not exist. Also, setsid is not allowed in the vfork child's - context as of Darwin 9/Mac OS X 10.5. */ -#undef HAVE_WORKING_VFORK -#define vfork fork #endif /* DARWIN_OS */ /* If HYBRID_MALLOC is defined (e.g., on Cygwin), emacs will use diff --git a/src/process.c b/src/process.c index b81c7b459e..0edd092ef6 100644 --- a/src/process.c +++ b/src/process.c @@ -2049,7 +2049,16 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) int volatile forkerr_volatile = forkerr; struct Lisp_Process *p_volatile = p; +#ifdef DARWIN_OS + /* Darwin doesn't let us run setsid after a vfork, so use fork when + necessary. */ + if (pty_flag) + pid = fork (); + else + pid = vfork (); +#else pid = vfork (); +#endif current_dir = current_dir_volatile; lisp_pty_name = lisp_pty_name_volatile;