Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-03-24 10:46:14 +08:00
commit d7457e1ce4
27 changed files with 497 additions and 145 deletions

View file

@ -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:

View file

@ -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

View file

@ -3190,6 +3190,11 @@ auto-saved files to the same directory as the original file.
Alternatively, set the user option @code{tramp-auto-save-directory}
to direct all auto saves to that location.
@c Since Emacs 30.
@vindex remote-file-name-inhibit-auto-save
If you want to suppress auto-saving of remote files at all, set user
option @code{remote-file-name-inhibit-auto-save} to non-@code{nil}.
@c Since Emacs 29.
@vindex remote-file-name-inhibit-auto-save-visited
An alternative to @code{auto-save-mode} is
@ -4906,6 +4911,36 @@ Disable file locks. Set @code{remote-file-name-inhibit-locks} to
@code{t} if you know that different Emacs sessions are not modifying
the same remote file.
@item
@vindex remote-file-name-inhibit-auto-save
Keep auto-save files local. This is already the default configuration
in Emacs, don't change it. If you want to disable auto-saving for
remote files at all, set @code{remote-file-name-inhibit-auto-save} to
@code{t}, but think about the consequences!
If you want to disable auto-saving just for selected connections, for
example due to security considerations, use connection-local variables
in order to set @code{buffer-auto-save-file-name}. If you, for
example, want to disable auto-saving for all @option{sudo}
connections, apply the following code.
@ifinfo
@xref{Connection Variables, , , emacs}.
@end ifinfo
@lisp
@group
(connection-local-set-profile-variables
'my-auto-save-profile
'((buffer-auto-save-file-name . nil)))
@end group
@group
(connection-local-set-profiles
'(:application tramp :protocol "sudo")
'my-auto-save-profile)
@end group
@end lisp
@item
Disable excessive traces. Set @code{tramp-verbose} to 3 or lower,
default being 3. Increase trace levels temporarily when hunting for
@ -5220,6 +5255,7 @@ HISTFILE=/dev/null
@item
Where are remote files trashed to?
@vindex remote-file-name-inhibit-delete-by-moving-to-trash
Emacs can trash file instead of deleting
@ifinfo
them, @ref{Misc File Ops, Trashing , , emacs}.

View file

@ -62,6 +62,11 @@ as it has in batch mode since Emacs 24.
When non-nil, this option suppresses moving remote files to the local
trash when deleting. Default is nil.
---
** New user option 'remote-file-name-inhibit-auto-save'.
If this user option is non-nil, 'auto-save-mode' will not auto-save
remote buffers. The default is nil.
+++
** New user option 'yes-or-no-prompt'.
This allows the user to customize the prompt that is appended by

View file

@ -62,6 +62,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include <timespec.h>
#include <getopt.h>
#include <unistd.h>
@ -846,7 +847,7 @@ movemail_strftime (char *s, size_t size, char const *format,
static bool
mbx_delimit_begin (FILE *mbf)
{
time_t now = time (NULL);
time_t now = current_timespec ().tv_sec;
struct tm *ltime = localtime (&now);
if (!ltime)
return false;

View file

@ -185,8 +185,6 @@ main (int argc, char **argv)
ptrdiff_t scorecount, scorealloc;
ptrdiff_t max_scores = MAX_SCORES;
srand (time (0));
while ((c = getopt (argc, argv, "hrm:d:")) != -1)
switch (c)
{
@ -485,8 +483,8 @@ lock_file (const char *filename, void **state)
return -1;
attempts = 0;
}
sleep ((rand () & 1) + 1);
else
sleep (1);
}
close (fd);

View file

@ -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)

View file

@ -437,7 +437,7 @@ documentation-producing backend to cooperate with specific
documentation-displaying frontends. For example, KEY can be:
* `:thing', VALUE being a short string or symbol designating what
is being reported on. It can, for example be the name of the
DOCSTRING reports on. It can, for example be the name of the
function whose signature is being documented, or the name of
the variable whose docstring is being documented.
`eldoc-display-in-echo-area', a member of
@ -448,6 +448,16 @@ documentation-displaying frontends. For example, KEY can be:
`eldoc-display-in-echo-area' and `eldoc-display-in-buffer' will
use when displaying `:thing''s value.
* `:origin', VALUE being the member of
`eldoc-documentation-functions' where DOCSTRING
originated. `eldoc-display-in-buffer' may use this organize the
documentation buffer accordingly.
* `:echo', controlling how `eldoc-display-in-echo-area' should
present this documentation item, to save space. If VALUE is
`skip' don't echo DOCSTRING. If a number, only echo DOCSTRING
up to that character position.
Finally, major modes should modify this hook locally, for
example:
(add-hook \\='eldoc-documentation-functions #\\='foo-mode-eldoc nil t)
@ -471,8 +481,6 @@ directly from the user or from ElDoc's automatic mechanisms'.")
(defvar eldoc--doc-buffer nil "Buffer displaying latest ElDoc-produced docs.")
(defvar eldoc--doc-buffer-docs nil "Documentation items in `eldoc--doc-buffer'.")
(defun eldoc-doc-buffer (&optional interactive)
"Get or display ElDoc documentation buffer.
@ -496,40 +504,56 @@ If INTERACTIVE, display it. Else, return said buffer."
eldoc--doc-buffer
(setq eldoc--doc-buffer
(get-buffer-create " *eldoc*")))
(unless (eq docs eldoc--doc-buffer-docs)
(setq-local eldoc--doc-buffer-docs docs)
(let ((inhibit-read-only t)
(things-reported-on))
(special-mode)
(erase-buffer)
(setq-local nobreak-char-display nil)
(cl-loop for (docs . rest) on docs
for (this-doc . plist) = docs
for thing = (plist-get plist :thing)
when thing do
(cl-pushnew thing things-reported-on)
(setq this-doc
(concat
(propertize (format "%s" thing)
'face (plist-get plist :face))
": "
this-doc))
do (insert this-doc)
when rest do (insert "\n")
finally (goto-char (point-min)))
;; Rename the buffer, taking into account whether it was
;; hidden or not
(rename-buffer (format "%s*eldoc%s*"
(if (string-match "^ " (buffer-name)) " " "")
(if things-reported-on
(format " for %s"
(mapconcat
(lambda (s) (format "%s" s))
things-reported-on
", "))
""))))))
(let ((inhibit-read-only t)
(things-reported-on))
(special-mode)
(erase-buffer)
(setq-local nobreak-char-display nil)
(cl-loop for (docs . rest) on docs
for (this-doc . plist) = docs
for thing = (plist-get plist :thing)
when thing do
(cl-pushnew thing things-reported-on)
(setq this-doc
(concat
(propertize (format "%s" thing)
'face (plist-get plist :face))
": "
this-doc))
do (insert this-doc)
when rest do (insert "\n")
finally (goto-char (point-min)))
;; Rename the buffer, taking into account whether it was
;; hidden or not
(rename-buffer (format "%s*eldoc%s*"
(if (string-match "^ " (buffer-name)) " " "")
(if things-reported-on
(format " for %s"
(mapconcat
(lambda (s) (format "%s" s))
things-reported-on
", "))
"")))))
eldoc--doc-buffer)
(defun eldoc--echo-area-render (docs)
"Similar to `eldoc--format-doc-buffer', but for echo area.
Helper for `eldoc-display-in-echo-area'."
(cl-loop for (item . rest) on docs
for (this-doc . plist) = item
for echo = (plist-get plist :echo)
for thing = (plist-get plist :thing)
unless (eq echo 'skip) do
(when echo (setq this-doc (substring this-doc 0 echo)))
(when thing (setq this-doc
(concat
(propertize (format "%s" thing)
'face (plist-get plist :face))
": "
this-doc)))
(insert this-doc)
(when rest (insert "\n"))))
(defun eldoc--echo-area-substring (available)
"Given AVAILABLE lines, get buffer substring to display in echo area.
Helper for `eldoc-display-in-echo-area'."
@ -615,15 +639,15 @@ Honor `eldoc-echo-area-use-multiline-p' and
single-doc)
((and (numberp available)
(cl-plusp available))
;; Else, given a positive number of logical lines, we
;; format the *eldoc* buffer, using as most of its
;; contents as we know will fit.
(with-current-buffer (eldoc--format-doc-buffer docs)
(save-excursion
(eldoc--echo-area-substring available))))
;; Else, given a positive number of logical lines, grab
;; as many as we can.
(with-temp-buffer
(eldoc--echo-area-render docs)
(eldoc--echo-area-substring available)))
(t ;; this is the "truncate brutally" situation
(let ((string
(with-current-buffer (eldoc--format-doc-buffer docs)
(with-temp-buffer
(eldoc--echo-area-render docs)
(buffer-substring (goto-char (point-min))
(progn (end-of-visible-line)
(point))))))
@ -644,8 +668,9 @@ If INTERACTIVE is t, also display the buffer."
(defun eldoc-documentation-default ()
"Show the first non-nil documentation string for item at point.
This is the default value for `eldoc-documentation-strategy'."
(run-hook-with-args-until-success 'eldoc-documentation-functions
(eldoc--make-callback :patient)))
(run-hook-wrapped 'eldoc-documentation-functions
(lambda (f)
(funcall f (eldoc--make-callback :eager f)))))
(defun eldoc--documentation-compose-1 (eagerlyp)
"Helper function for composing multiple doc strings.
@ -654,7 +679,8 @@ else wait for all doc strings."
(run-hook-wrapped 'eldoc-documentation-functions
(lambda (f)
(let* ((callback (eldoc--make-callback
(if eagerlyp :eager :patient)))
(if eagerlyp :eager :patient)
f))
(str (funcall f callback)))
(if (or (null str) (stringp str)) (funcall callback str))
nil)))
@ -675,7 +701,7 @@ This is meant to be used as a value for `eldoc-documentation-strategy'."
This is meant to be used as a value for `eldoc-documentation-strategy'."
(run-hook-wrapped 'eldoc-documentation-functions
(lambda (f)
(let* ((callback (eldoc--make-callback :enthusiast))
(let* ((callback (eldoc--make-callback :enthusiast f))
(str (funcall f callback)))
(if (stringp str) (funcall callback str))
nil)))
@ -780,7 +806,7 @@ before a higher priority one.")
;; `eldoc--invoke-strategy' could be moved to
;; `eldoc-documentation-strategy' or thereabouts if/when we decide to
;; extend or publish the `make-callback' protocol.
(defun eldoc--make-callback (method)
(defun eldoc--make-callback (method origin)
"Make callback suitable for `eldoc-documentation-functions'.
The return value is a function FN whose lambda list is (STRING
&rest PLIST) and can be called by those functions. Its
@ -800,8 +826,11 @@ have the following values:
`eldoc-documentation-functions' have been collected;
- `:eager' says to display STRING along with all other competing
strings so far, as soon as possible."
(funcall eldoc--make-callback method))
strings so far, as soon as possible.
ORIGIN is the member of `eldoc-documentation-functions' which
will be responsible for eventually calling the FN."
(funcall eldoc--make-callback method origin))
(defun eldoc--invoke-strategy (interactive)
"Invoke `eldoc-documentation-strategy' function.
@ -838,9 +867,10 @@ the docstrings eventually produced, using
(docs-registered '()))
(cl-labels
((register-doc
(pos string plist)
(pos string plist origin)
(when (and string (> (length string) 0))
(push (cons pos (cons string plist)) docs-registered)))
(push (cons pos (cons string `(:origin ,origin ,@plist)))
docs-registered)))
(display-doc
()
(run-hook-with-args
@ -850,7 +880,7 @@ the docstrings eventually produced, using
(lambda (a b) (< (car a) (car b))))))
interactive))
(make-callback
(method)
(method origin)
(let ((pos (prog1 howmany (cl-incf howmany))))
(cl-ecase method
(:enthusiast
@ -858,7 +888,7 @@ the docstrings eventually produced, using
(when (and string (cl-loop for (p) in docs-registered
never (< p pos)))
(setq docs-registered '())
(register-doc pos string plist))
(register-doc pos string plist origin))
(when (and (timerp eldoc--enthusiasm-curbing-timer)
(memq eldoc--enthusiasm-curbing-timer
timer-list))
@ -870,12 +900,12 @@ the docstrings eventually produced, using
(:patient
(cl-incf want)
(lambda (string &rest plist)
(register-doc pos string plist)
(register-doc pos string plist origin)
(when (zerop (cl-decf want)) (display-doc))
t))
(:eager
(lambda (string &rest plist)
(register-doc pos string plist)
(register-doc pos string plist origin)
(display-doc)
t))))))
(let* ((eldoc--make-callback #'make-callback)

View file

@ -1138,7 +1138,7 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
;; key substitution constructs, load the library.
(and (autoloadp real-def) doc-raw
help-enable-autoload
(string-match "\\([^\\]=\\|[^=]\\|\\`\\)\\\\[[{<]" doc-raw)
(string-match "\\([^\\]=\\|[^=]\\|\\`\\)\\\\[[{<]\\|`.*'" doc-raw)
(autoload-do-load real-def))
(help-fns--key-bindings function)

View file

@ -69,11 +69,12 @@ When nil, show candidates in full."
:type 'boolean
:version "24.4")
(defvar icomplete-tidy-shadowed-file-names nil
(defcustom icomplete-tidy-shadowed-file-names nil
"If non-nil, automatically delete superfluous parts of file names.
For example, if the user types ~/ after a long path name,
everything preceding the ~/ is discarded so the interactive
selection process starts again from the user's $HOME.")
selection process starts again from the user's $HOME."
:type 'boolean)
(defcustom icomplete-show-matches-on-no-input nil
"When non-nil, show completions when first prompting for input.

View file

@ -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))

View file

@ -872,6 +872,14 @@ arguments to pass to the OPERATION."
(tramp-register-foreign-file-name-handler
#'tramp-gvfs-file-name-p #'tramp-gvfs-file-name-handler)))
;; Event type `dbus-event' is added to `while-no-input-ignore-events'
;; in Emacs 29.1. If it is missing, some packages like Helm report
;; problems. So we add it here.
(when (and (featurep 'dbusbind)
(not (memq 'dbus-event while-no-input-ignore-events)))
(setq while-no-input-ignore-events
(cons 'dbus-event while-no-input-ignore-events)))
;; D-Bus helper function.

View file

@ -42,9 +42,10 @@
(declare-function shortdoc-add-function "shortdoc")
(declare-function tramp-dissect-file-name "tramp")
(declare-function tramp-file-name-equal-p "tramp")
(declare-function tramp-tramp-file-p "tramp")
(declare-function tramp-rename-files "tramp-cmds")
(declare-function tramp-rename-these-files "tramp-cmds")
(declare-function tramp-set-connection-local-variables-for-buffer "tramp")
(declare-function tramp-tramp-file-p "tramp")
(defvar eshell-path-env)
(defvar ido-read-file-name-non-ido)
(defvar info-lookup-alist)
@ -549,6 +550,14 @@ See `tramp-process-attributes-ps-format'.")
'(:application tramp :machine "localhost")
local-profile))
;; Set connection-local variables for buffers visiting a file.
(add-hook 'find-file-hook #'tramp-set-connection-local-variables-for-buffer -50)
(add-hook 'tramp-unload-hook
(lambda ()
(remove-hook
'find-file-hook #'tramp-set-connection-local-variables-for-buffer)))
(add-hook 'tramp-unload-hook
(lambda () (unload-feature 'tramp-integration 'force)))

View file

@ -106,6 +106,9 @@ detected as prompt when being sent on echoing hosts, therefore.")
(defconst tramp-end-of-heredoc (md5 tramp-end-of-output)
"String used to recognize end of heredoc strings.")
(define-obsolete-variable-alias
'tramp-use-ssh-controlmaster-options 'tramp-use-connection-share "30.1")
(defcustom tramp-use-connection-share (not (eq system-type 'windows-nt))
"Whether to use connection share in ssh or PuTTY.
Set it to t, if you want Tramp to apply respective options. These
@ -122,11 +125,6 @@ Set it to `suppress' if you want to disable settings in your
;; Check with (safe-local-variable-p 'tramp-use-connection-share 'suppress)
:safe (lambda (val) (and (memq val '(t nil suppress)) t)))
(defvaralias 'tramp-use-connection-share 'tramp-use-ssh-controlmaster-options)
(make-obsolete-variable
'tramp-use-ssh-controlmaster-options
"Use `tramp-use-connection-share' instead" "30.1")
(defvar tramp-ssh-controlmaster-options nil
"Which ssh Control* arguments to use.

View file

@ -1877,7 +1877,7 @@ With a prefix argument, show headings up to that LEVEL."
(save-excursion (goto-char beg) (setq beg (pos-bol)))
(save-excursion (goto-char end) (setq end (pos-eol)))
(remove-overlays beg end 'outline-button t)
(outline--fix-up-all-buttons beg end))
(save-match-data (outline--fix-up-all-buttons beg end)))
(defvar-keymap outline-navigation-repeat-map

View file

@ -156,10 +156,12 @@ comment."
(goto-char (match-beginning 1))
(move-marker start-marker (point))
(replace-match " " nil nil nil 1))
;; Include whitespaces before /*.
(goto-char start)
(beginning-of-line)
(setq start (point))
;; Mask spaces before "*/" if it is attached at the end
;; of a sentence rather than on its own line.
(goto-char end)
@ -172,6 +174,7 @@ comment."
(setq end-len (- (match-end 1) (match-beginning 1)))
(replace-match (make-string end-len ?x)
nil nil nil 1))
;; If "*/" is on its own line, don't included it in the
;; filling region.
(when (not end-marker)
@ -180,13 +183,21 @@ comment."
(backward-char 2)
(skip-syntax-backward "-")
(setq end (point))))
;; Let `fill-paragraph' do its thing.
(goto-char orig-point)
(narrow-to-region start end)
;; We don't want to fill the region between START and
;; START-MARKER, otherwise the filling function might delete
;; some spaces there.
(fill-region start-marker end arg)
(let (para-start para-end)
(forward-paragraph 1)
(setq para-end (point))
(forward-paragraph -1)
(setq para-start (point))
;; We don't want to fill the region between START and
;; START-MARKER, otherwise the filling function might delete
;; some spaces there. Also, we only fill the current
;; paragraph.
(fill-region (max start-marker para-start) (min end para-end) arg))
;; Unmask.
(when start-marker
(goto-char start-marker)

View file

@ -386,7 +386,7 @@ MODE is either `c' or `cpp'."
((parent-is "function_definition") parent-bol 0)
((parent-is "conditional_expression") first-sibling 0)
((parent-is "assignment_expression") parent-bol c-ts-mode-indent-offset)
((parent-is "concatenated_string") parent-bol c-ts-mode-indent-offset)
((parent-is "concatenated_string") first-sibling 0)
((parent-is "comma_expression") first-sibling 0)
((parent-is "init_declarator") parent-bol c-ts-mode-indent-offset)
((parent-is "parenthesized_expression") first-sibling 1)
@ -434,6 +434,8 @@ MODE is either `c' or `cpp'."
((parent-is "while_statement") standalone-parent c-ts-mode-indent-offset)
((parent-is "do_statement") standalone-parent c-ts-mode-indent-offset)
((parent-is "case_statement") standalone-parent c-ts-mode-indent-offset)
,@(when (eq mode 'cpp)
`(((node-is "field_initializer_list") parent-bol ,(* c-ts-mode-indent-offset 2)))))))
`((gnu

View file

@ -221,7 +221,8 @@ chosen (interactively or automatically)."
((java-mode java-ts-mode) . ("jdtls"))
(dart-mode . ("dart" "language-server"
"--client-id" "emacs.eglot-dart"))
((elixir-ts-mode elixir-mode) . ("language_server.sh"))
((elixir-mode elixir-ts-mode heex-ts-mode)
. ("language_server.sh"))
(ada-mode . ("ada_language_server"))
(scala-mode . ,(eglot-alternatives
'("metals" "metals-emacs")))
@ -390,12 +391,18 @@ done by `eglot-reconnect'."
"If non-nil, activate Eglot in cross-referenced non-project files."
:type 'boolean)
(defcustom eglot-prefer-plaintext nil
"If non-nil, always request plaintext responses to hover requests."
:type 'boolean)
(defcustom eglot-menu-string "eglot"
"String displayed in mode line when Eglot is active."
:type 'string)
(defcustom eglot-report-progress t
"If non-nil, show progress of long running LSP server work"
"If non-nil, show progress of long running LSP server work.
If set to `messages', use *Messages* buffer, else use Eglot's
mode line indicator."
:type 'boolean
:version "29.1")
@ -773,7 +780,8 @@ treated as in `eglot--dbind'."
:contextSupport t)
:hover (list :dynamicRegistration :json-false
:contentFormat
(if (fboundp 'gfm-view-mode)
(if (and (not eglot-prefer-plaintext)
(fboundp 'gfm-view-mode))
["markdown" "plaintext"]
["plaintext"]))
:signatureHelp (list :dynamicRegistration :json-false
@ -820,6 +828,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--{})))
@ -1312,6 +1321,7 @@ This docstring appeases checkdoc, that's all."
(eq (jsonrpc-process-type server)
'network))
(emacs-pid))
:clientInfo '(:name "Eglot")
;; Maybe turn trampy `/ssh:foo@bar:/path/to/baz.py'
;; into `/path/to/baz.py', so LSP groks it.
:rootPath (file-local-name
@ -1648,10 +1658,15 @@ Doubles as an indicator of snippet support."
(setq-local markdown-fontify-code-blocks-natively t)
(insert string)
(let ((inhibit-message t)
(message-log-max nil))
(ignore-errors (delay-mode-hooks (funcall mode))))
(font-lock-ensure)
(string-trim (buffer-string)))))
(message-log-max nil)
match)
(ignore-errors (delay-mode-hooks (funcall mode)))
(font-lock-ensure)
(goto-char (point-min))
(while (setq match (text-property-search-forward 'invisible))
(delete-region (prop-match-beginning match)
(prop-match-end match)))
(string-trim (buffer-string))))))
(define-obsolete-variable-alias 'eglot-ignored-server-capabilites
'eglot-ignored-server-capabilities "1.8")
@ -2037,7 +2052,7 @@ Uses THING, FACE, DEFS and PREPEND."
mouse-face mode-line-highlight))))
(defun eglot--mode-line-format ()
"Compose the Eglot's mode-line."
"Compose Eglot's mode-line."
(let* ((server (eglot-current-server))
(nick (and server (eglot-project-nickname server)))
(pending (and server (hash-table-count
@ -2074,7 +2089,15 @@ Uses THING, FACE, DEFS and PREPEND."
'((mouse-3 eglot-forget-pending-continuations
"Forget pending continuations"))
"Number of outgoing, \
still unanswered LSP requests to the server\n"))))))))
still unanswered LSP requests to the server\n")))
,@(cl-loop for pr hash-values of (eglot--progress-reporters server)
when (eq (car pr) 'eglot--mode-line-reporter)
append `("/" ,(eglot--mode-line-props
(format "%s%%%%" (or (nth 4 pr) "?"))
'eglot-mode-line
nil
(format "(%s) %s %s" (nth 1 pr)
(nth 2 pr) (nth 3 pr))))))))))
(add-to-list 'mode-line-misc-info
`(eglot--managed-mode (" [" eglot--mode-line-format "] ")))
@ -2133,13 +2156,14 @@ COMMAND is a symbol naming the command."
type message))
(cl-defmethod eglot-handle-request
(_server (_method (eql window/showMessageRequest)) &key type message actions)
(_server (_method (eql window/showMessageRequest))
&key type message actions &allow-other-keys)
"Handle server request window/showMessageRequest."
(let* ((actions (append actions nil)) ;; gh#627
(label (completing-read
(concat
(format (propertize "[eglot] Server reports (type=%s): %s"
'face (if (<= type 1) 'error))
'face (if (or (not type) (<= type 1)) 'error))
type message)
"\nChoose an option: ")
(or (mapcar (lambda (obj) (plist-get obj :title)) actions)
@ -2163,22 +2187,31 @@ COMMAND is a symbol naming the command."
(server (_method (eql $/progress)) &key token value)
"Handle $/progress notification identified by TOKEN from SERVER."
(when eglot-report-progress
(cl-flet ((fmt (&rest args) (mapconcat #'identity args " ")))
(cl-flet ((fmt (&rest args) (mapconcat #'identity args " "))
(mkpr (title)
(if (eq eglot-report-progress 'messages)
(make-progress-reporter
(format "[eglot] %s %s: %s"
(eglot-project-nickname server) token title))
(list 'eglot--mode-line-reporter token title)))
(upd (pcnt msg &optional
(pr (gethash token (eglot--progress-reporters server))))
(cond
((eq (car pr) 'eglot--mode-line-reporter)
(setcdr (cddr pr) (list msg pcnt))
(force-mode-line-update t))
(pr (progress-reporter-update pr pcnt msg)))))
(eglot--dbind ((WorkDoneProgress) kind title percentage message) value
(pcase kind
("begin"
(let* ((prefix (format (concat "[eglot] %s %s:" (when percentage " "))
(eglot-project-nickname server) token))
(pr (puthash token
(if percentage
(make-progress-reporter prefix 0 100 percentage 1 0)
(make-progress-reporter prefix nil nil nil 1 0))
(eglot--progress-reporters server))))
(eglot--reporter-update pr percentage (fmt title message))))
("report"
(when-let ((pr (gethash token (eglot--progress-reporters server))))
(eglot--reporter-update pr percentage (fmt title message))))
("end" (remhash token (eglot--progress-reporters server))))))))
(upd percentage (fmt title message)
(puthash token (mkpr title)
(eglot--progress-reporters server))))
("report" (upd percentage message))
("end" (upd (or percentage 100) message)
(run-at-time 2 nil
(lambda ()
(remhash token (eglot--progress-reporters server))))))))))
(cl-defmethod eglot-handle-notification
(_server (_method (eql textDocument/publishDiagnostics)) &key uri diagnostics
@ -2484,7 +2517,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))))
@ -3146,7 +3179,8 @@ for which LSP on-type-formatting should be requested."
(eglot--when-buffer-window buf
(let ((info (unless (seq-empty-p contents)
(eglot--hover-info contents range))))
(funcall cb info :buffer t))))
(funcall cb info
:echo (and info (string-match "\n" info))))))
:deferred :textDocument/hover))
(eglot--highlight-piggyback cb)
t))

View file

@ -636,7 +636,7 @@ If SELECT is non-nil, select the target window."
(defface xref-match '((t :inherit match))
"Face used to highlight matches in the xref buffer."
:version "27.1")
:version "28.1")
(defmacro xref--with-dedicated-window (&rest body)
`(let* ((xref-w (get-buffer-window xref-buffer-name))

View file

@ -9108,6 +9108,13 @@ presented."
"Toggle buffer size display in the mode line (Size Indication mode)."
:global t :group 'mode-line)
(defcustom remote-file-name-inhibit-auto-save nil
"When nil, `auto-save-mode' will auto-save remote files.
Any other value means that it will not."
:group 'auto-save
:type 'boolean
:version "30.1")
(define-minor-mode auto-save-mode
"Toggle auto-saving in the current buffer (Auto Save mode).
@ -9130,6 +9137,9 @@ For more details, see Info node `(emacs) Auto Save'."
(setq buffer-auto-save-file-name
(cond
((null val) nil)
((and buffer-file-name remote-file-name-inhibit-auto-save
(file-remote-p buffer-file-name))
nil)
((and buffer-file-name auto-save-visited-file-name
(not buffer-read-only))
buffer-file-name)

View file

@ -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.

View file

@ -60,6 +60,22 @@ RUN ./autogen.sh autoconf
RUN ./configure --with-file-notification=gfile
RUN make bootstrap
FROM emacs-base as emacs-eglot
RUN apt-get update && \
apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \
wget \
&& rm -rf /var/lib/apt/lists/*
# We install a recent clangd for Eglot tests.
RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
COPY . /checkout
WORKDIR /checkout
RUN ./autogen.sh autoconf
RUN ./configure
RUN make bootstrap
FROM emacs-base as emacs-gnustep
RUN apt-get update && \
@ -75,9 +91,10 @@ RUN make bootstrap
FROM emacs-base as emacs-native-comp
# The libgccjit version must correspond to the gcc version.
RUN apt-get update && \
apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \
libgccjit-6-dev \
libgccjit-10-dev \
&& rm -rf /var/lib/apt/lists/*
FROM emacs-native-comp as emacs-native-comp-speed0

View file

@ -166,6 +166,16 @@ default:
- test/lisp/autorevert-tests.el
- test/lisp/filenotify-tests.el
.eglot-template:
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
- if: '$CI_PIPELINE_SOURCE == "schedule"'
changes:
- "**.in"
- lisp/progmodes/eglot.el
- test/infra/*
- test/lisp/progmodes/eglot-tests.el
.native-comp-template:
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
@ -229,22 +239,44 @@ 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:
build-image-eglot:
stage: platform-images
extends: [.job-template, .build-template, .gnustep-template]
extends: [.job-template, .build-template, .eglot-template]
variables:
target: emacs-gnustep
target: emacs-eglot
test-gnustep:
# This tests the GNUstep build process.
test-eglot:
stage: platforms
extends: [.job-template, .gnustep-template]
extends: [.job-template, .test-template, .eglot-template]
needs:
- job: build-image-gnustep
- job: build-image-eglot
optional: true
variables:
target: emacs-gnustep
make_params: install
target: emacs-eglot
# This is needed in order to get a JUnit test report.
make_params: '-k -C test check-expensive LOGFILES="lisp/progmodes/eglot-tests.log"'
# The next two jobs are commented out due to bug#62210.
# 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

View file

@ -188,6 +188,36 @@ int main()
}
=-=-=
Name: Switch-Case statement
=-=
int main() {
switch (a) {
case 1:
b = c;
return 10;
case 2:
{
a = b;
return 12
}
}
}
=-=
int main() {
switch (a) {
case 1:
b = c;
return 10;
case 2:
{
a = b;
return 12
}
}
}
=-=-=
Name: Multiline Block Comments 1 (bug#60270)
=-=

View file

@ -314,6 +314,13 @@ then restored."
(setq last-command-event char)
(call-interactively (key-binding (vector char))))
(defun eglot--clangd-version ()
"Report on the clangd version used in various tests."
(let ((version (shell-command-to-string "clangd --version")))
(when (string-match "version[[:space:]]+\\([0-9.]*\\)"
version)
(match-string 1 version))))
;;; Unit tests
@ -452,6 +459,7 @@ then restored."
(ert-deftest eglot-test-diagnostic-tags-unnecessary-code ()
"Test rendering of diagnostics tagged \"unnecessary\"."
(skip-unless (executable-find "clangd"))
(skip-unless (version<= "14" (eglot--clangd-version)))
(eglot--with-fixture
`(("diag-project" .
(("main.cpp" . "int main(){float a = 42.2; return 0;}"))))

View file

@ -306,3 +306,27 @@ Name: Long tuple
{"January", "February", "March", "April", "May", "June", "July", "August", "September",
"October", "November", "December"}
=-=-=
Name: Embedded HEEx
=-=
defmodule Foo do
def foo(assigns) do
~H"""
<span>
text
</span>
"""
end
end
=-=
defmodule Foo do
def foo(assigns) do
~H"""
<span>
text
</span>
"""
end
end
=-=-=

View file

@ -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. ;;