commit 1d559581b3bcd91644e44b1e3a3788614d99924f (HEAD, refs/remotes/origin/master) Author: Mattias Engdegård Date: Wed May 13 15:17:10 2020 +0200 Calc: fix LU decomposition for non-numeric matrices (bug#41223) Computing determinant and inverse for on some matrices containing non-numeric elements failed or gave the wrong result. Reported by Mauro Aranda. * lisp/calc/calc-mtx.el (math-do-matrix-lud): Don't use zero as pivot. * test/lisp/calc/calc-tests.el (calc-matrix-determinant): New test. diff --git a/lisp/calc/calc-mtx.el b/lisp/calc/calc-mtx.el index fe241b57c6..2850b33721 100644 --- a/lisp/calc/calc-mtx.el +++ b/lisp/calc/calc-mtx.el @@ -275,7 +275,7 @@ in LUD decomposition." k (1+ k))) (setcar (nthcdr j (nth i lu)) sum) (let ((dum (math-lud-pivot-check sum))) - (if (Math-lessp big dum) + (if (or (math-zerop big) (Math-lessp big dum)) (setq big dum imax i))) (setq i (1+ i))) diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index 6db5426ff6..9e36d91ac3 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -345,6 +345,30 @@ An existing calc stack is reused, otherwise a new one is created." (should (Math-num-integerp '(float 1 0))) (should-not (Math-num-integerp nil))) +(ert-deftest calc-matrix-determinant () + (should (equal (calcFunc-det '(vec (vec 3))) + 3)) + (should (equal (calcFunc-det '(vec (vec 2 3) (vec 6 7))) + -4)) + (should (equal (calcFunc-det '(vec (vec 1 2 3) (vec 4 5 7) (vec 9 6 2))) + 15)) + (should (equal (calcFunc-det '(vec (vec 0 5 7 3) + (vec 0 0 2 0) + (vec 1 2 3 4) + (vec 0 0 0 3))) + 30)) + (should (equal (calcFunc-det '(vec (vec (var a var-a)))) + '(var a var-a))) + (should (equal (calcFunc-det '(vec (vec 2 (var a var-a)) + (vec 7 (var a var-a)))) + '(* -5 (var a var-a)))) + (should (equal (calcFunc-det '(vec (vec 1 0 0 0) + (vec 0 1 0 0) + (vec 0 0 0 1) + (vec 0 0 (var a var-a) 0))) + '(neg (var a var-a))))) + + (provide 'calc-tests) ;;; calc-tests.el ends here commit a4671733b7b990e83ef6daed4d17ab240a3591b5 Author: Stefan Kangas Date: Thu May 14 01:28:03 2020 +0200 ; Fix warning after last change in cal-julian.el * lisp/calendar/cal-julian.el (diary-julian-date) (diary-astro-day-number): Silence byte-compiler warning about variable 'declared after its first use'. diff --git a/lisp/calendar/cal-julian.el b/lisp/calendar/cal-julian.el index 0458c11920..918995d0f9 100644 --- a/lisp/calendar/cal-julian.el +++ b/lisp/calendar/cal-julian.el @@ -182,23 +182,27 @@ Echo astronomical (Julian) day number unless NOECHO is non-nil." (calendar-astro-to-absolute daynumber)))) (or noecho (calendar-astro-print-day-number))) - -;; The function below is designed to be used in sexp diary entries, -;; and may be present in users' diary files, so suppress the warning -;; about this prefix-less dynamic variable. It's called from -;; `diary-list-sexp-entries', which binds the variable. -(with-suppressed-warnings ((lexical date)) - (defvar date)) - ;;;###diary-autoload (defun diary-julian-date () "Julian calendar equivalent of date diary entry." + ;; This function is designed to be used in sexp diary entries, and + ;; may be present in users' diary files, so suppress the warning + ;; about this prefix-less dynamic variable. It's called from + ;; `diary-list-sexp-entries', which binds the variable. + (with-suppressed-warnings ((lexical date)) + (defvar date)) (format "Julian date: %s" (calendar-julian-date-string date))) ;; To be called from diary-list-sexp-entries, where DATE is bound. ;;;###diary-autoload (defun diary-astro-day-number () "Astronomical (Julian) day number diary entry." + ;; This function is designed to be used in sexp diary entries, and + ;; may be present in users' diary files, so suppress the warning + ;; about this prefix-less dynamic variable. It's called from + ;; `diary-list-sexp-entries', which binds the variable. + (with-suppressed-warnings ((lexical date)) + (defvar date)) (format "Astronomical (Julian) day number at noon UTC: %s.0" (calendar-astro-date-string date))) commit f8a9edce7339273f9c56d27cc6999a22907638e7 Author: Michael Albinus Date: Wed May 13 14:11:18 2020 +0200 Fix some oddities, uncovered by Tramp tests * lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Prevent crash for older Emacsen. * lisp/net/tramp.el (tramp-process-running-p): Simplify. * test/lisp/net/tramp-tests.el (tramp-test28-process-file): Adapt test. (tramp-test33-environment-variables): Unset "INSIDE_EMACS" initially. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index f19e510eb6..704d65cd55 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -125,7 +125,10 @@ (autoload 'zeroconf-init "zeroconf") (tramp-compat-funcall 'dbus-get-unique-name :system) (tramp-compat-funcall 'dbus-get-unique-name :session) - (or (tramp-process-running-p "gvfs-fuse-daemon") + (or ;; Until Emacs 25, `process-attributes' could crash Emacs + ;; for some processes. Better we don't check. + (<= emacs-major-version 25) + (tramp-process-running-p "gvfs-fuse-daemon") (tramp-process-running-p "gvfsd-fuse")))) "Non-nil when GVFS is available.") diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index c8fdc5d728..70fb46bb4c 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3783,7 +3783,8 @@ support symbolic links." (defun tramp-handle-start-file-process (name buffer program &rest args) "Like `start-file-process' for Tramp files. BUFFER might be a list, in this case STDERR is separated." - ;; `make-process' knows the `:file-handler' argument since Emacs 27.1 only. + ;; `make-process' knows the `:file-handler' argument since Emacs + ;; 27.1 only. Therefore, we invoke it via `tramp-file-name-handler'. (tramp-file-name-handler 'make-process :name name @@ -4857,13 +4858,13 @@ verbosity of 6." "Return t if system process PROCESS-NAME is running for `user-login-name'." (when (stringp process-name) (catch 'result - (dolist (pid (tramp-compat-funcall 'list-system-processes)) - (let ((attributes (process-attributes pid))) + (dolist (pid (list-system-processes)) + (when-let ((attributes (process-attributes pid)) + (comm (cdr (assoc 'comm attributes)))) (and (string-equal (cdr (assoc 'user attributes)) (user-login-name)) - (when-let ((comm (cdr (assoc 'comm attributes)))) - ;; The returned command name could be truncated to 15 - ;; characters. Therefore, we cannot check for `string-equal'. - (string-prefix-p comm process-name)) + ;; The returned command name could be truncated to 15 + ;; characters. Therefore, we cannot check for `string-equal'. + (string-prefix-p comm process-name) (throw 'result t))))))) (defun tramp-read-passwd (proc &optional prompt) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 8c3cb8e2e8..de85f83982 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4208,10 +4208,19 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (should (zerop (process-file "true"))) (should-not (zerop (process-file "false"))) (should-not (zerop (process-file "binary-does-not-exist"))) - (should (= (if (getenv "EMACS_HYDRA_CI") 127 42) - (process-file "sh" nil nil nil "-c" "exit 42"))) + (should + (= 42 + (process-file + (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh") + nil nil nil "-c" "exit 42"))) ;; Return string in case the process is interrupted. - (should (stringp (process-file "sh" nil nil nil "-c" "kill -2 $$"))) + (should + (string-equal + "Signal 2" + (process-file + (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh") + nil nil nil "-c" "kill -2 $$"))) + (with-temp-buffer (write-region "foo" nil tmp-name) (should (file-exists-p tmp-name)) @@ -4874,6 +4883,7 @@ INPUT, if non-nil, is a string sent to the process." kill-buffer-query-functions) ;; Check INSIDE_EMACS. + (setenv "INSIDE_EMACS") (should (string-equal (format "%s,tramp:%s" emacs-version tramp-version) commit 9ebf51999ce58cccc2a228fd07a18c7b472dd3fd Author: João Távora Date: Wed May 13 11:31:21 2020 +0100 Turn Eldoc, Xref and Project into GNU ELPA :core packages The new packages state they require Emacs 26.3 to function, but a small part of project.el breaks this "soft" rule: the two functions requiring fileloop.el are incompatible with Emacs 26.3. * lisp/jsonrpc.el: Tweak comment near Package-Requires. * lisp/emacs-lisp/eldoc.el: Add Version and Package-Requires. * lisp/progmodes/flymake.el: Add comment near Package-Requires. * lisp/progmodes/project.el: Add Version and Package-Requires. * lisp/progmodes/xref.el: Add Version and Package-Requires. diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 4a2e7488eb..ef5dbf8103 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -5,6 +5,11 @@ ;; Author: Noah Friedman ;; Keywords: extensions ;; Created: 1995-10-06 +;; Version: 1.0.0 +;; Package-Requires: ((emacs "26.3")) + +;; This is a GNU ELPA :core package. Avoid functionality that is not +;; compatible with the version of Emacs recorded above. ;; This file is part of GNU Emacs. diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el index 6cf41311a1..293dfaa748 100644 --- a/lisp/jsonrpc.el +++ b/lisp/jsonrpc.el @@ -4,11 +4,11 @@ ;; Author: João Távora ;; Keywords: processes, languages, extensions -;; Package-Requires: ((emacs "25.2")) ;; Version: 1.0.11 +;; Package-Requires: ((emacs "25.2")) -;; This is an Elpa :core package. Don't use functionality that is not -;; compatible with Emacs 25.2. +;; This is a GNU ELPA :core package. Avoid functionality that is not +;; compatible with the version of Emacs recorded above. ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 7fca9dac1a..93a09d1096 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -5,8 +5,11 @@ ;; Author: Pavel Kobyakov ;; Maintainer: João Távora ;; Version: 1.0.8 -;; Package-Requires: ((emacs "26.1")) ;; Keywords: c languages tools +;; Package-Requires: ((emacs "26.1")) + +;; This is a GNU ELPA :core package. Avoid functionality that is not +;; compatible with the version of Emacs recorded above. ;; This file is part of GNU Emacs. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index f5f4092bab..ca8b5fa84e 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1,6 +1,11 @@ ;;; project.el --- Operations on the current project -*- lexical-binding: t; -*- ;; Copyright (C) 2015-2020 Free Software Foundation, Inc. +;; Version: 0.1 +;; Package-Requires: ((emacs "26.3")) + +;; This is a GNU ELPA :core package. Avoid using functionality that +;; not compatible with the version of Emacs recorded above. ;; This file is part of GNU Emacs. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index c36a9bd994..b516ff0fe9 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1,6 +1,11 @@ ;; xref.el --- Cross-referencing commands -*-lexical-binding:t-*- ;; Copyright (C) 2014-2020 Free Software Foundation, Inc. +;; Version: 1.0.0 +;; Package-Requires: ((emacs "26.3") (project "0.1")) + +;; This is a GNU ELPA :core package. Avoid functionality that is not +;; compatible with the version of Emacs recorded above. ;; This file is part of GNU Emacs. commit ac298baa0edf1426f2d46811b113f338f695e04c Author: Stefan Kangas Date: Wed May 13 12:13:52 2020 +0200 Use lexical-binding in t-mouse.el * lisp/t-mouse.el: Use lexical-binding. diff --git a/lisp/t-mouse.el b/lisp/t-mouse.el index fc174176cd..a1af53d8c4 100644 --- a/lisp/t-mouse.el +++ b/lisp/t-mouse.el @@ -1,4 +1,4 @@ -;;; t-mouse.el --- mouse support within the text terminal +;;; t-mouse.el --- mouse support within the text terminal -*- lexical-binding:t -*- ;; Author: Nick Roberts ;; Maintainer: emacs-devel@gnu.org