commit 638ef457876c14b9d713e2fa991f5db3ad53c4f9 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Wed Jun 3 18:58:45 2020 -0700 Don’t default to Valgrind unless ENABLE_CHECKING * src/alloc.c (USE_VALGRIND): If not defined, don’t default it to 1 unless ENABLE_CHECKING. The Valgrind hooks bloat the garbage collector a bit in production, and there’s no need for them these days if one has a Valgrind suppressions file (which one needs anyway). (mark_maybe_pointer): Use ‘#if USE_VALGRIND’ instead of ‘#ifdef USE_VALGRIND’ for consistency with other uses of USE_VALGRIND. This is in case someone builds with ‘-DENABLE_CHECKING -DUSE_VALGRIND=0’ in CFLAGS. diff --git a/src/alloc.c b/src/alloc.c index 573bac00c8..f44f22be1a 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -67,7 +67,8 @@ along with GNU Emacs. If not, see . */ # include #endif -#if defined HAVE_VALGRIND_VALGRIND_H && !defined USE_VALGRIND +#if (defined ENABLE_CHECKING \ + && defined HAVE_VALGRIND_VALGRIND_H && !defined USE_VALGRIND) # define USE_VALGRIND 1 #endif @@ -4694,7 +4695,7 @@ mark_maybe_pointer (void *p) { struct mem_node *m; -#ifdef USE_VALGRIND +#if USE_VALGRIND VALGRIND_MAKE_MEM_DEFINED (&p, sizeof (p)); #endif commit 65749436d03fd0b9e379dcc06cc678522c6960cf Author: Paul Eggert Date: Wed Jun 3 18:15:54 2020 -0700 Revert make-text-button string copy * lisp/button.el (make-text-button): Don’t make a copy of a button’s string label. This reverts the change made in 2020-05-17T05:23:28Z!eggert@cs.ucla.edu, which broke SLY. Problem reported by João Távora in: https://lists.gnu.org/r/emacs-devel/2020-06/msg00117.html However, we’ll need a better fix for this once string literals become contents, if SLY uses string constants for text button labels. diff --git a/lisp/button.el b/lisp/button.el index a91b0482ac..3a6a6de774 100644 --- a/lisp/button.el +++ b/lisp/button.el @@ -349,7 +349,6 @@ Also see `insert-text-button'." (or (plist-member properties 'type) (plist-member properties :type)))) (when (stringp beg) - (setq beg (copy-sequence beg)) ;; In case BEG is not mutable. (setq object beg beg 0 end (length object))) ;; Disallow setting the `category' property directly. (when (plist-get properties 'category) commit 6dad339f064df180e8f2c6257ffb53a6f341c4ec Author: Paul Eggert Date: Wed Jun 3 15:39:29 2020 -0700 Fix make-text-button bug with string copy * lisp/button.el (make-text-button): Use the copy of BEG uniformly, instead of in just one place. This fixes a typo introduced in 2020-05-17T05:23:28Z!eggert@cs.ucla.edu. Problem reported by João Távora in: https://lists.gnu.org/r/emacs-devel/2020-06/msg00117.html diff --git a/lisp/button.el b/lisp/button.el index f969a03cb0..a91b0482ac 100644 --- a/lisp/button.el +++ b/lisp/button.el @@ -349,7 +349,8 @@ Also see `insert-text-button'." (or (plist-member properties 'type) (plist-member properties :type)))) (when (stringp beg) - (setq object (copy-sequence beg) beg 0 end (length object))) + (setq beg (copy-sequence beg)) ;; In case BEG is not mutable. + (setq object beg beg 0 end (length object))) ;; Disallow setting the `category' property directly. (when (plist-get properties 'category) (error "Button `category' property may not be set directly")) commit bd20af2d41f24c9e59acb867a1a4485284cb2a65 Author: João Távora Date: Wed Jun 3 20:53:35 2020 +0100 Ensure Jsonrpc processes are created in correct buffer Report and original implementation by Steve Purcell . See also See https://github.com/joaotavora/eglot/pull/493 for details * lisp/jsonrpc.el (initialize-instance): Make process in original buffer. (Version): Bump to 1.0.12 diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el index 42e7701af1..ff8f250a22 100644 --- a/lisp/jsonrpc.el +++ b/lisp/jsonrpc.el @@ -4,7 +4,7 @@ ;; Author: João Távora ;; Keywords: processes, languages, extensions -;; Version: 1.0.11 +;; Version: 1.0.12 ;; Package-Requires: ((emacs "25.2")) ;; This is a GNU ELPA :core package. Avoid functionality that is not @@ -364,40 +364,44 @@ connection object, called when the process dies .") (cl-defmethod initialize-instance ((conn jsonrpc-process-connection) slots) (cl-call-next-method) (cl-destructuring-bind (&key ((:process proc)) name &allow-other-keys) slots - ;; FIXME: notice the undocumented bad coupling in the buffer name. - ;; The client making the process _must_ use a buffer named exactly - ;; like this property when calling `make-process'. If there were - ;; a `set-process-stderr' like there is `set-process-buffer' we - ;; wouldn't need this and could use a pipe with a process filter - ;; instead of `after-change-functions'. Alternatively, we need a - ;; new initarg (but maybe not a slot). - (with-current-buffer (get-buffer-create (format "*%s stderr*" name)) - (let ((inhibit-read-only t) - (hidden-name (concat " " (buffer-name)))) - (erase-buffer) - (buffer-disable-undo) - (add-hook - 'after-change-functions - (lambda (beg _end _pre-change-len) - (cl-loop initially (goto-char beg) - do (forward-line) - when (bolp) - for line = (buffer-substring - (line-beginning-position 0) - (line-end-position 0)) - do (with-current-buffer (jsonrpc-events-buffer conn) - (goto-char (point-max)) - (let ((inhibit-read-only t)) - (insert (format "[stderr] %s\n" line)))) - until (eobp))) - nil t) - ;; If we are correctly coupled to the client, it should pick up - ;; the current buffer immediately. - (setq proc (if (functionp proc) (funcall proc) proc)) - (ignore-errors (kill-buffer hidden-name)) - (rename-buffer hidden-name) - (process-put proc 'jsonrpc-stderr (current-buffer)) - (read-only-mode t))) + ;; FIXME: notice the undocumented bad coupling in the stderr + ;; buffer name, it must be named exactly like this we expect when + ;; calling `make-process'. If there were a `set-process-stderr' + ;; like there is `set-process-buffer' we wouldn't need this and + ;; could use a pipe with a process filter instead of + ;; `after-change-functions'. Alternatively, we need a new initarg + ;; (but maybe not a slot). + (let ((calling-buffer (current-buffer))) + (with-current-buffer (get-buffer-create (format "*%s stderr*" name)) + (let ((inhibit-read-only t) + (hidden-name (concat " " (buffer-name)))) + (erase-buffer) + (buffer-disable-undo) + (add-hook + 'after-change-functions + (lambda (beg _end _pre-change-len) + (cl-loop initially (goto-char beg) + do (forward-line) + when (bolp) + for line = (buffer-substring + (line-beginning-position 0) + (line-end-position 0)) + do (with-current-buffer (jsonrpc-events-buffer conn) + (goto-char (point-max)) + (let ((inhibit-read-only t)) + (insert (format "[stderr] %s\n" line)))) + until (eobp))) + nil t) + ;; If we are correctly coupled to the client, the process + ;; now created should pick up the current stderr buffer, + ;; which we immediately rename + (setq proc (if (functionp proc) + (with-current-buffer calling-buffer (funcall proc)) + proc)) + (ignore-errors (kill-buffer hidden-name)) + (rename-buffer hidden-name) + (process-put proc 'jsonrpc-stderr (current-buffer)) + (read-only-mode t)))) (setf (jsonrpc--process conn) proc) (set-process-buffer proc (get-buffer-create (format " *%s output*" name))) (set-process-filter proc #'jsonrpc--process-filter) commit 7e8c1a671872ef8e45057f25912594cf548639ab Author: Mattias Engdegård Date: Tue Jun 2 22:31:14 2020 +0200 Make color-distance symmetric and more accurate * src/xfaces.c (color_distance): Don't throw away the low 8 bits of the colours, and make the function symmetric (bug41544) (Fcolor_distance): Add caution about this not being a true metric. * test/src/xfaces-tests.el: New file. diff --git a/src/xfaces.c b/src/xfaces.c index 7d7aff95c1..cf155288bd 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4356,15 +4356,15 @@ color_distance (Emacs_Color *x, Emacs_Color *y) See for more info. */ - long r = (x->red - y->red) >> 8; - long g = (x->green - y->green) >> 8; - long b = (x->blue - y->blue) >> 8; - long r_mean = (x->red + y->red) >> 9; - - return - (((512 + r_mean) * r * r) >> 8) - + 4 * g * g - + (((767 - r_mean) * b * b) >> 8); + long long r = x->red - y->red; + long long g = x->green - y->green; + long long b = x->blue - y->blue; + long long r_mean = (x->red + y->red) >> 1; + + return (((((2 * 65536 + r_mean) * r * r) >> 16) + + 4 * g * g + + (((2 * 65536 + 65535 - r_mean) * b * b) >> 16)) + >> 16); } @@ -4374,7 +4374,9 @@ COLOR1 and COLOR2 may be either strings containing the color name, or lists of the form (RED GREEN BLUE), each in the range 0 to 65535 inclusive. If FRAME is unspecified or nil, the current frame is used. If METRIC is specified, it should be a function that accepts -two lists of the form (RED GREEN BLUE) aforementioned. */) +two lists of the form (RED GREEN BLUE) aforementioned. +Despite the name, this is not a true distance metric as it does not satisfy +the triangle inequality. */) (Lisp_Object color1, Lisp_Object color2, Lisp_Object frame, Lisp_Object metric) { @@ -4931,7 +4933,7 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector, /* If the distance (as returned by color_distance) between two colors is less than this, then they are considered the same, for determining - whether a color is supported or not. The range of values is 0-65535. */ + whether a color is supported or not. */ #define TTY_SAME_COLOR_THRESHOLD 10000 diff --git a/test/src/xfaces-tests.el b/test/src/xfaces-tests.el new file mode 100644 index 0000000000..f08a87a518 --- /dev/null +++ b/test/src/xfaces-tests.el @@ -0,0 +1,27 @@ +;;; xfaces-tests.el --- tests for xfaces.c -*- lexical-binding: t -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +(require 'ert) + +(ert-deftest xfaces-color-distance () + ;; Check symmetry (bug#51455). + (should (equal (color-distance "#222222" "#ffffff") + (color-distance "#ffffff" "#222222")))) + +(provide 'xfaces-tests) commit 74966904b081a246a171bc7d2374f5d51712ed91 Author: Basil L. Contovounesios Date: Wed Jun 3 11:45:54 2020 +0100 ; Clean up recent project.el additions * lisp/progmodes/project.el (project): Add :version tag. (project-list-file): Fix custom :type and add :version tag. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index bd99d5b725..c701b80159 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -95,6 +95,7 @@ (defgroup project nil "Operations on the current project." + :version "28.1" :group 'tools) (defvar project-find-functions (list #'project-try-vc) @@ -245,7 +246,7 @@ to find the list of ignores for each directory." (defcustom project-vc-ignores nil "List of patterns to include in `project-ignores'." :type '(repeat string) - :safe 'listp) + :safe #'listp) (defcustom project-vc-merge-submodules t "Non-nil to consider submodules part of the parent project. @@ -255,7 +256,7 @@ you might have to restart Emacs to see the effect." :type 'boolean :version "28.1" :package-version '(project . "0.2.0") - :safe 'booleanp) + :safe #'booleanp) ;; FIXME: Using the current approach, major modes are supposed to set ;; this variable to a buffer-local value. So we don't have access to @@ -748,7 +749,8 @@ Arguments the same as in `compile'." (defcustom project-list-file (locate-user-emacs-file "project-list") "File to save the list of known projects." - :type 'string + :type 'file + :version "28.1" :group 'project) (defvar project--list 'unset