summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2023-03-22 06:30:12 +0100
committerStefan Kangas <stefankangas@gmail.com>2023-03-22 06:30:12 +0100
commit2d0de863618fd0341a5a781c26bf774e304ffd45 (patch)
tree0dc798658c7266775794a96950c088de720687b4
parent5904bdf581974cb8bf88534bbc58b13cca797303 (diff)
parent8b6a0de964d61cb8d57ed3fe65086fa305a3c53e (diff)
downloademacs-2d0de863618fd0341a5a781c26bf774e304ffd45.tar.gz
Merge from origin/emacs-29
8b6a0de964d Improve docstring of treesit-parent-while (bug#62301) 35648a86730 ; Delete accidental leftover '()' Eglot function 47d8e4b0d38 Eglot: report window/workDoneProgress capability to langu... 4a7a0c9a9f5 * lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Impr... 4a6eefb93a5 Expand defvar-keymap documentation 7a1272168af * lisp/treesit.el (treesit-end-of-defun): Guard arg again... 263d6c38539 Comp fix calls to redefined primtives with op-bytecode (b... 6bf441ff115 Warn package authors away from keymap-unset with REMOVE 786de66ec3c Comment out jobs on EMBA eed240bc022 Improve defvar-keymap docstring.
-rw-r--r--doc/lispref/keymaps.texi67
-rw-r--r--doc/lispref/parsing.texi22
-rw-r--r--lisp/emacs-lisp/comp.el30
-rw-r--r--lisp/keymap.el19
-rw-r--r--lisp/progmodes/eglot.el3
-rw-r--r--lisp/treesit.el13
-rw-r--r--test/infra/gitlab-ci.yml65
-rw-r--r--test/src/comp-tests.el13
8 files changed, 169 insertions, 63 deletions
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index c17c8a2dc3f..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
@@ -1452,6 +1513,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:
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/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 9f4118dfc86..7d9832f588f 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 (subr-primitive-p 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/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))
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index fe9bc510049..d21294276ad 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -820,6 +820,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--{})))
@@ -2484,7 +2485,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))))
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 9bb58ec4ab1..367d2c66ac7 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
@@ -1923,6 +1923,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.
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]*:"
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. ;;