diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 3b52385347b..f23dc1fdb51 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -792,6 +792,46 @@ search engine whose @acronym{URL} is specified by the variable Wowser Manual}). If the region is not active, or doesn't contain any words, this command prompts the user for a URL or keywords to search. +@findex dictionary-search +@findex dictionary +@findex dictionary-tooltip-mode +@cindex dictionary server protocol (DICT) +@cindex word definition search +@vindex dictionary-server + You can also search for definitions of a word by querying dictionary +servers via the @sc{dict} protocol defined by @acronym{RFC} 2229. Emacs +includes a client for this protocol. Type @w{@kbd{M-x dictionary-search +@key{RET}}} to connect to a @sc{dict} server and ask it to provide the +available definitions of a word. This command prompts for the word to +look up, using the word at point as the default, then asks the @sc{dict} +server to provide the definitions of that word in one or more +dictionaries. By default, the command first tries to connect to the +@sc{dict} server installed on the local host, and if that fails, it +tries @file{dict.org} after your confirmation; customize the variable +@code{dictionary-server} to specify, as a string, the URL of a single +server to use (use @samp{localhost} if you want to query only the local +server). Normally, @code{dictionary-search} tells the server to look up +the word in all the dictionaries available to the server, but if you +invoke the command with a prefix argument, it will prompt for a single +dictionary to look. The list of dictionaries available to a server can +be displayed by pressing the @samp{Select dictionary} button shown in +the @file{*Dictionary*} buffer, described below. + + First time you use @code{dictionary-search}, it creates a new +@file{*Dictionary*} buffer and turns on a special mode in it. The +buffer shows buttons for selecting a dictionary, searching a definition +of another word, etc. Subsequent @code{dictionary-search} commands +reuse this buffer. To create another such buffer (e.g., too look up +other words, perhaps in another dictionary), type @w{@kbd{M-x dictionary +@key{RET}}}. + + If you turn on @code{dictionary-tooltip-mode} in a buffer, Emacs will +look up the definitions of the word at mouse pointer and show those +definitions in a tool tip. This is handy when you are reading text with +many words about whose meaning you are unsure. + + For other options of dictionary-search, see the @code{dictionary} +customization group (@pxref{Specific Customization}). @node Symbol Search @section Symbol Search diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 70db8521481..5c63f192447 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -1299,7 +1299,8 @@ and modification. This function returns @code{t} if the file @var{filename1} is newer than file @var{filename2}. If @var{filename1} does not exist, it returns @code{nil}. If @var{filename1} does exist, but -@var{filename2} does not, it returns @code{t}. +@var{filename2} does not, it returns @code{t}. Otherwise, it compares +the times of last modification of the files. In the following example, assume that the file @file{aug-19} was written on the 19th, @file{aug-20} was written on the 20th, and the file diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index fb5b618bd84..959bbfa6857 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -123,14 +123,16 @@ Here's how to start using Eglot with your programming project: @item Select and install a language server. -Eglot comes pre-configured with many popular language servers, see the -value of @code{eglot-server-programs}. If the server(s) mentioned -there satisfy your needs for the programming language(s) with which -you want to use Eglot, you just need to make sure those servers are -installed on your system. Alternatively, install one or more servers -of your choice and add them to the value of +Eglot comes pre-configured for many popular language servers, see the +value of @code{eglot-server-programs}. If the server(s) mentioned there +satisfy your needs for the programming language(s) with which you want +to use Eglot, you just need to make sure those servers are installed on +your system and Eglot can find them. + +Alternatively, install one or more servers of your choice and tell Eglot +where to find them. To do that, you may add to the value of @code{eglot-server-programs}, as described in @ref{Setting Up LSP -Servers}. +Servers} or have Eglot prompt you about it (@pxref{Eglot Commands}). @item Turn on Eglot for your project. @@ -197,7 +199,7 @@ particular server(s) you want to install. To use a language server, Eglot must know how to start it and which programming languages each server supports. This information is -provided by the variable @code{eglot-server-programs}. +commonly provided by the variable @code{eglot-server-programs}. @defvar eglot-server-programs This variable associates major modes with names and command-line @@ -939,12 +941,16 @@ to @w{@code{(disallow-non-standard-keys enforce-required-keys)}}. @vindex eglot-server-initialized-hook @item eglot-server-initialized-hook -A hook run after the server object is successfully initialized. +A hook run after the server object is successfully initialized (which +includes launching the process) but before any LSP communication is +attempted. Each function receives a @code{eglot-lsp-server} instance as +argument. @vindex eglot-connect-hook @item eglot-connect-hook -A hook run after connection to the server is successfully -established. @xref{Starting Eglot}. +A hook run after the LSP connection to the server is successfully +established. Each function receives a @code{eglot-lsp-server} instance +as argument. @xref{Starting Eglot}. @item eglot-managed-mode-hook A hook run after Eglot started or stopped managing a buffer. diff --git a/etc/TODO b/etc/TODO index 756ce49e2a4..f9918fede38 100644 --- a/etc/TODO +++ b/etc/TODO @@ -788,9 +788,6 @@ to ASCII. *** Provide a user friendly interface to specify fonts -** Use the XIE X extension, if available, for image display -This is obsolete, as XIE itself is now considered obsolete. - ** Make monochrome images honor the face Display those images using the foreground and background colors of the applicable faces. diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 3acf2588f24..ac2e0645f96 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -574,13 +574,16 @@ R1 and R2 are dotted pairs. Colorize it with FACE." (defun chart-bar-quickie (dir title namelst nametitle numlst numtitle &optional max sort-pred) - "Wash over the complex EIEIO stuff and create a nice bar chart. -Create it going in direction DIR [`horizontal' `vertical'] with TITLE -using a name sequence NAMELST labeled NAMETITLE with values NUMLST -labeled NUMTITLE. -Optional arguments: -Set the chart's max element display to MAX, and sort lists with -SORT-PRED if desired." + "Create a bar chart named TITLE in direction DIR [`horizontal' `vertical']. +NAMELST is the list of bar names and NAMETITLE is the name the of axis +containing them. +NUMLST is the list of values and NUMTITLE is the name of the value +axis. +Optional argument MAX limits the chart's max element display to MAX by +passing it as second argument to `chart-trim', otherwise the chart's +display is unlimited. +Optional argument SORT-PRED is a predicate function passed as second +argument to `chart-sort' to sort the lists if desired." (let ((nc (make-instance 'chart-bar :title title :key-label "8-m" ; This is a text key pic diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 2e501005bf7..b37f744b175 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2505,7 +2505,7 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...). (defmacro cl-once-only (names &rest body) "Generate code to evaluate each of NAMES just once in BODY. -This macro helps with writing other macros. Each of names is +This macro helps with writing other macros. Each of NAMES is either (NAME FORM) or NAME, which latter means (NAME NAME). During macroexpansion, each NAME is bound to an uninterned symbol. The expansion evaluates each FORM and binds it to the diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index a5ce5b65cd7..d86e48e6281 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -579,11 +579,13 @@ HEADER is a header component of a MIME-entity object (see (ignore-errors (base64-decode-region pos (point)))) ((string= transfer-encoding "quoted-printable") (quoted-printable-decode-region pos (point)))))) - (decode-coding-region - pos (point) - ;; Use -dos decoding, to remove ^M characters left from base64 or - ;; rogue qp-encoded text. - (coding-system-change-eol-conversion coding-system 1)) + ;; If the text is empty, we don't have anything to decode. + (and (/= pos (point)) + (decode-coding-region + pos (point) + ;; Use -dos decoding, to remove ^M characters left from base64 + ;; or rogue qp-encoded text. + (coding-system-change-eol-conversion coding-system 1))) (if (and (or (not rmail-mime-coding-system) (consp rmail-mime-coding-system)) (not (eq (coding-system-base coding-system) 'us-ascii))) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 303c994637c..3f6a7422aa0 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -338,10 +338,13 @@ characters of the current line." ;; If the start of the previous sibling isn't at the ;; beginning of a line, something's probably not quite ;; right, go a step further. (E.g., comment after a - ;; statement.) + ;; statement.) If the previous sibling is the first named + ;; node then anchor to that, e.g. when returning an aggregate + ;; and starting the items on the same line as {. (_ (goto-char (treesit-node-start prev-sibling)) - (if (looking-back (rx bol (* whitespace)) - (line-beginning-position)) + (if (or (looking-back (rx bol (* whitespace)) + (line-beginning-position))) + (null (treesit-node-prev-sibling prev-sibling t)) (setq continue nil) (setq prev-sibling (treesit-node-prev-sibling prev-sibling))))))) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 3c0c23f1c45..0a1f9ee4481 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1480,18 +1480,21 @@ Use current server's or first available Eglot events buffer." (defvar eglot-connect-hook '(eglot-signal-didChangeConfiguration) - "Hook run after connecting in `eglot--connect'.") + "Hook run after connecting to a server. +Each function is passed an `eglot-lsp-server' instance +as argument.") (defvar eglot-server-initialized-hook '() "Hook run after a `eglot-lsp-server' instance is created. -That is before a connection was established. Use +That is before a connection is established. Use `eglot-connect-hook' to hook into when a connection was successfully established and the server on the other side has received the initializing configuration. -Each function is passed the server as an argument") +Each function is passed an `eglot-lsp-server' instance +as argument.") (defun eglot--cmd (contact) "Helper for `eglot--connect'." @@ -3232,7 +3235,8 @@ for which LSP on-type-formatting should be requested." :resolveProvider) (plist-get lsp-comp :data)) (eglot--request server :completionItem/resolve - lsp-comp :cancel-on-input t) + lsp-comp :cancel-on-input t + :immediate t) lsp-comp)))))) (when (and (consp eglot--capf-session) (= (car bounds) (car (nth 0 eglot--capf-session))) diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el index a3e11658468..cacdb266298 100644 --- a/lisp/progmodes/elixir-ts-mode.el +++ b/lisp/progmodes/elixir-ts-mode.el @@ -734,9 +734,6 @@ Return nil if NODE is not a defun node or doesn't have a name." (when (treesit-ready-p 'heex) (setq-local treesit-range-settings elixir-ts--treesit-range-rules) - (setq-local treesit-simple-indent-rules - (append treesit-simple-indent-rules heex-ts--indent-rules)) - (setq-local treesit-font-lock-settings (append treesit-font-lock-settings heex-ts--font-lock-settings)) diff --git a/src/coding.c b/src/coding.c index 547fcbb8120..cd5a12972e6 100644 --- a/src/coding.c +++ b/src/coding.c @@ -5270,7 +5270,9 @@ decode_coding_raw_text (struct coding_system *coding) coding->chars_at_source = 1; coding->consumed_char = coding->src_chars; coding->consumed = coding->src_bytes; - if (eol_dos && coding->source[coding->src_bytes - 1] == '\r') + if (eol_dos + && coding->src_bytes > 0 /* empty source text? */ + && coding->source[coding->src_bytes - 1] == '\r') { coding->consumed_char--; coding->consumed--; diff --git a/src/fileio.c b/src/fileio.c index 212d2ce6f98..291c316102f 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3788,7 +3788,8 @@ DEFUN ("unix-sync", Funix_sync, Sunix_sync, 0, 0, "", DEFUN ("file-newer-than-file-p", Ffile_newer_than_file_p, Sfile_newer_than_file_p, 2, 2, 0, doc: /* Return t if file FILE1 is newer than file FILE2. If FILE1 does not exist, the answer is nil; -otherwise, if FILE2 does not exist, the answer is t. */) +otherwise, if FILE2 does not exist, the answer is t. +For existing files, this compares their last-modified times. */) (Lisp_Object file1, Lisp_Object file2) { struct stat st1, st2; diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts index 599173832b5..a13a74cf8b3 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts @@ -208,6 +208,21 @@ int main() } =-=-= +Name: Return Compund Literal + +=-= +struct pair { int fst, snd; }; +struct pair +make_pair(int long_identifier_a[], int long_identifier_b[], + int offset_a, int offset_b) +{ + int base_offset = 10; + return (struct pair) { long_identifier_a[base_offset + offset_b], + long_identifier_b[base_offset + offset_b] }; +} + +=-=-= + Name: Switch-Case statement =-= @@ -486,6 +501,30 @@ namespace A { } =-=-= +Name: Return Aggregate Initialized Struct + +=-= +struct pair { int x, y; } +pair +make_pair(int long_identifier_a[], int long_identifier_b[], + int offset_a, int offset_b) +{ + int base_offset = 10; + return { long_identifier_a[base_offset + offset_b], + long_identifier_b[base_offset + offset_b] }; +} +=-= +struct pair { int x, y; } +pair +make_pair(int long_identifier_a[], int long_identifier_b[], + int offset_a, int offset_b) +{ + int base_offset = 10; + return { long_identifier_a[base_offset + offset_b], + long_identifier_b[base_offset + offset_b] }; +} +=-=-= + Code: (lambda () (c-ts-mode)