commit dc3f70dc8f87a379cd418b96a5750765a27f8abd (HEAD, refs/remotes/origin/master) Author: Glenn Morris Date: Tue Dec 18 23:21:37 2018 -0800 Skip a remote filenotify test on hydra * test/lisp/filenotify-tests.el (file-notify--deftest-remote): Add optional argument to skip test. (file-notify-test07-many-events-remote): Skip on hydra.nixos.org. diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 48dd2de7d1..4c8e7fbe93 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -241,13 +241,14 @@ This returns only for the local case and gfilenotify; otherwise it is nil. (gfile-monitor-name file-notify--test-desc))) (cdr (assq file-notify--test-desc file-notify--test-monitors)))))) -(defmacro file-notify--deftest-remote (test docstring &optional expected) +(defmacro file-notify--deftest-remote (test docstring &optional expected skip) "Define ert `TEST-remote' for remote files." (declare (indent 1)) `(ert-deftest ,(intern (concat (symbol-name test) "-remote")) () ,docstring :tags '(:expensive-test) :expected-result (or ,expected :passed) + (skip-unless (not ,skip)) (let* ((temporary-file-directory file-notify-test-remote-temporary-file-directory) (ert-test (ert-get-test ',test))) @@ -1161,8 +1162,10 @@ delivered." ;; Cleanup. (file-notify--test-cleanup))) +;; Unpredictable failures, eg https://hydra.nixos.org/build/86016286 (file-notify--deftest-remote file-notify-test07-many-events - "Check that events are not dropped for remote directories.") + "Check that events are not dropped for remote directories." + :passed (getenv "EMACS_HYDRA_CI")) (ert-deftest file-notify-test08-backup () "Check that backup keeps file notification." commit 70926a3e8671034fd5cb1a546f9c107feda729a3 Author: Stefan Monnier Date: Tue Dec 18 23:26:49 2018 -0500 * lisp/font-lock.el: Use lexical-binding (font-lock-initial-fontify, font-lock-compile-keywords): Silence compiler warning. (font-lock-ensure-function): Fix some problems in last commit. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index f50a7150aa..ee4b78b590 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1,4 +1,4 @@ -;;; font-lock.el --- Electric font lock mode +;;; font-lock.el --- Electric font lock mode -*- lexical-binding:t -*- ;; Copyright (C) 1992-2018 Free Software Foundation, Inc. @@ -656,7 +656,7 @@ be enabled." (cond (font-lock-fontified nil) ((or (null max-size) (> max-size (buffer-size))) - (font-lock-fontify-buffer)) + (with-no-warnings (font-lock-fontify-buffer))) (font-lock-verbose (message "Fontifying %s...buffer size greater than font-lock-maximum-size" (buffer-name))))))) @@ -1095,7 +1095,8 @@ accessible portion of the current buffer." (defvar font-lock-ensure-function (lambda (beg end) (unless font-lock-fontified - (font-lock-fontify-region beg end))) + (save-excursion + (font-lock-fontify-region (or beg (point-min)) (or end (point-max)))))) "Function to make sure a region has been fontified. Called with two arguments BEG and END.") @@ -1779,7 +1780,7 @@ If SYNTACTIC-KEYWORDS is non-nil, it means these keywords are used for (cons t (cons keywords (mapcar #'font-lock-compile-keyword keywords)))) (if (and (not syntactic-keywords) - (let ((beg-function syntax-begin-function)) + (let ((beg-function (with-no-warnings syntax-begin-function))) (or (eq beg-function #'beginning-of-defun) (if (symbolp beg-function) (get beg-function 'font-lock-syntax-paren-check)))) commit bb55d384cdb19a7af0da0c3cdd00ca6967ddd1a9 Author: Stefan Monnier Date: Tue Dec 18 23:05:36 2018 -0500 * lisp/font-lock.el (font-lock-ensure-function): Fix bug#33798 diff --git a/lisp/font-lock.el b/lisp/font-lock.el index b4cf5b0387..f50a7150aa 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1093,14 +1093,9 @@ accessible portion of the current buffer." (or beg (point-min)) (or end (point-max))))) (defvar font-lock-ensure-function - (lambda (_beg _end) + (lambda (beg end) (unless font-lock-fontified - (font-lock-default-fontify-buffer) - (unless font-lock-mode - ;; If font-lock is not enabled, we don't have the hooks in place to - ;; track modifications, so a subsequent call to font-lock-ensure can't - ;; assume that the fontification is still valid. - (setq font-lock-fontified nil)))) + (font-lock-fontify-region beg end))) "Function to make sure a region has been fontified. Called with two arguments BEG and END.") commit fb16313025dcbe2f010a79072536aeab000eaf80 Author: Juri Linkov Date: Wed Dec 19 01:10:09 2018 +0200 More font-lock improvements for diff-mode * lisp/vc/diff-mode.el (diff-font-lock-keywords): Use diff-header face for git index lines (like already used for bzr index lines). Use diff-file-header face for binary file headers. (diff-find-source-location): Use expand-file-name for vc-find-revision. (diff--font-lock-prettify): Use diff-indicator-* faces for left-fringe indicators. (diff-syntax-fontify-props): Optimize to not use text-property-not-all for font-lock-ensure. * lisp/replace.el (occur-engine-line): Simplify to use font-lock-ensure without text-property-not-all. diff --git a/lisp/replace.el b/lisp/replace.el index dcae12e9b7..b8f231eb55 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1907,10 +1907,8 @@ See also `multi-occur'." global-matches))) (defun occur-engine-line (beg end &optional keep-props) - (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode) - (text-property-not-all beg end 'fontified t)) - (if (fboundp 'jit-lock-fontify-now) - (jit-lock-fontify-now beg end))) + (if (and keep-props font-lock-mode) + (font-lock-ensure beg end)) (if (and keep-props (not (eq occur-excluded-properties t))) (let ((str (buffer-substring beg end))) (remove-list-of-text-properties diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 549f49a8d1..043d22d14b 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -255,7 +255,7 @@ in wrong fontification. This is the fastest option, but less reliable." "Keymap for `diff-minor-mode'. See also `diff-mode-shared-map'.") (define-minor-mode diff-auto-refine-mode - "Toggle automatic diff hunk highlighting (Diff Auto Refine mode). + "Toggle automatic diff hunk finer highlighting (Diff Auto Refine mode). Diff Auto Refine mode is a buffer-local minor mode used with `diff-mode'. When enabled, Emacs automatically highlights @@ -435,7 +435,9 @@ and the face `diff-added' for added lines.") 'diff-removed)))))) ("^\\(?:Index\\|revno\\): \\(.+\\).*\n" (0 'diff-header) (1 'diff-index prepend)) + ("^\\(?:index .*\\.\\.\\|diff \\).*\n" . 'diff-header) ("^Only in .*\n" . 'diff-nonexistent) + ("^Binary files .* differ\n" . 'diff-file-header) ("^\\(#\\)\\(.*\\)" (1 font-lock-comment-delimiter-face) (2 font-lock-comment-face)) @@ -1785,7 +1787,7 @@ NOPROMPT, if non-nil, means not to prompt the user." (vc-working-revision file))))) (buf (if revision (let ((vc-find-revision-no-save t)) - (vc-find-revision file revision diff-vc-backend)) + (vc-find-revision (expand-file-name file) revision diff-vc-backend)) (find-file-noselect file)))) ;; Update the user preference if he so wished. (when (> (prefix-numeric-value other-file) 8) @@ -2321,9 +2323,9 @@ fixed, visit it in a buffer." ;; FIXME: Include the first space for context-style hunks! (while (re-search-forward "^[-+! ]" limit t) (let ((spec (alist-get (char-before) - '((?+ . (left-fringe diff-fringe-add diff-added)) - (?- . (left-fringe diff-fringe-del diff-removed)) - (?! . (left-fringe diff-fringe-rep diff-changed)) + '((?+ . (left-fringe diff-fringe-add diff-indicator-added)) + (?- . (left-fringe diff-fringe-del diff-indicator-removed)) + (?! . (left-fringe diff-fringe-rep diff-indicator-changed)) (?\s . (left-fringe diff-fringe-nul)))))) (put-text-property (match-beginning 0) (match-end 0) 'display spec)))) ;; Mimicks the output of Magit's diff. @@ -2523,14 +2525,14 @@ hunk text is not found in the source file." (when (and beg end) (goto-char beg) - (when (text-property-not-all beg end 'fontified t) - (if file - ;; In a temporary or cached buffer + (if file + ;; In a temporary or cached buffer + (when (text-property-not-all beg end 'fontified t) (save-excursion (font-lock-fontify-region beg end) - (put-text-property beg end 'fontified t)) - ;; In an existing buffer - (font-lock-ensure beg end))) + (put-text-property beg end 'fontified t))) + ;; In an existing buffer + (font-lock-ensure beg end)) (while (< (point) end) (let* ((bol (point)) commit 8cbbf4ba25bef2c6c1b525aa380a1cd3f0b0d012 Author: Juri Linkov Date: Wed Dec 19 00:55:15 2018 +0200 Fontify one-line diffs without the final newline (bug#33567) * lisp/vc/diff-mode.el (diff-hunk-text, diff-syntax-fontify-hunk): Skip lines beginning with backslash like "\ No newline at end of file". (diff-syntax-fontify-hunk): Use string-trim-right. For one-line diffs use 1 explicitly in the list of line numbers. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index ed953deb21..549f49a8d1 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -1697,10 +1697,11 @@ char-offset in TEXT." (delete-region divider-pos (point-max))) (delete-region (point-min) keep)) ;; Remove line-prefix characters, and unneeded lines (unified diffs). - (let ((kill-char (if destp ?- ?+))) + ;; Also skip lines like "\ No newline at end of file" + (let ((kill-chars (list (if destp ?- ?+) ?\\))) (goto-char (point-min)) (while (not (eobp)) - (if (eq (char-after) kill-char) + (if (memq (char-after) kill-chars) (delete-region (point) (progn (forward-line 1) (point))) (delete-char num-pfx-chars) (forward-line 1))))) @@ -2394,19 +2395,23 @@ and the position in MAX." (defvar diff-syntax-fontify-revisions (make-hash-table :test 'equal)) +(eval-when-compile (require 'subr-x)) ; for string-trim-right + (defun diff-syntax-fontify-hunk (beg end old) "Highlight source language syntax in diff hunk between BEG and END. When OLD is non-nil, highlight the hunk from the old source." (remove-overlays beg end 'diff-mode 'syntax) (goto-char beg) (let* ((hunk (buffer-substring-no-properties beg end)) - (text (or (ignore-errors (diff-hunk-text hunk (not old) nil)) "")) + (text (string-trim-right (or (ignore-errors (diff-hunk-text hunk (not old) nil)) ""))) (line (if (looking-at "\\(?:\\*\\{15\\}.*\n\\)?[-@* ]*\\([0-9,]+\\)\\([ acd+]+\\([0-9,]+\\)\\)?") (if old (match-string 1) (if (match-end 3) (match-string 3) (match-string 1))))) - (line-nb (and line (string-match "\\([0-9]+\\),\\([0-9]+\\)" line) - (list (string-to-number (match-string 1 line)) - (string-to-number (match-string 2 line))))) + (line-nb (when line + (if (string-match "\\([0-9]+\\),\\([0-9]+\\)" line) + (list (string-to-number (match-string 1 line)) + (string-to-number (match-string 2 line))) + (list (string-to-number line) 1)))) ; One-line diffs props) (cond ((and diff-vc-backend (not (eq diff-font-lock-syntax 'hunk-only))) @@ -2470,18 +2475,19 @@ When OLD is non-nil, highlight the hunk from the old source." (while (< (progn (forward-line 1) (point)) end) (when (or (and (not old) (not (looking-at-p "[-<]"))) (and old (not (looking-at-p "[+>]")))) - (if (and old (not (looking-at-p "[-<]"))) - ;; Fontify context lines only from new source, - ;; don't refontify context lines from old source. - (pop props) - (let ((line-props (pop props)) - (bol (1+ (point)))) - (dolist (prop line-props) - (let ((ol (make-overlay (+ bol (nth 0 prop)) - (+ bol (nth 1 prop)) - nil 'front-advance nil))) - (overlay-put ol 'evaporate t) - (overlay-put ol 'face (nth 2 prop))))))))))) + (unless (looking-at-p "\\\\") ; skip "\ No newline at end of file" + (if (and old (not (looking-at-p "[-<]"))) + ;; Fontify context lines only from new source, + ;; don't refontify context lines from old source. + (pop props) + (let ((line-props (pop props)) + (bol (1+ (point)))) + (dolist (prop line-props) + (let ((ol (make-overlay (+ bol (nth 0 prop)) + (+ bol (nth 1 prop)) + nil 'front-advance nil))) + (overlay-put ol 'evaporate t) + (overlay-put ol 'face (nth 2 prop)))))))))))) (defun diff-syntax-fontify-props (file text line-nb &optional no-init hunk-only) "Get font-lock properties from the source code. commit cdaaaf2e1bd1f8ad2784ffc8265aa642da2d1190 Author: Paul Eggert Date: Tue Dec 18 12:21:27 2018 -0800 Support (ash INTEGER BIGNUM) * src/data.c (emacs_mpz_mul_2exp): 2nd arg is now a nonnegative EMACS_INT not mp_bitcnt_t, to simplify checking. (Fash): Support COUNT values that are bignums or that exceed mp_bitcnt_t range. * test/src/data-tests.el (data-tests-ash-lsh): Test this. diff --git a/src/data.c b/src/data.c index 0980cf9988..c64adb6635 100644 --- a/src/data.c +++ b/src/data.c @@ -2414,14 +2414,14 @@ emacs_mpz_mul (mpz_t rop, mpz_t const op1, mpz_t const op2) } static void -emacs_mpz_mul_2exp (mpz_t rop, mpz_t const op1, mp_bitcnt_t op2) +emacs_mpz_mul_2exp (mpz_t rop, mpz_t const op1, EMACS_INT op2) { /* Fudge factor derived from GMP 6.1.2, to avoid an abort in mpz_mul_2exp (look for the '+ 1' in its source code). */ enum { mul_2exp_extra_limbs = 1 }; enum { lim = min (NLIMBS_LIMIT, GMP_NLIMBS_MAX - mul_2exp_extra_limbs) }; - mp_bitcnt_t op2limbs = op2 / GMP_NUMB_BITS; + EMACS_INT op2limbs = op2 / GMP_NUMB_BITS; if (lim - emacs_mpz_size (op1) < op2limbs) overflow_error (); mpz_mul_2exp (rop, op1, op2); @@ -3251,12 +3251,21 @@ If COUNT is negative, shifting is actually to the right. In this case, the sign bit is duplicated. */) (Lisp_Object value, Lisp_Object count) { - /* The negative of the minimum value of COUNT that fits into a fixnum, - such that mpz_fdiv_q_exp supports -COUNT. */ - EMACS_INT minus_count_min = min (-MOST_NEGATIVE_FIXNUM, - TYPE_MAXIMUM (mp_bitcnt_t)); CHECK_INTEGER (value); - CHECK_RANGED_INTEGER (count, - minus_count_min, TYPE_MAXIMUM (mp_bitcnt_t)); + CHECK_INTEGER (count); + + if (! FIXNUMP (count)) + { + if (EQ (value, make_fixnum (0))) + return value; + if (mpz_sgn (XBIGNUM (count)->value) < 0) + { + EMACS_INT v = (FIXNUMP (value) ? XFIXNUM (value) + : mpz_sgn (XBIGNUM (value)->value)); + return make_fixnum (v < 0 ? -1 : 0); + } + overflow_error (); + } if (XFIXNUM (count) <= 0) { @@ -3275,7 +3284,11 @@ In this case, the sign bit is duplicated. */) mpz_t *zval = bignum_integer (&mpz[0], value); if (XFIXNUM (count) < 0) - mpz_fdiv_q_2exp (mpz[0], *zval, - XFIXNUM (count)); + { + if (TYPE_MAXIMUM (mp_bitcnt_t) < - XFIXNUM (count)) + return make_fixnum (mpz_sgn (*zval) < 0 ? -1 : 0); + mpz_fdiv_q_2exp (mpz[0], *zval, - XFIXNUM (count)); + } else emacs_mpz_mul_2exp (mpz[0], *zval, XFIXNUM (count)); return make_integer_mpz (); diff --git a/test/src/data-tests.el b/test/src/data-tests.el index d41c762328..bbf7e2a239 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -656,6 +656,10 @@ comparing the subr with a much slower lisp implementation." (ert-deftest data-tests-ash-lsh () (should (= (ash most-negative-fixnum 1) (* most-negative-fixnum 2))) + (should (= (ash 0 (* 2 most-positive-fixnum)) 0)) + (should (= (ash 1000 (* 2 most-negative-fixnum)) 0)) + (should (= (ash -1000 (* 2 most-negative-fixnum)) -1)) + (should (= (ash (* 2 most-negative-fixnum) (* 2 most-negative-fixnum)) -1)) (should (= (lsh most-negative-fixnum 1) (* most-negative-fixnum 2))) (should (= (ash (* 2 most-negative-fixnum) -1) commit 5a04e8261458d887c7b7d7c259053f236379cf78 Author: Glenn Morris Date: Tue Dec 18 08:29:05 2018 -0800 Expect tramp environment test to fail on hydra * test/lisp/net/tramp-tests.el (tramp-test32-environment-variables): Expect failure on hydra.nixos.org. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 57b67a0bfe..f3ad8edf83 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -3989,6 +3989,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (ert-deftest tramp-test32-environment-variables () "Check that remote processes set / unset environment variables properly." :tags '(:expensive-test) + :expected-result (if (getenv "EMACS_HYDRA_CI") :failed :passed) ; bug#33781 (skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-sh-p)) commit 5486a46d3e38ce227094200562faa1134a041da7 Author: Glenn Morris Date: Tue Dec 18 08:25:55 2018 -0800 A filenotify test now passes on hydra * test/lisp/filenotify-tests.el (file-notify-test04-autorevert): Remote test now passes on hydra.nixos.org, since PATH workaround for bug#33781. diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 376b20988a..48dd2de7d1 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -919,8 +919,7 @@ delivered." (file-notify--test-cleanup)))) (file-notify--deftest-remote file-notify-test04-autorevert - "Check autorevert via file notification for remote files." - (if (getenv "EMACS_HYDRA_CI") :failed :passed)) ; fixme bug#33735 + "Check autorevert via file notification for remote files.") (ert-deftest file-notify-test05-file-validity () "Check `file-notify-valid-p' for files." commit 710e79a6c56aff69d69ae7c003346bb38c3e9939 Author: Michael Albinus Date: Tue Dec 18 13:58:00 2018 +0100 Fix Bug#33781 * lisp/net/tramp-cache.el (tramp-connection-properties): * lisp/net/tramp-sh.el (tramp-remote-path) (tramp-remote-process-environment, tramp-sh-extra-args): Reinsert autoload cookie. (Bug#33781) * test/lisp/net/tramp-tests.el: Do not require tramp-sh before changing tramp-remote-path. diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 47066760fb..f525bb913d 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -72,6 +72,7 @@ (defvar tramp-cache-data (make-hash-table :test 'equal) "Hash table for remote files properties.") +;;;###tramp-autoload (defcustom tramp-connection-properties nil "List of static connection properties. Every entry has the form (REGEXP PROPERTY VALUE). The regexp diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 05715f2477..e4ec735a96 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -466,6 +466,7 @@ The string is used in `tramp-methods'.") ;; Darwin: /usr/bin:/bin:/usr/sbin:/sbin ;; IRIX64: /usr/bin ;; QNAP QTS: --- +;;;###tramp-autoload (defcustom tramp-remote-path '(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" @@ -495,6 +496,7 @@ the list by the special value `tramp-own-remote-path'." (const :tag "Private Directories" tramp-own-remote-path) (string :tag "Directory")))) +;;;###tramp-autoload (defcustom tramp-remote-process-environment '("ENV=''" "TMOUT=0" "LC_CTYPE=''" "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" @@ -518,6 +520,7 @@ based on the Tramp and Emacs versions, and should not be set here." :version "26.1" :type '(repeat string)) +;;;###tramp-autoload (defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile")) "Alist specifying extra arguments to pass to the remote shell. Entries are (REGEXP . ARGS) where REGEXP is a regular expression diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index c566f81610..57b67a0bfe 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -107,7 +107,6 @@ ;; This should happen on hydra only. (when (getenv "EMACS_HYDRA_CI") - (require 'tramp-sh) (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) (defvar tramp--test-enabled-checked nil