From eed240bc022cef4ef0f2b12bd2ff116eb6b9581d Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Mon, 20 Mar 2023 09:44:33 +0100 Subject: Improve defvar-keymap docstring. * lisp/keymap.el (defvar-keymap): Improve description of ':enter' and ':exit' usage for ':repeat' keyword. --- lisp/keymap.el | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lisp/keymap.el b/lisp/keymap.el index 4f02639ffe2..dccc0a3cd31 100644 --- a/lisp/keymap.el +++ b/lisp/keymap.el @@ -579,14 +579,17 @@ value can also be a property list with properties `:enter' and :repeat (:enter (commands ...) :exit (commands ...)) `:enter' specifies the list of additional commands that only -enter `repeat-mode'. When the list is empty, then by default all -commands in the map enter `repeat-mode'. This is useful when -there is a command that has the `repeat-map' symbol property, but -doesn't exist in this specific map. `:exit' is a list of -commands that exit `repeat-mode'. When the list is empty, no -commands in the map exit `repeat-mode'. This is useful when a -command exists in this specific map, but it doesn't have the -`repeat-map' symbol property on its symbol. +enter `repeat-mode'. When the list is empty, then only the +commands defined in the map enter `repeat-mode'. Specifying a +list of commands is useful when there are commands that have the +`repeat-map' symbol property, but don't exist in this specific +map. + +`:exit' is a list of commands that exit `repeat-mode'. When the +list is empty, no commands in the map exit `repeat-mode'. +Specifying a list of commands is useful when those commands exist +in this specific map, but should not have the `repeat-map' symbol +property. \(fn VARIABLE-NAME &key DOC FULL PARENT SUPPRESS NAME PREFIX KEYMAP REPEAT &rest [KEY DEFINITION]...)" (declare (indent 1)) -- cgit v1.2.1 From 786de66ec3c4cff90cafd0f8a68f9bce027e9947 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 20 Mar 2023 10:06:05 +0100 Subject: Comment out jobs on EMBA * test/infra/gitlab-ci.yml: Comment out jobs due to bug#62210 and bug#62211. --- test/infra/gitlab-ci.yml | 65 +++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index 1c1452dcda5..4e11b1337b5 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -229,22 +229,27 @@ test-filenotify-gio: # This is needed in order to get a JUnit test report. make_params: '-k -C test check-expensive LOGFILES="lisp/autorevert-tests.log lisp/filenotify-tests.log"' -build-image-gnustep: - stage: platform-images - extends: [.job-template, .build-template, .gnustep-template] - variables: - target: emacs-gnustep +# The next two jobs are commented out due to bug#62210. -test-gnustep: - # This tests the GNUstep build process. - stage: platforms - extends: [.job-template, .gnustep-template] - needs: - - job: build-image-gnustep - optional: true - variables: - target: emacs-gnustep - make_params: install +# build-image-gnustep: +# stage: platform-images +# extends: [.job-template, .build-template, .gnustep-template] +# variables: +# target: emacs-gnustep + +# test-gnustep: +# # This tests the GNUstep build process. +# stage: platforms +# extends: [.job-template, .gnustep-template] +# needs: +# - job: build-image-gnustep +# optional: true +# variables: +# target: emacs-gnustep +# make_params: install + +# The next two jobs are commented out due to high workload on +# emba.gnu.org. # build-native-comp-speed0: # stage: native-comp-images @@ -258,21 +263,23 @@ test-gnustep: # variables: # target: emacs-native-comp-speed1 -build-native-comp-speed2: - stage: native-comp-images - extends: [.job-template, .build-template, .native-comp-template] - variables: - target: emacs-native-comp-speed2 +# The next two jobs are commented out due to bug#62211. -test-native-comp-speed2: - stage: native-comp - extends: [.job-template, .test-template, .native-comp-template] - needs: - - job: build-native-comp-speed2 - optional: true - variables: - target: emacs-native-comp-speed2 - make_params: "-k -C test check SELECTOR='(not (tag :unstable))'" +# build-native-comp-speed2: +# stage: native-comp-images +# extends: [.job-template, .build-template, .native-comp-template] +# variables: +# target: emacs-native-comp-speed2 + +# test-native-comp-speed2: +# stage: native-comp +# extends: [.job-template, .test-template, .native-comp-template] +# needs: +# - job: build-native-comp-speed2 +# optional: true +# variables: +# target: emacs-native-comp-speed2 +# make_params: "-k -C test check SELECTOR='(not (tag :unstable))'" # Local Variables: # add-log-current-defun-header-regexp: "^\\([-_.[:alnum:]]+\\)[ \t]*:" -- cgit v1.2.1 From 6bf441ff11540f2c49cb4f9d506597217cdc73d6 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Mon, 20 Mar 2023 16:09:51 +0100 Subject: Warn package authors away from keymap-unset with REMOVE * doc/lispref/keymaps.texi (Changing Key Bindings): Ask package authors to not use the REMOVE argument to `keymap-unset'. --- doc/lispref/keymaps.texi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index c17c8a2dc3f..0eea696c612 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -1452,6 +1452,12 @@ keymap; using @var{remove} instead will allow the key in the parent keymap to be used. @end defun +Note: using @code{keymap-unset} with @var{remove} non-@code{nil} is +intended for users to put in their init file; Emacs packages should +avoid using it if possible, since they have complete control over +their own keymaps anyway, and they should not be altering other +packages' keymaps. + This example creates a sparse keymap and makes a number of bindings in it: -- cgit v1.2.1 From 263d6c38539691c954f4c3057cbe8d5468499b91 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Mon, 20 Mar 2023 17:24:48 +0100 Subject: Comp fix calls to redefined primtives with op-bytecode (bug#61917) * lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Fix compilation of calls to redefined primtives with dedicated op-bytecode. * test/src/comp-tests.el (61917-1): New test. --- lisp/emacs-lisp/comp.el | 30 +++++++++++++++++++----------- test/src/comp-tests.el | 13 +++++++++++++ 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 283c00103b5..febca8df19c 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1773,17 +1773,25 @@ SP-DELTA is the stack adjustment." (maxarg (cdr arity))) (when (eq maxarg 'unevalled) (signal 'native-ice (list "subr contains unevalled args" subr-name))) - (if (eq maxarg 'many) - ;; callref case. - (comp-emit-set-call (comp-callref subr-name nargs (comp-sp))) - ;; Normal call. - (unless (and (>= maxarg nargs) (<= minarg nargs)) - (signal 'native-ice - (list "incoherent stack adjustment" nargs maxarg minarg))) - (let* ((subr-name subr-name) - (slots (cl-loop for i from 0 below maxarg - collect (comp-slot-n (+ i (comp-sp)))))) - (comp-emit-set-call (apply #'comp-call (cons subr-name slots)))))))) + (if (not (subrp subr-name)) + ;; The primitive got redefined before the compiler is + ;; invoked! (bug#61917) + (comp-emit-set-call `(callref funcall + ,(make-comp-mvar :constant subr-name) + ,@(cl-loop repeat nargs + for sp from (comp-sp) + collect (comp-slot-n sp)))) + (if (eq maxarg 'many) + ;; callref case. + (comp-emit-set-call (comp-callref subr-name nargs (comp-sp))) + ;; Normal call. + (unless (and (>= maxarg nargs) (<= minarg nargs)) + (signal 'native-ice + (list "incoherent stack adjustment" nargs maxarg minarg))) + (let* ((subr-name subr-name) + (slots (cl-loop for i from 0 below maxarg + collect (comp-slot-n (+ i (comp-sp)))))) + (comp-emit-set-call (apply #'comp-call (cons subr-name slots))))))))) (eval-when-compile (defun comp-op-to-fun (x) diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 926ba27e563..1615b2838fc 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -532,6 +532,19 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html." (should (subr-native-elisp-p (symbol-function 'comp-test-48029-nonascii-žžž-f)))) +(comp-deftest 61917-1 () + "Verify we can compile calls to redefined primitives with +dedicated byte-op code." + (let ((f (lambda (fn &rest args) + (apply fn args)))) + (advice-add #'delete-region :around f) + (unwind-protect + (should (subr-native-elisp-p + (native-compile + '(lambda () + (delete-region (point-min) (point-max)))))) + (advice-remove #'delete-region f)))) + ;;;;;;;;;;;;;;;;;;;;; ;; Tromey's tests. ;; -- cgit v1.2.1 From 7a1272168af1a5b82979efa29451147c5d867981 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 20 Mar 2023 20:18:42 +0200 Subject: * lisp/treesit.el (treesit-end-of-defun): Guard arg against nil (bug#62158). --- lisp/treesit.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/treesit.el b/lisp/treesit.el index c118f5d52a4..b271a1f0c4b 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1882,6 +1882,7 @@ this function depends on `treesit-defun-type-regexp' and `treesit-defun-skipper'." (interactive "^p\nd") (let ((orig-point (point))) + (if (or (null arg) (= arg 0)) (setq arg 1)) (catch 'done (dotimes (_ 2) ; Not making progress is better than infloop. -- cgit v1.2.1 From 4a6eefb93a5781b08903f27325676cda0a40321c Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Tue, 21 Mar 2023 10:56:07 +0100 Subject: Expand defvar-keymap documentation * doc/lispref/keymaps.texi (Creating Keymaps): Describe the :repeat keyword. --- doc/lispref/keymaps.texi | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 0eea696c612..fdab5075b94 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -451,9 +451,70 @@ Here's an example: @lisp (defvar-keymap eww-textarea-map :parent text-mode-map + :doc "Keymap for the eww text area." "RET" #'forward-line "TAB" #'shr-next-link) @end lisp + +@kindex :repeat +@kindex repeat-mode +@cindex repeatable key bindings +Each command in the keymap can be marked as `repeatable', i.e. usable +in @code{repeat-mode}, by putting a @code{repeat-map} property on it, +e.g. + +@lisp +(put 'undo 'repeat-map 'undo-repeat-map) +@end lisp + +where the value of the property is the map to be used by +@code{repeat-mode}. + +To avoid repetitive invocations of @code{put}, @code{defvar-keymap} +also has a @code{:repeat} keyword, which can be used to specify which +commands in the keymap are usable by @code{repeat-mode}. The +following values are available: + +@table @code +@item t +This means all the commands in the keymap are repeatable, and is the +most common usage. + +@item (:enter (commands ...) :exit (commands ...)) +This specifies that the commands in the @code{:enter} list enter +@code{repeat-mode}, and the commands in the @code{:exit} list exit +repeat mode. + +If the @code{:enter} list is empty, then all commands in the map enter +@code{repeat-mode}. Specifying one or more commands in this list is +useful if there is a command which doesn't exist in the map being +defined, but which should have the @code{repeat-map} property. + +If the @code{:exit} list is empty then no commands in the map exit +@code{repeat-mode}. Specifying one ore more commands in this list is +useful if the keymap being defined contains a command that should not +have the @code{repeat-map} property. +@end table + +In order to make e.g.@: @kbd{u} repeat the @code{undo} command, the +following two stanzas are equivalent: + +@lisp +(defvar-keymap undo-repeat-map + "u" #'undo) +(put 'undo 'repeat-map 'undo-repeat-map) +@end lisp + +and + +@lisp +(defvar-keymap undo-repeat-map + :repeat t + "u" #'undo) +@end lisp + +The latter is preferred when there are many commands in the map, all +of which should be repeatable. @end defmac @defun copy-keymap keymap -- cgit v1.2.1 From 4a7a0c9a9f521b04b23580901e9c0a662b504e32 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 21 Mar 2023 11:51:03 +0100 Subject: * lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Improve 263d6c38539 --- lisp/emacs-lisp/comp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index febca8df19c..3dcbc2cca4d 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1773,7 +1773,7 @@ SP-DELTA is the stack adjustment." (maxarg (cdr arity))) (when (eq maxarg 'unevalled) (signal 'native-ice (list "subr contains unevalled args" subr-name))) - (if (not (subrp subr-name)) + (if (not (subr-primitive-p subr-name)) ;; The primitive got redefined before the compiler is ;; invoked! (bug#61917) (comp-emit-set-call `(callref funcall -- cgit v1.2.1 From 47d8e4b0d3835f5e0b0b6ab76f242ef0aa25bda7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Tue, 21 Mar 2023 09:56:30 +0000 Subject: Eglot: report window/workDoneProgress capability to language server In bug#59149, LSP progress reporting was implemented, but Eglot's 'capabilities' statement to the server wasn't changed to include window/workDoneProgress. * lisp/progmodes/eglot.el (eglot-client-capabilities): Actually report workDoneProgress. --- lisp/progmodes/eglot.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 7a076c134fc..77428c5af07 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -819,6 +819,7 @@ treated as in `eglot--dbind'." `(:valueSet [,@(mapcar #'car eglot--tag-faces)]))) + :window `(:workDoneProgress t) :general (list :positionEncodings ["utf-32" "utf-8" "utf-16"]) :experimental eglot--{}))) -- cgit v1.2.1 From 35648a8673010a49720476821732df96ad8fa532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Tue, 21 Mar 2023 09:59:13 +0000 Subject: ; Delete accidental leftover '()' Eglot function * lisp/progmodes/eglot.el (eglot--workspace-configuration-plist): Remove (). --- lisp/progmodes/eglot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 77428c5af07..76f70ead666 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2480,7 +2480,7 @@ use the root of SERVER's `eglot--project'." ;; Set the major mode to be the first of the managed ;; modes. This is the one the user started eglot in. (setq major-mode (car (eglot--major-modes server))) - (hack-dir-local-variables-non-file-buffer)() + (hack-dir-local-variables-non-file-buffer) (if (functionp eglot-workspace-configuration) (funcall eglot-workspace-configuration server) eglot-workspace-configuration)))) -- cgit v1.2.1 From 8b6a0de964d61cb8d57ed3fe65086fa305a3c53e Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Tue, 21 Mar 2023 14:50:07 -0700 Subject: Improve docstring of treesit-parent-while (bug#62301) * doc/lispref/parsing.texi (Retrieving Nodes): Improve and fix docstring for treesit-parent-until and treesit-parent-while. * lisp/treesit.el (treesit-parent-while): Improve docstring. --- doc/lispref/parsing.texi | 22 ++++++++++++++-------- lisp/treesit.el | 12 ++++++------ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index fd65fa3e75b..cba323d3a56 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -859,18 +859,24 @@ return non-@code{nil} to indicate that the node should be kept. If nodes. @end defun -@defun treesit-parent-until node predicate +@defun treesit-parent-until node predicate &optional include-node This function repeatedly finds the parents of @var{node}, and returns -the parent that satisfies @var{predicate}, a function that takes a -node as the argument. If no parent satisfies @var{predicate}, this -function returns @code{nil}. +the parent that satisfies @var{pred}, a function that takes a node as +the argument and returns a boolean that indicates a match. If no +parent satisfies @var{pred}, this function returns @code{nil}. + +Normally this function only looks at the parents of @var{node} but not +@var{node} itself. But if @var{include-node} is non-@var{nil}, this +function returns @var{node} if @var{node} satisfies @var{pred}. @end defun -@defun treesit-parent-while node predicate -This function repeatedly finds the parent of @var{node}, and keeps -doing so as long as the nodes satisfy @var{predicate}, a function that +@defun treesit-parent-while node pred +This function goes up the tree starting from @var{node}, and keeps +doing so as long as the nodes satisfy @var{pred}, a function that takes a node as the argument. That is, this function returns the -farthest parent that still satisfies @var{predicate}. +highest parent of @var{node} that still satisfies @var{pred}. Note +that if @var{node} satisfies @var{pred} but its immediate parent +doesn't, @var{node} itself is returned. @end defun @defun treesit-node-top-level node &optional type diff --git a/lisp/treesit.el b/lisp/treesit.el index b271a1f0c4b..e718ea1a23a 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -324,13 +324,13 @@ If INCLUDE-NODE is non-nil, return NODE if it satisfies PRED." node)) (defun treesit-parent-while (node pred) - "Return the furthest parent of NODE that satisfies PRED. + "Return the furthest parent of NODE (including NODE) that satisfies PRED. -This function successively examines the parent of NODE, then -the parent of the parent, etc., until it finds an ancestor node -which no longer satisfies the predicate PRED; it returns the last -examined ancestor that satisfies PRED. It returns nil if no -ancestor node was found that satisfies PRED. +This function successively examines NODE, the parent of NODE, +then the parent of the parent, etc., until it finds a node which +no longer satisfies the predicate PRED; it returns the last +examined node that satisfies PRED. If no node satisfies PRED, it +returns nil. PRED should be a function that takes one argument, the node to examine, and returns a boolean value indicating whether that -- cgit v1.2.1