From 168165178f32fb4e20aea32858407921baf079f0 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Wed, 15 Mar 2023 09:51:14 +0100 Subject: [PATCH 1/9] Use 'package-vc-selected-packages' to store package specs * doc/emacs/package.texi (Fetching Package Sources): Do not promote the usage of 'package-vc-selected-packages' to install packages. * lisp/emacs-lisp/package-vc.el (package-vc-selected-packages): Remove custom setter and change docstring according to these changes. (package-vc--desc->spec): Consult 'package-vc-selected-packages' for package specifications. (package-vc--unpack): Add unknown package specifications to 'package-vc-selected-packages' --- doc/emacs/package.texi | 23 --------------------- lisp/emacs-lisp/package-vc.el | 38 ++++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 39 deletions(-) diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index d993b7b071f..7a2bc11d03c 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -558,29 +558,6 @@ regular package listing. If you just wish to clone the source of a package, without adding it to the package list, use @code{package-vc-checkout}. -@vindex package-vc-selected-packages -@findex package-vc-install-selected-packages - An alternative way to use @code{package-vc-install} is via the -@code{package-vc-selected-packages} user option. This is an alist of -packages to install, where each key is a package name and the value is -@code{nil}, indicating that any revision is to install, a string, -indicating a specific revision or a package specification plist. The -side effect of setting the user option is to install the package, but -the process can also be manually triggered using the function -@code{package-vc-install-selected-packages}. Here is an example of -how the user option: - -@example -@group -(setopt package-vc-selected-packages - '((modus-themes . "0f39eb3fd9") ;specific revision - (auctex . nil) ;any revision - (foo ;a package specification - :url "https://git.sv.gnu.org/r/foo-mode.git" - :branch "trunk"))) -@end group -@end example - @findex package-report-bug @findex package-vc-prepare-patch With the source checkout, you might want to reproduce a bug against diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index ea2766b8dc4..652f2518672 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -139,7 +139,6 @@ the `clone' function." (package-desc-create :name name :kind 'vc)) spec))))))) -;;;###autoload (defcustom package-vc-selected-packages '() "List of packages that must be installed. Each member of the list is of the form (NAME . SPEC), where NAME @@ -174,13 +173,9 @@ is a symbol designating the package and SPEC is one of: All other keys are ignored. -This user option differs from `package-selected-packages' in that -it is meant to be specified manually. If you want to install all -the packages in the list, you cal also use -`package-vc-install-selected-packages'. - -Note that this option will not override an existing source -package installation or revert the checked out revision." +This user option will be automatically updated to store package +specifications for packages that are not specified in any +archive." :type '(alist :tag "List of packages you want to be installed" :key-type (symbol :tag "Package") :value-type @@ -191,10 +186,6 @@ package installation or revert the checked out revision." (:lisp-dir string) (:main-file string) (:vc-backend symbol))))) - :initialize #'custom-initialize-default - :set (lambda (sym val) - (custom-set-default sym val) - (package-vc-install-selected-packages)) :version "29.1") (defvar package-vc--archive-spec-alist nil @@ -224,12 +215,17 @@ All other values are ignored.") The optional argument NAME can be used to override the default name for PKG-DESC." (alist-get - (or name (package-desc-name pkg-desc)) - (if (package-desc-archive pkg-desc) + (setq name (or name (package-desc-name pkg-desc))) + (if (and (package-desc-archive pkg-desc) + (not (alist-get name package-vc-selected-packages + nil nil #'string=))) (alist-get (intern (package-desc-archive pkg-desc)) package-vc--archive-spec-alist) - (apply #'append (mapcar #'cdr package-vc--archive-spec-alist))) - nil nil #'string=)) + ;; Consult both our local list of package specifications, as well + ;; as the lists provided by the archives. + (apply #'append (cons package-vc-selected-packages + (mapcar #'cdr package-vc--archive-spec-alist)))) + '() nil #'string=)) (define-inline package-vc--query-spec (pkg-desc prop) "Query the property PROP for the package specification of PKG-DESC. @@ -659,9 +655,19 @@ abort installation?" name)) ;; file system or between installations. (throw 'done (setq lisp-dir name))))) + ;; Store the :lisp-dir (when lisp-dir (push (cons :lisp-dir lisp-dir) (package-desc-extras pkg-desc))) + + ;; Ensure we have a copy of the package specification + (unless (equal (alist-get name (mapcar #'cdr package-vc--archive-spec-alist)) pkg-spec) + (customize-save-variable + 'package-vc-selected-packages + (cons (cons name pkg-spec) + (seq-remove (lambda (spec) (string= name (car spec))) + package-vc-selected-packages)))) + (package-vc--unpack-1 pkg-desc pkg-dir))) (defun package-vc--read-package-name (prompt &optional allow-url installed) From 39fea1155150b48344cd9971c6248bc7b7a369f9 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Wed, 15 Mar 2023 10:05:39 +0100 Subject: [PATCH 2/9] Do not store :lisp-dir in package descriptors * lisp/emacs-lisp/package-vc.el (package-vc--main-file) (package-vc--unpack-1): Query 'pkg-spec' instead of 'package-desc-extras'. (package-vc--unpack): Do not update 'package-desc-extras'. This simplification is possible due to the change in 2718bbb3bc, since we now ensure that package specifications are not lost. They are either provided by a package archive or stored in 'package-vc-selected-packages'. --- lisp/emacs-lisp/package-vc.el | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 652f2518672..09f8b4462e2 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -305,12 +305,11 @@ asynchronously." (directory (file-name-concat (or (package-desc-dir pkg-desc) (expand-file-name name package-user-dir)) - (and-let* ((extras (package-desc-extras pkg-desc))) - (alist-get :lisp-dir extras)))) - (file (or (plist-get pkg-spec :main-file) - (expand-file-name - (concat name ".el") - directory)))) + (plist-get pkg-spec :lisp-dir))) + (file (expand-file-name + (or (plist-get pkg-spec :main-file) + (concat name ".el")) + directory))) (if (file-exists-p file) file ;; The following heuristic is only necessary when fetching a ;; repository with URL that would break the above assumptions. @@ -491,12 +490,12 @@ documentation and marking the package as installed." missing))) (let ((default-directory (file-name-as-directory pkg-dir)) - (pkg-file (expand-file-name (package--description-file pkg-dir) pkg-dir))) + (pkg-file (expand-file-name (package--description-file pkg-dir) pkg-dir)) + (pkg-spec (package-vc--desc->spec pkg-desc))) ;; Generate autoloads (let* ((name (package-desc-name pkg-desc)) (auto-name (format "%s-autoloads.el" name)) - (extras (package-desc-extras pkg-desc)) - (lisp-dir (alist-get :lisp-dir extras))) + (lisp-dir (plist-get pkg-spec :lisp-dir))) (package-generate-autoloads name (file-name-concat pkg-dir lisp-dir)) (when lisp-dir @@ -516,8 +515,7 @@ documentation and marking the package as installed." (package-vc--generate-description-file pkg-desc pkg-file) ;; Detect a manual - (when-let ((pkg-spec (package-vc--desc->spec pkg-desc)) - ((executable-find "install-info"))) + (when (executable-find "install-info") (dolist (doc-file (ensure-list (plist-get pkg-spec :doc))) (package-vc--build-documentation pkg-desc doc-file)))) @@ -655,11 +653,6 @@ abort installation?" name)) ;; file system or between installations. (throw 'done (setq lisp-dir name))))) - ;; Store the :lisp-dir - (when lisp-dir - (push (cons :lisp-dir lisp-dir) - (package-desc-extras pkg-desc))) - ;; Ensure we have a copy of the package specification (unless (equal (alist-get name (mapcar #'cdr package-vc--archive-spec-alist)) pkg-spec) (customize-save-variable From 27edd7f88cb3506b2ca8bd6c26c6a83b6a291e81 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Wed, 15 Mar 2023 09:54:12 +0100 Subject: [PATCH 3/9] Remove 'package-vc--query-spec' * lisp/emacs-lisp/package-vc.el (require): Do not load `inline' during compilation. (package-vc--query-spec): Remove function. (package-vc--clone): Do not call 'package-vc--query-spec'. --- lisp/emacs-lisp/package-vc.el | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 09f8b4462e2..253b35f1f1a 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -48,7 +48,6 @@ ;;; Code: (eval-when-compile (require 'rx)) -(eval-when-compile (require 'inline)) (eval-when-compile (require 'map)) (eval-when-compile (require 'cl-lib)) (require 'package) @@ -227,13 +226,6 @@ name for PKG-DESC." (mapcar #'cdr package-vc--archive-spec-alist)))) '() nil #'string=)) -(define-inline package-vc--query-spec (pkg-desc prop) - "Query the property PROP for the package specification of PKG-DESC. -If no package specification can be determined, the function will -return nil." - (inline-letevals (pkg-desc prop) - (inline-quote (plist-get (package-vc--desc->spec ,pkg-desc) ,prop)))) - (defun package-vc--read-archive-data (archive) "Update `package-vc--archive-spec-alist' for ARCHIVE. This function is meant to be used as a hook for `package-read-archive-hook'." @@ -578,7 +570,6 @@ attribute in PKG-SPEC." (unless (file-exists-p dir) (make-directory (file-name-directory dir) t) (let ((backend (or (plist-get pkg-spec :vc-backend) - (package-vc--query-spec pkg-desc :vc-backend) (package-vc--guess-backend url) (plist-get (alist-get (package-desc-archive pkg-desc) package-vc--archive-data-alist From d814c249f4431449ed94c2ad1443457fce393c86 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 15 Mar 2023 13:05:19 +0100 Subject: [PATCH 4/9] * test/infra/Dockerfile.emba: Install clangd. --- test/infra/Dockerfile.emba | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index c005d872cb8..73bfe1a8ece 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba @@ -34,9 +34,10 @@ RUN apt-get update && \ FROM emacs-base as emacs-inotify +# We install clangd for Eglot tests. RUN apt-get update && \ apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ - inotify-tools \ + inotify-tools clangd \ && rm -rf /var/lib/apt/lists/* COPY . /checkout From 61adb44318a30d599712b69c7e6606510ce0ce2c Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Wed, 15 Mar 2023 16:18:04 +0100 Subject: [PATCH 5/9] * configure.ac: Fix native comp compatibility check (bug#61960) --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ac93d003b70..c818343a5ad 100644 --- a/configure.ac +++ b/configure.ac @@ -4328,8 +4328,8 @@ If you really want to try it anyway, use the configure option fi if test "${with_native_compilation}" != "no"; then - if test "${HAVE_PDUMPER}" = no; then - AC_MSG_ERROR(['--with-native-compilation' requires '--with-dumping=pdumper']) + if test "$with_unexec" = yes; then + AC_MSG_ERROR(['--with-native-compilation' is not compatible with unexec]) fi if test "${HAVE_ZLIB}" = no; then AC_MSG_ERROR(['--with-native-compilation' requires zlib]) From 078cf512eefacd7387f26eb29dbecca5503791dc Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 15 Mar 2023 16:52:22 +0100 Subject: [PATCH 6/9] * test/infra/Dockerfile.emba: Use debian:bullseye. --- test/infra/Dockerfile.emba | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index 73bfe1a8ece..872591333e6 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba @@ -24,7 +24,7 @@ # Maintainer: Ted Zlatanov # URL: https://emba.gnu.org/emacs/emacs -FROM debian:stretch as emacs-base +FROM debian:bullseye as emacs-base RUN apt-get update && \ apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ From d5d4959ed7de13551311eaf152647d87a6f4faad Mon Sep 17 00:00:00 2001 From: Michael Eliachevitch Date: Wed, 15 Mar 2023 23:49:51 +0000 Subject: [PATCH 7/9] Document how to construct JSONRPC arrays in Eglot manual Many language server configuration options are of the JSON array datatype, for example argument lists for executables, but there wasn't any example of that in the Eglot manual. * doc/misc/eglot.texi (User-specific configuration) (User-specific configuration): Tweaks. (JSONRPC objects in Elisp): Mention JSON arrays. Tweak example. Copyright-paperwork-exempt: Yes --- doc/misc/eglot.texi | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index 735da5f0163..a5afb2332c1 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -1201,7 +1201,7 @@ the LSP handshake. This is done using the The argument @code{(:compilationDatabasePath "/tmp")} is Emacs's representation in plist format of a simple JSON object @code{@{"compilationDatabasePath": "/tmp"@}}. To learn how to -represent more deeply nested options in this format, @xref{JSONRPC +represent more deeply nested options in this format, @pxref{JSONRPC objects in Elisp}. In this case, the two examples achieve exactly the same, but notice @@ -1214,7 +1214,7 @@ supported. It consists of @emph{globally} setting @code{eglot-workspace-configuration}, a variable originally intended for project-specific configuration. This has the same effect as giving all your projects a certain default configuration, as described -in @xref{Project-specific configuration}. Here is an example. +in @ref{Project-specific configuration}. Here is an example: @lisp (setq-default eglot-workspace-configuration @@ -1241,17 +1241,21 @@ keyword-value property sub-plists corresponding to JSON sub-objects. For representing the JSON leaf values @code{true}, @code{false}, @code{null} and @code{@{@}}, you can use the Lisp values @code{t}, @code{:json-false}, @code{nil}, and @code{eglot-@{@}}, respectively. +JSON arrays are represented as Elisp vectors surrounded by square brackets +(@pxref{Vectors,,,elisp,GNU Emacs Lisp Reference Manual}). -For example, this plist: +For example, the plist @lisp (:pylsp (:plugins (:jedi_completion (:include_params t - :fuzzy t) - :pylint (:enabled :json-false))) + :fuzzy t + :cache_for ["pandas" "numpy"] + :pylint (:enabled :json-false)))) :gopls (:usePlaceholders t)) @end lisp -Is serialized by Eglot to the following JSON text: +@noindent +is serialized by Eglot to the following JSON text: @example @{ @@ -1259,7 +1263,8 @@ Is serialized by Eglot to the following JSON text: "plugins": @{ "jedi_completion": @{ "include_params": true, - "fuzzy": true + "fuzzy": true, + "cache_for": [ "pandas", "numpy" ], @}, "pylint": @{ "enabled": false From 4cb8a850b08cc77abe979a7e245bde48206f79a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 15 Mar 2023 23:59:01 +0000 Subject: [PATCH 8/9] ; Tweak doc/misc/eglot.texi * doc/misc/eglot.texi (Advanced server configuration): Minor tweaks. --- doc/misc/eglot.texi | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index a5afb2332c1..85f83ee4b26 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -977,9 +977,9 @@ facilities. Though many language servers work well out-of-the-box, most allow fine-grained control of their operation via specific configuration -options that vary from server to server. A small number of servers -require such special configuration to work acceptably, or even to work -at all. +options that are transmitted over the LSP protocol and vary from +server to server. A small number of servers require such special +configuration to work acceptably, or even to work at all. After having setup a server executable program in @code{eglot-server-programs} (@pxref{Setting Up LSP Servers}) and @@ -1016,8 +1016,9 @@ server reads the file @file{~/.config/pycodestyle} for user configuration. The @command{clangd} C/C++ server reads both @file{~/.config/clangd/config.yaml} for user configuration and @file{.clangd} for project configuration. It may be advantageous to -use these mechanisms instead of Eglot's, as the latter have the -advantage of working with other LSP clients. +use these mechanisms instead of Eglot's, as this will probably work +with other LSP clients and may be easier to debug than options riding +on the LSP wire. @node Project-specific configuration @section Project-specific configuration From 028f11027384b6fb6807ea4057073e3be4003e9e Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Wed, 8 Mar 2023 21:13:37 +0900 Subject: [PATCH 9/9] Fix quoting of font-family in 'hfy-family' Running "M-x htmlfontify-buffer" in one buffer, the exported HTML contains lines like: body, pre { text-decoration: none; font-family: Migu 2M; font-stretch: normal; font-weight: 500; font-style: normal; color: #ffffff; background: #000000; font-size: 15pt; } Standards-compliant web browsers should ignore this font-family. MDN Web Docs says: https://developer.mozilla.org/en-US/docs/Web/CSS/font-family Valid family names Font family names must either be given quoted as strings, or unquoted as a sequence of one or more identifiers. This means that punctuation characters and digits at the start of each token must be escaped in unquoted font family names. It is a good practice to quote font family names that contain white space, digits, or punctuation characters other than hyphens. An unquoted font-family is valid as long as it doesn't start with a digit, but MDN Web Docs also says: The following example is technically valid but is not recommended: font-family: Gill Sans Extrabold, sans-serif; So it makes sense to quote all font-family. * lisp/htmlfontify.el (hfy-family): Quote 'font-family'. (Bug#62054) --- lisp/htmlfontify.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index 1ab33cc6411..f0e38242e48 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -757,7 +757,9 @@ may happen." 255)) '(0 1 2)))))) -(defun hfy-family (family) (list (cons "font-family" family))) +(defun hfy-family (family) + (list (cons "font-family" + (format "\"%s\"" (string-replace "\"" "\\\\\"" family))))) (defun hfy-bgcol (color) (list (cons "background" (hfy-triplet color)))) (defun hfy-color (color) (list (cons "color" (hfy-triplet color)))) (define-obsolete-function-alias 'hfy-colour #'hfy-color "27.1")