commit 18f390af8f11d24c2259131bd45cfd3156cfc234 (HEAD, refs/remotes/origin/master) Author: Glenn Morris Date: Sat Sep 12 20:22:37 2020 -0700 Don't force LC_ALL=C upon make check (bug#43353) * test/Makefile.in (TEST_LOCALE): Remove. (emacs): Don't force LC_ALL=C, since it causes problems with non-ascii directories. This mirrors a 7-year old lisp/Makefile change. diff --git a/test/Makefile.in b/test/Makefile.in index d1da02e582..9974eb54b0 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -89,11 +89,6 @@ unexport EMACSDATA EMACSDOC EMACSPATH GREP_OPTIONS ## To run tests under a debugger, set this to eg: "gdb --args". GDB = -# The locale to run tests under. Tests should work if this is set to -# any supported locale. Use the C locale by default, as it should be -# supported everywhere. -TEST_LOCALE = C - # Set this to 'yes' to run the tests in an interactive instance. TEST_INTERACTIVE ?= no @@ -128,7 +123,7 @@ endif # The actual Emacs command run in the targets below. # Prevent any setting of EMACSLOADPATH in user environment causing problems. -emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) \ +emacs = EMACSLOADPATH= \ EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \ $(GDB) "$(EMACS)" $(MODULES_EMACSOPT) $(EMACSOPT) commit 5e7733694e9bbf77759267b6d0386383315d48b3 Author: Glenn Morris Date: Sat Sep 12 19:44:06 2020 -0700 Mark some diff tests as failing in nonascii directories * test/lisp/vc/diff-mode-tests.el (diff-mode-test-font-lock) (diff-mode-test-font-lock-syntax-one-line): Expect failure in non-ascii directories. ; * lisp/vc/diff-mode.el (diff-hunk-file-names): Comment. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index a1fdd11ca0..f272db1f7d 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -931,8 +931,12 @@ If the OLD prefix arg is passed, tell the file NAME of the old file." (progn (diff-hunk-prev) (point)) (error (point-min))))) (header-files - ;; handle filenames with spaces; + ;; handle file names with spaces; ;; cf. diff-font-lock-keywords / diff-file-header + ;; FIXME if there are nonascii characters in the file names, + ;; GNU diff displays them as octal escapes. + ;; This function should undo that, so as to return file names + ;; that are usable in Emacs. (if (looking-at "[-*][-*][-*] \\([^\t\n]+\\).*\n[-+][-+][-+] \\([^\t\n]+\\)") (list (if old (match-string 1) (match-string 2)) (if old (match-string 2) (match-string 1))) diff --git a/test/lisp/vc/diff-mode-tests.el b/test/lisp/vc/diff-mode-tests.el index e497ed204d..f17ec3648f 100644 --- a/test/lisp/vc/diff-mode-tests.el +++ b/test/lisp/vc/diff-mode-tests.el @@ -206,6 +206,11 @@ youthfulness (ert-deftest diff-mode-test-font-lock () "Check font-locking of diff hunks." + ;; See comments in diff-hunk-file-names about nonascii. + ;; In such cases, the diff-font-lock-syntax portion of this fails. + :expected-result (if (string-match-p "[[:nonascii:]]" + diff-mode-tests--datadir) + :failed :passed) (skip-unless (executable-find shell-file-name)) (skip-unless (executable-find diff-command)) (let ((default-directory diff-mode-tests--datadir) @@ -244,6 +249,7 @@ youthfulness 111 124 (face diff-context) 124 127 (face diff-context)))) + ;; Test diff-font-lock-syntax. (should (equal (mapcar (lambda (o) (list (- (overlay-start o) diff-beg) (- (overlay-end o) diff-beg) @@ -267,6 +273,9 @@ youthfulness (ert-deftest diff-mode-test-font-lock-syntax-one-line () "Check diff syntax highlighting for one line with no newline at end." + :expected-result (if (string-match-p "[[:nonascii:]]" + diff-mode-tests--datadir) + :failed :passed) (skip-unless (executable-find shell-file-name)) (skip-unless (executable-find diff-command)) (let ((default-directory diff-mode-tests--datadir) commit 854855ec68c595edcce1b2dc768b20a65e41d0af Author: Lars Ingebrigtsen Date: Sun Sep 13 01:02:00 2020 +0200 Clean up eww error buffer * lisp/net/eww.el (eww-retrieve): Clean up error buffer after exiting. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index bc23fb913f..5fd4490193 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -362,20 +362,26 @@ killed after rendering." (if (null eww-retrieve-command) (url-retrieve url #'eww-render (list url nil (current-buffer))) - (let ((buffer (generate-new-buffer " *eww retrieve*"))) + (let ((buffer (generate-new-buffer " *eww retrieve*")) + (error-buffer (generate-new-buffer " *eww error*"))) (with-current-buffer buffer (set-buffer-multibyte nil) (make-process :name "*eww fetch*" :buffer (current-buffer) - :stderr (get-buffer-create " *eww error*") + :stderr error-buffer :command (append eww-retrieve-command (list url)) :sentinel (lambda (process _) (unless (process-live-p process) - (with-current-buffer buffer - (goto-char (point-min)) - (insert "Content-type: text/html; charset=utf-8\n\n") - (apply #'funcall callback nil cbargs))))))))) + (when (buffer-live-p error-buffer) + (when (get-buffer-process error-buffer) + (delete-process (get-buffer-process error-buffer) )) + (kill-buffer error-buffer)) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (goto-char (point-min)) + (insert "Content-type: text/html; charset=utf-8\n\n") + (apply #'funcall callback nil cbargs)))))))))) (function-put 'eww 'browse-url-browser-kind 'internal) commit f7d8650187e4720ba6a889da30535e3cdc1249a9 Author: Lars Ingebrigtsen Date: Sun Sep 13 00:44:20 2020 +0200 Fix up example code from previous eww.texi commit * doc/misc/eww.texi (Advanced): Simplify example command (and "--virtual-time-budget=3000" makes Chromium unstable). diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index e814d0ac48..a9513e446a 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -221,9 +221,7 @@ use the Chromium browser, you could say something like this: @lisp (setq eww-retrieve-command - '("chromium" "--headless" - "--virtual-time-budget=3000" - "--dump-dom")) + '("chromium" "--headless" "--dump-dom")) @end lisp The command should return the @acronym{HTML} on standard output, and commit 31be4d7ca48fd21bdcd5428ce4164790efd39099 Author: Lars Ingebrigtsen Date: Sun Sep 13 00:12:33 2020 +0200 Add a way to use an external command to download HTML in eww * doc/misc/eww.texi (Advanced): Document it. * lisp/net/eww.el (eww-retrieve): New function. (eww-reload): Use it. (eww): Ditto. (eww-retrieve-command): New variable. diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index 85be112402..e814d0ac48 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -212,6 +212,23 @@ in an external browser by customizing @node Advanced @chapter Advanced +@findex eww-retrieve-command + EWW normally uses @code{url-retrieve} to fetch the @acronym{HTML} +before rendering it. It can sometimes be convenient to use an external +program to do this, and @code{eww-retrieve-command} should then be a +list that specifies a command and the parameters. For instance, to +use the Chromium browser, you could say something like this: + +@lisp +(setq eww-retrieve-command + '("chromium" "--headless" + "--virtual-time-budget=3000" + "--dump-dom")) +@end lisp + +The command should return the @acronym{HTML} on standard output, and +the data should use @acronym{UTF-8} as the charset. + @findex eww-view-source @kindex v @cindex Viewing Source diff --git a/etc/NEWS b/etc/NEWS index 8ff62b6dc0..ddc2fb9d60 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -808,6 +808,11 @@ background colors or transparency, such as xbm, pbm, svg, png and gif. ** EWW ++++ +*** New variable 'eww-retrieve-command'. +This can be used to download data via an external command. If nil +(the default), then 'url-retrieve' is used. + +++ *** New Emacs command line convenience function. The 'eww-browse' command has been added, which allows you to register diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 07aa48aeae..bc23fb913f 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -134,6 +134,15 @@ The string will be passed through `substitute-command-keys'." :type '(choice (const :tag "Unlimited" nil) integer)) +(defcustom eww-retrieve-command nil + "Command to retrieve an URL via an external program. +If nil, `url-retrieve' is used to download the data. If non-nil, +this should be a list where the first item is the program, and +the rest are the arguments." + :version "28.1" + :type '(choice (const :tag "Use `url-retrieve'" nil) + (list string))) + (defcustom eww-use-external-browser-for-content-type "\\`\\(video/\\|audio/\\|application/ogg\\)" "Always use external browser for specified content-type." @@ -346,9 +355,28 @@ killed after rendering." (let ((eww-buffer (current-buffer))) (with-current-buffer buffer (eww-render nil url nil eww-buffer))) - (url-retrieve url #'eww-render + (eww-retrieve url #'eww-render (list url nil (current-buffer)))))) +(defun eww-retrieve (url callback cbargs) + (if (null eww-retrieve-command) + (url-retrieve url #'eww-render + (list url nil (current-buffer))) + (let ((buffer (generate-new-buffer " *eww retrieve*"))) + (with-current-buffer buffer + (set-buffer-multibyte nil) + (make-process + :name "*eww fetch*" + :buffer (current-buffer) + :stderr (get-buffer-create " *eww error*") + :command (append eww-retrieve-command (list url)) + :sentinel (lambda (process _) + (unless (process-live-p process) + (with-current-buffer buffer + (goto-char (point-min)) + (insert "Content-type: text/html; charset=utf-8\n\n") + (apply #'funcall callback nil cbargs))))))))) + (function-put 'eww 'browse-url-browser-kind 'internal) (defun eww--dwim-expand-url (url) @@ -1117,7 +1145,7 @@ just re-display the HTML already fetched." (eww-display-html 'utf-8 url (plist-get eww-data :dom) (point) (current-buffer))) (let ((url-mime-accept-string eww-accept-content-types)) - (url-retrieve url #'eww-render + (eww-retrieve url #'eww-render (list url (point) (current-buffer) encode)))))) ;; Form support. commit 3e073520b341228d7a54a242e3d09862948e5c08 Author: Glenn Morris Date: Sat Sep 12 11:57:42 2020 -0700 Adapt some tests for Emacs's excitingly variable quoting format * test/lisp/subr-tests.el (subr-test-version-parsing): * test/lisp/emacs-lisp/gv-tests.el (gv-dont-define-expander-other-file): * test/src/callint-tests.el (call-interactively/incomplete-multibyte-sequence): * test/src/emacs-module-tests.el (module/describe-function-1): Don't fail if curly quotes are in use, as they can be if LC_ALL != C. diff --git a/test/lisp/emacs-lisp/gv-tests.el b/test/lisp/emacs-lisp/gv-tests.el index 10e3b531f3..29e4273b47 100644 --- a/test/lisp/emacs-lisp/gv-tests.el +++ b/test/lisp/emacs-lisp/gv-tests.el @@ -135,8 +135,9 @@ "--eval" (prin1-to-string '(progn (setf (gv-test-foo gv-test-pair) 99) (message "%d" (car gv-test-pair))))) - (should (equal (buffer-string) - "Symbol's function definition is void: \\(setf\\ gv-test-foo\\)\n"))))) + (should (string-match + "\\`Symbol.s function definition is void: \\\\(setf\\\\ gv-test-foo\\\\)\n\\'" + (buffer-string)))))) (ert-deftest gv-setter-edebug () "Check that a setter can be defined and edebugged together with diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index e2761a96f8..2df5537102 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -172,27 +172,28 @@ (should (equal (version-to-list "6.9.30Beta") '(6 9 30 -2))) (should (equal (version-to-list "6.9.30_Beta") '(6 9 30 -2))) - (should (equal - (error-message-string (should-error (version-to-list "OTP-18.1.5"))) - "Invalid version syntax: `OTP-18.1.5' (must start with a number)")) - (should (equal - (error-message-string (should-error (version-to-list ""))) - "Invalid version syntax: `' (must start with a number)")) - (should (equal - (error-message-string (should-error (version-to-list "1.0..7.5"))) - "Invalid version syntax: `1.0..7.5'")) - (should (equal - (error-message-string (should-error (version-to-list "1.0prepre2"))) - "Invalid version syntax: `1.0prepre2'")) - (should (equal - (error-message-string (should-error (version-to-list "22.8X3"))) - "Invalid version syntax: `22.8X3'")) - (should (equal - (error-message-string (should-error (version-to-list "beta22.8alpha3"))) - "Invalid version syntax: `beta22.8alpha3' (must start with a number)")) - (should (equal - (error-message-string (should-error (version-to-list "honk"))) - "Invalid version syntax: `honk' (must start with a number)")) + (let ((text-quoting-style 'grave)) + (should (equal + (error-message-string (should-error (version-to-list "OTP-18.1.5"))) + "Invalid version syntax: `OTP-18.1.5' (must start with a number)")) + (should (equal + (error-message-string (should-error (version-to-list ""))) + "Invalid version syntax: `' (must start with a number)")) + (should (equal + (error-message-string (should-error (version-to-list "1.0..7.5"))) + "Invalid version syntax: `1.0..7.5'")) + (should (equal + (error-message-string (should-error (version-to-list "1.0prepre2"))) + "Invalid version syntax: `1.0prepre2'")) + (should (equal + (error-message-string (should-error (version-to-list "22.8X3"))) + "Invalid version syntax: `22.8X3'")) + (should (equal + (error-message-string (should-error (version-to-list "beta22.8alpha3"))) + "Invalid version syntax: `beta22.8alpha3' (must start with a number)")) + (should (equal + (error-message-string (should-error (version-to-list "honk"))) + "Invalid version syntax: `honk' (must start with a number)"))) (should (equal (error-message-string (should-error (version-to-list 9))) "Version must be a string")) @@ -231,18 +232,19 @@ (should (equal (version-to-list "6_9_30.Beta") '(6 9 30 -2))) (should (equal (version-to-list "6_9_30Beta") '(6 9 30 -2))) - (should (equal - (error-message-string (should-error (version-to-list "1_0__7_5"))) - "Invalid version syntax: `1_0__7_5'")) - (should (equal - (error-message-string (should-error (version-to-list "1_0prepre2"))) - "Invalid version syntax: `1_0prepre2'")) - (should (equal - (error-message-string (should-error (version-to-list "22.8X3"))) - "Invalid version syntax: `22.8X3'")) - (should (equal - (error-message-string (should-error (version-to-list "beta22_8alpha3"))) - "Invalid version syntax: `beta22_8alpha3' (must start with a number)")))) + (let ((text-quoting-style 'grave)) + (should (equal + (error-message-string (should-error (version-to-list "1_0__7_5"))) + "Invalid version syntax: `1_0__7_5'")) + (should (equal + (error-message-string (should-error (version-to-list "1_0prepre2"))) + "Invalid version syntax: `1_0prepre2'")) + (should (equal + (error-message-string (should-error (version-to-list "22.8X3"))) + "Invalid version syntax: `22.8X3'")) + (should (equal + (error-message-string (should-error (version-to-list "beta22_8alpha3"))) + "Invalid version syntax: `beta22_8alpha3' (must start with a number)"))))) (ert-deftest subr-test-version-list-< () (should (version-list-< '(0) '(1))) diff --git a/test/src/callint-tests.el b/test/src/callint-tests.el index c2010ae31d..42dae42447 100644 --- a/test/src/callint-tests.el +++ b/test/src/callint-tests.el @@ -29,7 +29,8 @@ (ert-deftest call-interactively/incomplete-multibyte-sequence () "Check that Bug#30004 is fixed." - (let ((data (should-error (call-interactively (lambda () (interactive "\xFF")))))) + (let* ((text-quoting-style 'grave) + (data (should-error (call-interactively (lambda () (interactive "\xFF")))))) (should (equal (cdr data) diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 0fd8e1db49..096c6b3057 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -309,7 +309,8 @@ local reference." (ert-deftest module/describe-function-1 () "Check that Bug#30163 is fixed." (with-temp-buffer - (let ((standard-output (current-buffer))) + (let ((standard-output (current-buffer)) + (text-quoting-style 'grave)) (describe-function-1 #'mod-test-sum) (goto-char (point-min)) (while (re-search-forward "`[^']*/data/emacs-module/" nil t) commit 6818867a2e8e5af8fd4fce89771c241bc418d36b Author: Glenn Morris Date: Sat Sep 12 10:52:50 2020 -0700 ; Fix copyright years diff --git a/test/lisp/gnus/mml-sec-tests.el b/test/lisp/gnus/mml-sec-tests.el index 0911932665..b715383c77 100644 --- a/test/lisp/gnus/mml-sec-tests.el +++ b/test/lisp/gnus/mml-sec-tests.el @@ -1,5 +1,5 @@ ;;; mml-sec-tests.el --- Tests mml-sec.el, see README-mml-secure.txt. -*- lexical-binding:t -*- -;; Copyright (C) 2015 Free Software Foundation, Inc. +;; Copyright (C) 2015, 2020 Free Software Foundation, Inc. ;; Author: Jens Lechtenbörger commit 2fca3015ddcbdfee524ff58bb4ce31bf1f91a3c4 Author: Michael Albinus Date: Sat Sep 12 19:33:44 2020 +0200 Cleanup in dbus.el, dbus-tests.el * lisp/net/dbus.el (dbus-error-no-reply): New defconst. (dbus-call-method): Use it. (dbus-call-method-asynchronously, dbus-register-signal): Fix docstring. (dbus-unregister-object): Obey :serial entries in `dbus-registered-objects-table'. * test/lisp/net/dbus-tests.el (dbus-test04-register-method) (dbus-test05-register-property): Extend tests. diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index fddd6df963..d4e6cb943d 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -178,6 +178,9 @@ See /usr/include/dbus-1.0/dbus/dbus-protocol.h.") (defconst dbus-error-invalid-args (concat dbus-error-dbus ".InvalidArgs") "Invalid arguments passed to a method call.") +(defconst dbus-error-no-reply (concat dbus-error-dbus ".NoReply") + "No reply to a message expecting one, usually means a timeout occurred.") + (defconst dbus-error-property-read-only (concat dbus-error-dbus ".PropertyReadOnly") "Property you tried to set is read-only.") @@ -369,23 +372,24 @@ object is returned instead of a list containing this single Lisp object. (puthash key result dbus-return-values-table) (unwind-protect - (progn - (with-timeout ((if timeout (/ timeout 1000.0) 25) - (signal 'dbus-error (list "call timed out"))) - (while (eq (car result) :pending) - (let ((event (let ((inhibit-redisplay t) unread-command-events) - (read-event nil nil check-interval)))) - (when event - (if (ignore-errors (dbus-check-event event)) - (setf result (gethash key dbus-return-values-table)) - (setf unread-command-events - (nconc unread-command-events - (cons event nil))))) - (when (< check-interval 1) - (setf check-interval (* check-interval 1.05)))))) - (when (eq (car result) :error) - (signal (cadr result) (cddr result))) - (cdr result)) + (progn + (with-timeout + ((if timeout (/ timeout 1000.0) 25) + (signal 'dbus-error `(,dbus-error-no-reply "Call timed out"))) + (while (eq (car result) :pending) + (let ((event (let ((inhibit-redisplay t) unread-command-events) + (read-event nil nil check-interval)))) + (when event + (if (ignore-errors (dbus-check-event event)) + (setf result (gethash key dbus-return-values-table)) + (setf unread-command-events + (nconc unread-command-events + (cons event nil))))) + (when (< check-interval 1) + (setf check-interval (* check-interval 1.05)))))) + (when (eq (car result) :error) + (signal (cadr result) (cddr result))) + (cdr result)) (remhash key dbus-return-values-table)))) (defun dbus-call-method-asynchronously @@ -430,7 +434,7 @@ Example: \(dbus-call-method-asynchronously :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/devices/computer\" - \"org.freedesktop.Hal.Device\" \"GetPropertyString\" \\='message + \"org.freedesktop.Hal.Device\" \"GetPropertyString\" #\\='message \"system.kernel.machine\") -| i686 @@ -710,7 +714,7 @@ Example: \(dbus-register-signal :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/Manager\" - \"org.freedesktop.Hal.Manager\" \"DeviceAdded\" \\='my-signal-handler) + \"org.freedesktop.Hal.Manager\" \"DeviceAdded\" #\\='my-signal-handler) => ((:signal :system \"org.freedesktop.Hal.Manager\" \"DeviceAdded\") (\"org.freedesktop.Hal\" \"/org/freedesktop/Hal/Manager\" my-signal-handler)) @@ -922,16 +926,19 @@ association to the service from D-Bus." (progn (maphash (lambda (k v) - (dolist (e v) - (ignore-errors - (and - ;; Bus. - (equal bus (cadr k)) - ;; Service. - (string-equal service (cadr e)) - ;; Non-empty object path. - (nth 2 e) - (throw :found t))))) + (when (consp v) + (dolist (e v) + (ignore-errors + (and + ;; Type. + (eq type (car k)) + ;; Bus. + (equal bus (cadr k)) + ;; Service. + (string-equal service (cadr e)) + ;; Non-empty object path. + (nth 2 e) + (throw :found t)))))) dbus-registered-objects-table) nil)))) (dbus-unregister-service bus service)) @@ -1934,6 +1941,8 @@ this connection to those buses." ;; * Implement org.freedesktop.DBus.ObjectManager.InterfacesAdded and ;; org.freedesktop.DBus.ObjectManager.InterfacesRemoved. ;; +;; * Implement org.freedesktop.DBus.Monitoring.BecomeMonitor. +;; ;; * Cache introspection data. ;; ;; * Run handlers in own threads. diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el index 73401a8c92..d470bca226 100644 --- a/test/lisp/net/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -214,28 +214,39 @@ This includes initialization and closing the bus." (dbus-ignore-errors (dbus-unregister-service :session dbus--test-service)) (unwind-protect - (let ((method "Method") - (handler #'dbus--test-method-handler)) + (let ((method1 "Method1") + (method2 "Method2") + (handler #'dbus--test-method-handler) + registered) + (should + (equal + (setq + registered + (dbus-register-method + :session dbus--test-service dbus--test-path + dbus--test-interface method1 handler)) + `((:method :session ,dbus--test-interface ,method1) + (,dbus--test-service ,dbus--test-path ,handler)))) (should (equal (dbus-register-method :session dbus--test-service dbus--test-path - dbus--test-interface method handler) - `((:method :session ,dbus--test-interface ,method) + dbus--test-interface method2 handler) + `((:method :session ,dbus--test-interface ,method2) (,dbus--test-service ,dbus--test-path ,handler)))) ;; No argument, returns nil. (should-not (dbus-call-method :session dbus--test-service dbus--test-path - dbus--test-interface method)) + dbus--test-interface method1)) ;; One argument, returns the argument. (should (string-equal (dbus-call-method :session dbus--test-service dbus--test-path - dbus--test-interface method "foo") + dbus--test-interface method1 "foo") "foo")) ;; Two arguments, D-Bus error activated as `(:error ...)' list. (should @@ -243,7 +254,7 @@ This includes initialization and closing the bus." (should-error (dbus-call-method :session dbus--test-service dbus--test-path - dbus--test-interface method "foo" "bar")) + dbus--test-interface method1 "foo" "bar")) `(dbus-error ,dbus-error-invalid-args "Wrong arguments (foo bar)"))) ;; Three arguments, D-Bus error activated by `dbus-error' signal. (should @@ -251,15 +262,28 @@ This includes initialization and closing the bus." (should-error (dbus-call-method :session dbus--test-service dbus--test-path - dbus--test-interface method "foo" "bar" "baz")) + dbus--test-interface method1 "foo" "bar" "baz")) `(dbus-error ,dbus-error-failed - "D-Bus error: \"D-Bus signal\", \"foo\", \"bar\", \"baz\"")))) + "D-Bus error: \"D-Bus signal\", \"foo\", \"bar\", \"baz\""))) + + ;; Unregister method. + (should (dbus-unregister-object registered)) + (should-not (dbus-unregister-object registered)) + (should + (equal + ;; We don't care the error message text. + (butlast + (should-error + (dbus-call-method + :session dbus--test-service dbus--test-path + dbus--test-interface method1 :timeout 10 "foo"))) + `(dbus-error ,dbus-error-no-reply)))) ;; Cleanup. (dbus-unregister-service :session dbus--test-service))) -;; TODO: Test emits-signal, unregister. +;; TODO: Test emits-signal. (ert-deftest dbus-test05-register-property () "Check property registration for an own service." (skip-unless dbus--test-enabled-session-bus) @@ -269,14 +293,17 @@ This includes initialization and closing the bus." (let ((property1 "Property1") (property2 "Property2") (property3 "Property3") - (property4 "Property4")) + (property4 "Property4") + registered) ;; `:read' property. (should (equal - (dbus-register-property - :session dbus--test-service dbus--test-path - dbus--test-interface property1 :read "foo") + (setq + registered + (dbus-register-property + :session dbus--test-service dbus--test-path + dbus--test-interface property1 :read "foo")) `((:property :session ,dbus--test-interface ,property1) (,dbus--test-service ,dbus--test-path)))) (should @@ -419,7 +446,25 @@ This includes initialization and closing the bus." (should (setq result (cadr (assoc dbus--test-interface result)))) (should (string-equal (cdr (assoc property1 result)) "foo")) (should (string-equal (cdr (assoc property3 result)) "/baz/baz")) - (should-not (assoc property2 result)))) + (should-not (assoc property2 result))) + + ;; Unregister property. + (should (dbus-unregister-object registered)) + (should-not (dbus-unregister-object registered)) + (should-not + (dbus-get-property + :session dbus--test-service dbus--test-path + dbus--test-interface property1)) + (let ((dbus-show-dbus-errors t)) + (should + (equal + ;; We don't care the error message text. + (butlast + (should-error + (dbus-get-property + :session dbus--test-service dbus--test-path + dbus--test-interface property1))) + `(dbus-error ,dbus-error-unknown-property))))) ;; Cleanup. (dbus-unregister-service :session dbus--test-service))) commit 62f239eec2be42d857cc91009b4b7d8c8cf31b4e Author: Alan Mackenzie Date: Sat Sep 12 16:37:56 2020 +0000 C++ Mode: handle __attribute__,etc. inside constructor argument lists This corrects both the fontification and indentation of these things, fixing bug #42270. * lisp/progmodes/cc-engine.el (c-do-declarators): Skip over "hangon keys" and noise macros whilst scanning a putative C++ function. (c-forward-decl-or-cast-1): When checking for typeless functions, skip over "hangon keys" and noise macros. * lisp/progmodes/cc-mode.el (c-fl-decl-end): Deal with certain invalid "nested declarators" by scanning over them with a recursive call of c-fl-decl-end. * lisp/progmodes/cc-vars.el (c-noise-macro-names) (c-noise-macro-with-parens-names): State in the doc strings that if either of these is a regexp, it must have a submatch 1 which matches the noise macro exactly. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 7ff424c6a7..7d10027c76 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -2238,7 +2238,7 @@ comment at the start of cc-engine.el for more info." ((and c-opt-cpp-prefix (looking-at c-noise-macro-name-re)) - ;; Skip over a noise macro. + ;; Skip over a noise macro without parens. (goto-char (match-end 1)) (not (eobp))) @@ -9130,6 +9130,12 @@ This function might do hidden buffer changes." (catch 'is-function (while (progn + (while + (cond + ((looking-at c-decl-hangon-key) + (c-forward-keyword-clause 1)) + ((looking-at c-noise-macro-with-parens-name-re) + (c-forward-noise-clause)))) (if (eq (char-after) ?\)) (throw 'is-function t)) (setq cdd-got-type (c-forward-type)) @@ -9782,6 +9788,16 @@ This function might do hidden buffer changes." (save-excursion (goto-char after-paren-pos) (c-forward-syntactic-ws) + (progn + (while + (cond + ((and + c-opt-cpp-prefix + (looking-at c-noise-macro-with-parens-name-re)) + (c-forward-noise-clause)) + ((looking-at c-decl-hangon-key) + (c-forward-keyword-clause 1)))) + t) (or (c-forward-type) ;; Recognize a top-level typeless ;; function declaration in C. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 73275cfa62..c6dd671051 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2266,7 +2266,8 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") (defun c-fl-decl-end (pos) ;; If POS is inside a declarator, return the end of the token that follows ;; the declarator, otherwise return nil. POS being in a literal does not - ;; count as being in a declarator (on pragmatic grounds). + ;; count as being in a declarator (on pragmatic grounds). POINT is not + ;; preserved. (goto-char pos) (let ((lit-start (c-literal-start)) enclosing-attribute pos1) @@ -2279,12 +2280,31 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") (let ((lim (save-excursion (and (c-beginning-of-macro) (progn (c-end-of-macro) (point)))))) - (when (and (c-forward-declarator lim) - (or (not (eq (char-after) ?\()) - (c-go-list-forward nil lim)) - (eq (c-forward-token-2 1 nil lim) 0)) - (c-backward-syntactic-ws) - (point))))))) + (and (c-forward-declarator lim) + (if (eq (char-after) ?\() + (and + (c-go-list-forward nil lim) + (progn (c-forward-syntactic-ws lim) + (not (eobp))) + (progn + (if (looking-at c-symbol-char-key) + ;; Deal with baz (foo((bar)) type var), where + ;; foo((bar)) is not semantically valid. The result + ;; must be after var). + (and + (goto-char pos) + (setq pos1 (c-on-identifier)) + (goto-char pos1) + (progn + (c-backward-syntactic-ws) + (eq (char-before) ?\()) + (c-fl-decl-end (1- (point)))) + (c-backward-syntactic-ws) + (point)))) + (and (progn (c-forward-syntactic-ws lim) + (not (eobp))) + (c-backward-syntactic-ws) + (point))))))))) (defun c-change-expand-fl-region (_beg _end _old-len) ;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index b885f6ae1d..9e6f9527ca 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1670,7 +1670,8 @@ indented as a statement." like \"INLINE\" which are syntactic noise. Such a macro/extension is complete in itself, never having parentheses. All these names must be syntactically valid identifiers. Alternatively, this variable may be a regular expression -which matches the names of such macros. +which matches the names of such macros, in which case it must have a submatch +1 which matches the actual noise macro name. If you change this variable's value, call the function `c-make-noise-macro-regexps' to set the necessary internal variables (or do @@ -1686,7 +1687,8 @@ this implicitly by reinitializing C/C++/Objc Mode on any buffer)." which optionally have arguments in parentheses, and which expand to nothing. All these names must be syntactically valid identifiers. These are recognized by CC Mode only in declarations. Alternatively, this variable may be a -regular expression which matches the names of such macros. +regular expression which matches the names of such macros, in which case it +must have a submatch 1 which matches the actual noise macro name. If you change this variable's value, call the function `c-make-noise-macro-regexps' to set the necessary internal variables (or do commit d228cac2e8d7026231daf1c97fb37279d61420a9 Author: Glenn Morris Date: Sat Sep 12 09:06:10 2020 -0700 Small Texinfo markup fixes * doc/misc/dbus.texi (Register Objects): * doc/misc/gnus.texi (Searching): Texinfo markup fixes. diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index dcee55de45..1d4db7e7ab 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi @@ -1471,7 +1471,7 @@ If @var{handler} returns a reply message with an empty argument list, to distinguish it from @code{nil} (the boolean false). If @var{handler} detects an error, it shall return the list -@code{(:error @var{error-name} @var{error-message)}}. +@code{(:error @var{error-name} @var{error-message})}. @var{error-name} is a namespaced string which characterizes the error type, and @var{error-message} is a free text string. Alternatively, any Emacs signal @code{dbus-error} in @var{handler} raises a D-Bus diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 4a09eacdf1..50eeb3efa3 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -21401,8 +21401,8 @@ be nice. Gnus has various ways of finding articles that match certain criteria (from a particular author, on a certain subject, etc.). The simplest method is to enter a group and then either "limit" the summary buffer -to the desired articles using the limiting commands (@xref{Limiting}), -or searching through messages in the summary buffer (@xref{Searching +to the desired articles using the limiting commands (@pxref{Limiting}), +or searching through messages in the summary buffer (@pxref{Searching for Articles}). Limiting commands and summary buffer searching work on subsets of the commit b9ff508a2ead61cc230f48506193e38a8d24dd83 Author: Lars Ingebrigtsen Date: Sat Sep 12 15:10:36 2020 +0200 Fix compilation warning in cl-font-lock * lisp/progmodes/cl-font-lock.el (cl-font-lock-built-in-mode): Put in the tools group to avoid a compilation warning. diff --git a/lisp/progmodes/cl-font-lock.el b/lisp/progmodes/cl-font-lock.el index 7ef43fd449..65090ac3ca 100644 --- a/lisp/progmodes/cl-font-lock.el +++ b/lisp/progmodes/cl-font-lock.el @@ -277,6 +277,7 @@ (define-minor-mode cl-font-lock-built-in-mode "Highlight built-in functions, variables, and types in `lisp-mode'." :global t + :group 'tools (funcall (if cl-font-lock-built-in-mode #'font-lock-add-keywords commit 661c0dfa2f8af202535719477718413d1c094959 Author: Lars Ingebrigtsen Date: Sat Sep 12 15:08:41 2020 +0200 Fix compilation warning in obsolete/complete.el * lisp/obsolete/complete.el (completion-base-size): Avoid compilation warning. diff --git a/lisp/obsolete/complete.el b/lisp/obsolete/complete.el index bf16fb25cd..b1448e72e8 100644 --- a/lisp/obsolete/complete.el +++ b/lisp/obsolete/complete.el @@ -431,6 +431,8 @@ of `minibuffer-completion-table' and the minibuffer contents.") (let ((result (try-completion string alist predicate))) (if (eq result t) string result))) +(defvar completion-base-size) + ;; TODO document MODE magic... (defun PC-do-completion (&optional mode beg end goto-end) "Internal function to do the work of partial completion. commit 97e9bddd0fc1a4cf83cdb0bfa12997f7e7d52f0d Author: Lars Ingebrigtsen Date: Sat Sep 12 15:06:58 2020 +0200 Fix compilation warning in cl-lib.el * lisp/emacs-lisp/cl-lib.el (cl-old-struct-compat-mode): Put the minor mode in the tools group (to avoid a compilation warning). diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 7a4d3c9c3e..86ee94e87e 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -663,6 +663,7 @@ This can be needed when using code byte-compiled using the old macro-expansion of `cl-defstruct' that used vectors objects instead of record objects." :global t + :group 'tools (cond (cl-old-struct-compat-mode (advice-add 'type-of :around #'cl--old-struct-type-of)) commit 227f93abcc8144e47feced18e750f687244abddc Author: Lars Ingebrigtsen Date: Sat Sep 12 15:01:32 2020 +0200 dired-omit-mode may not be defined in dired-jump * lisp/dired.el (dired-jump): dired-omit-mode is in dired-x, so it may not be defined in dired. diff --git a/lisp/dired.el b/lisp/dired.el index 0d7ec2fa87..6e7b88f019 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -4528,7 +4528,7 @@ Interactively with prefix argument, read FILE-NAME." (dired-insert-subdir (file-name-directory file)) (dired-goto-file file)) ;; Toggle omitting, if it is on, and try again. - (when dired-omit-mode + (when (bound-and-true-p dired-omit-mode) (dired-omit-mode) (dired-goto-file file))))))))) commit 4c3f3bf25623c936ca07249203147ae0332d64ed Author: Alex Bochannek Date: Sat Sep 12 14:04:02 2020 +0200 Support scoring on article age interactively in Gnus * lisp/gnus/gnus-score.el (gnus-summary-score-entry): Support scoring on article age in interactive scoring (bug#43270). diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el index 6a0e8ceb99..ffc6b8ca34 100644 --- a/lisp/gnus/gnus-score.el +++ b/lisp/gnus/gnus-score.el @@ -862,6 +862,18 @@ If optional argument `EXTRA' is non-nil, it's a non-standard overview header." (setq match (string-to-number match))) (set-text-properties 0 (length match) nil match)) + ;; Modify match and type for article age scoring. + (if (string= "date" (nth 0 (assoc header gnus-header-index))) + (let ((age (string-to-number match))) + (if (or (< age 0) + (string= "0" match)) + (user-error "Article age must be a positive number")) + (setq match age + type (cond ((eq type 'after) + '<) + ((eq type 'before) + '>))))) + (unless (eq date 'now) ;; Add the score entry to the score file. (when (= score gnus-score-interactive-default-score) commit a4bfb0bc5c14e002c0926fc320aeb4a3fc261447 Author: Glenn Morris Date: Sat Sep 12 13:37:23 2020 +0200 Default Emacs to UTF-8 instead of Latin-1 * doc/emacs/mule.texi (File Name Coding): Document it. * lisp/international/mule-cmds.el (reset-language-environment): Default to utf-8 instead of latin-1. * lisp/mail/sendmail.el (default-sendmail-coding-system): Ditto. * lisp/mh-e/mh-comp.el (mh-send-letter): Ditto. diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi index 6eff0ca0d2..b78019020a 100644 --- a/doc/emacs/mule.texi +++ b/doc/emacs/mule.texi @@ -1215,11 +1215,8 @@ system can encode. If @code{file-name-coding-system} is @code{nil}, Emacs uses a default coding system determined by the selected language environment, -and stored in the @code{default-file-name-coding-system} variable. -@c FIXME? Is this correct? What is the "default language environment"? -In the default language environment, non-@acronym{ASCII} characters in -file names are not encoded specially; they appear in the file system -using the internal Emacs representation. +and stored in the @code{default-file-name-coding-system} variable +(normally UTF-8). @cindex file-name encoding, MS-Windows @vindex w32-unicode-filenames diff --git a/etc/NEWS b/etc/NEWS index 50ba39cb44..8ff62b6dc0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -85,6 +85,12 @@ useful on systems such as FreeBSD which ships only with "etc/termcap". * Changes in Emacs 28.1 ++++ +*** Emacs now defaults to UTF-8 instead of ISO-8859-1. +This is only for the default, where the user has set no LANG (or +similar) variable or environment. This change should lead to no +user-visible changes for normal usage. + +++ ** New variables that hold default buffer names for shell output. The new constants 'shell-command-buffer-name' and diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index ccc8ac9f9e..e3155dfc52 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -1799,13 +1799,11 @@ The default status is as follows: 'raw-text) (set-default-coding-systems nil) - (setq default-sendmail-coding-system 'iso-latin-1) - ;; On Darwin systems, this should be utf-8-unix, but when this file is loaded - ;; that is not yet defined, so we set it in set-locale-environment instead. - ;; [Actually, it seems to work fine to use utf-8-unix here, and not just - ;; on Darwin. The previous comment seems to be outdated? - ;; See patch at https://debbugs.gnu.org/15803 ] - (setq default-file-name-coding-system 'iso-latin-1-unix) + (setq default-sendmail-coding-system 'utf-8) + (setq default-file-name-coding-system (if (memq system-type + '(window-nt ms-dos)) + 'iso-latin-1-unix + 'utf-8-unix)) ;; Preserve eol-type from existing default-process-coding-systems. ;; On non-unix-like systems in particular, these may have been set ;; carefully by the user, or by the startup code, to deal with the @@ -1821,8 +1819,10 @@ The default status is as follows: (input-coding (condition-case nil (coding-system-change-text-conversion - (cdr default-process-coding-system) 'iso-latin-1) - (coding-system-error 'iso-latin-1)))) + (cdr default-process-coding-system) + (if (memq system-type '(window-nt ms-dos)) 'iso-latin-1 'utf-8)) + (coding-system-error + (if (memq system-type '(window-nt ms-dos)) 'iso-latin-1 'utf-8))))) (setq default-process-coding-system (cons output-coding input-coding))) diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index dd6eecbfd0..7610939e57 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -975,7 +975,7 @@ but lower priority than the local value of `buffer-file-coding-system'. See also the function `select-message-coding-system'.") ;;;###autoload -(defvar default-sendmail-coding-system 'iso-latin-1 +(defvar default-sendmail-coding-system 'utf-8 "Default coding system for encoding the outgoing mail. This variable is used only when `sendmail-coding-system' is nil. diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el index f7e30bfbb3..8a69adbb75 100644 --- a/lisp/mh-e/mh-comp.el +++ b/lisp/mh-e/mh-comp.el @@ -305,6 +305,7 @@ message and scan line." (let ((draft-buffer (current-buffer)) (file-name buffer-file-name) (config mh-previous-window-config) + ;; FIXME this is subtly different to select-message-coding-system. (coding-system-for-write (if (fboundp 'select-message-coding-system) (select-message-coding-system) ; Emacs has this since at least 21.1 @@ -318,7 +319,7 @@ message and scan line." (or (and (boundp 'sendmail-coding-system) sendmail-coding-system) (and (default-boundp 'buffer-file-coding-system) (default-value 'buffer-file-coding-system)) - 'iso-latin-1))))) + 'utf-8))))) ;; Older versions of spost do not support -msgid and -mime. (unless mh-send-uses-spost-flag ;; Adding a Message-ID field looks good, makes it easier to search for commit b9db19b23a12c1c8c2160a0e86d487a71f026e6b Author: Martin Rudalics Date: Fri Sep 11 16:04:20 2020 -0400 Fix toggle-frame-fullscreen on w32 builds * src/w32term.c (w32_read_socket): Set 'fullscreen' to 'maximized' if Windows sends SIZE_MAXIMIZED and either the top or the left of the frame is outside the screen. (Bug#25542) diff --git a/src/w32term.c b/src/w32term.c index 1766b32514..2669f29b56 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -5478,15 +5478,15 @@ w32_read_socket (struct terminal *terminal, /* Windows can send us a SIZE_MAXIMIZED message even when fullscreen is fullboth. The following is a simple hack to check that based on the fact that - only a maximized fullscreen frame should have both - top/left outside the screen. */ + only a maximized fullscreen frame should have top + or left outside the screen. */ if (EQ (fullscreen, Qfullwidth) || EQ (fullscreen, Qfullheight) || NILP (fullscreen)) { int x, y; w32_real_positions (f, &x, &y); - if (x < 0 && y < 0) + if (x < 0 || y < 0) store_frame_param (f, Qfullscreen, Qmaximized); } } commit 6a9c0b09687bf88eaacf22ba8a7837914298e7f8 Author: Lars Ingebrigtsen Date: Sat Sep 12 13:06:35 2020 +0200 Further diff-no-select doc string clarification * lisp/vc/diff.el (diff-no-select): Doc string clarification. diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index edb231cf60..469888078c 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -148,7 +148,8 @@ Possible values are: "Compare the OLD and NEW file/buffer. If the optional SWITCHES is nil, the switches specified in the variable ‘diff-switches’ are passed to the diff command, -otherwise SWITCHES is used. +otherwise SWITCHES is used. SWITCHES can be a string or a list +of strings. If NO-ASYNC is non-nil, call diff synchronously.