diff options
| author | Po Lu | 2023-07-20 19:52:01 +0800 |
|---|---|---|
| committer | Po Lu | 2023-07-20 19:52:01 +0800 |
| commit | 7196d2d18e307ce2a07d09696bbb51f59a7d6b1b (patch) | |
| tree | 736d25a5aaf58a79edd2be73cf3ecadd0382df2c | |
| parent | 353f90c7584497ff6525c44d31263896f02a43d4 (diff) | |
| parent | f9bbe3189b0eee627c3d8bca3221882cf0c29b26 (diff) | |
| download | emacs-7196d2d18e307ce2a07d09696bbb51f59a7d6b1b.tar.gz emacs-7196d2d18e307ce2a07d09696bbb51f59a7d6b1b.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
| -rw-r--r-- | admin/notes/bugtracker | 27 | ||||
| -rw-r--r-- | doc/lispref/keymaps.texi | 20 | ||||
| -rw-r--r-- | etc/EGLOT-NEWS | 7 | ||||
| -rw-r--r-- | lisp/cus-edit.el | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 15 | ||||
| -rw-r--r-- | lisp/net/rcirc.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/eglot.el | 34 | ||||
| -rw-r--r-- | src/nsfns.m | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 153 |
9 files changed, 168 insertions, 104 deletions
diff --git a/admin/notes/bugtracker b/admin/notes/bugtracker index deb06f552cc..b47061884d6 100644 --- a/admin/notes/bugtracker +++ b/admin/notes/bugtracker | |||
| @@ -39,7 +39,7 @@ tags 123 moreinfo|unreproducible|wontfix|patch|notabug | |||
| 39 | 39 | ||
| 40 | For a list of all bugs, see https://debbugs.gnu.org/db/pa/lemacs.html | 40 | For a list of all bugs, see https://debbugs.gnu.org/db/pa/lemacs.html |
| 41 | This is a static page, updated once a day. There is also a dynamic | 41 | This is a static page, updated once a day. There is also a dynamic |
| 42 | list, generated on request. This accepts various options, eg to see | 42 | list, generated on request. This accepts various options, e.g., to see |
| 43 | the most recent bugs: | 43 | the most recent bugs: |
| 44 | 44 | ||
| 45 | https://debbugs.gnu.org/cgi/pkgreport.cgi?newest=100 | 45 | https://debbugs.gnu.org/cgi/pkgreport.cgi?newest=100 |
| @@ -98,7 +98,7 @@ you might want to have a dialog with the owner address, outside of | |||
| 98 | normal bug reporting.) | 98 | normal bug reporting.) |
| 99 | 99 | ||
| 100 | ** When reporting a new bug, to send a Cc to another address | 100 | ** When reporting a new bug, to send a Cc to another address |
| 101 | (e.g. bug-cc-mode@gnu.org), do NOT just use a Cc: header. | 101 | (e.g., bug-cc-mode@gnu.org), do NOT just use a Cc: header. |
| 102 | Instead, use "X-Debbugs-Cc:". This ensures the Cc address(es) will get a | 102 | Instead, use "X-Debbugs-Cc:". This ensures the Cc address(es) will get a |
| 103 | mail with the bug report number in. If you do not do this, each reply | 103 | mail with the bug report number in. If you do not do this, each reply |
| 104 | in the subsequent discussion might end up creating a new bug. | 104 | in the subsequent discussion might end up creating a new bug. |
| @@ -138,7 +138,8 @@ The "maintainer email address" is "bug-gnu-emacs@gnu.org" in most cases. | |||
| 138 | 138 | ||
| 139 | ** To not get acknowledgment mail from the tracker, | 139 | ** To not get acknowledgment mail from the tracker, |
| 140 | add an "X-Debbugs-No-Ack:" header (with any value). If you use Gnus, | 140 | add an "X-Debbugs-No-Ack:" header (with any value). If you use Gnus, |
| 141 | you can add an element to gnus-posting-styles to do this automatically, eg: | 141 | you can add an element to gnus-posting-styles to do this automatically, |
| 142 | e.g.: | ||
| 142 | 143 | ||
| 143 | ("gnu-emacs\\(-pretest\\)?-bug" | 144 | ("gnu-emacs\\(-pretest\\)?-bug" |
| 144 | ("X-Debbugs-No-Ack" "yes")) | 145 | ("X-Debbugs-No-Ack" "yes")) |
| @@ -222,14 +223,14 @@ Mail-Followup-To: 123@debbugs.gnu.org, person-who-closed | |||
| 222 | ** Setting bug parameters. | 223 | ** Setting bug parameters. |
| 223 | There are two ways to set the parameters of bugs in the database | 224 | There are two ways to set the parameters of bugs in the database |
| 224 | (tags, severity level, etc). When you report a new bug, you can | 225 | (tags, severity level, etc). When you report a new bug, you can |
| 225 | provide a "pseudo-header" at the start of the report, eg: | 226 | provide a "pseudo-header" at the start of the report, e.g.: |
| 226 | 227 | ||
| 227 | Package: emacs | 228 | Package: emacs |
| 228 | Version: 23.0.60 | 229 | Version: 23.0.60 |
| 229 | Severity: minor | 230 | Severity: minor |
| 230 | 231 | ||
| 231 | This can also include tags, or any X-Debbugs- setting. | 232 | This can also include tags, or any X-Debbugs- setting. |
| 232 | Some things (e.g. submitter) don't seem to work here. | 233 | Some things (e.g., submitter) don't seem to work here. |
| 233 | 234 | ||
| 234 | Otherwise, send mail to the control server, control@debbugs.gnu.org. | 235 | Otherwise, send mail to the control server, control@debbugs.gnu.org. |
| 235 | At the start of the message body, supply the desired commands, one per | 236 | At the start of the message body, supply the desired commands, one per |
| @@ -258,12 +259,12 @@ where VERSION is XX.YY numerical version number, like 42.1. | |||
| 258 | *** To reopen a closed bug: | 259 | *** To reopen a closed bug: |
| 259 | reopen 123 | 260 | reopen 123 |
| 260 | 261 | ||
| 261 | *** Bugs can be tagged in various ways (eg wontfix, patch, etc). | 262 | *** Bugs can be tagged in various ways (e.g., wontfix, patch, etc). |
| 262 | The available tags are: | 263 | The available tags are: |
| 263 | patch wontfix moreinfo unreproducible fixed notabug help security confirmed easy | 264 | patch wontfix moreinfo unreproducible fixed notabug help security confirmed easy |
| 264 | See https://debbugs.gnu.org/Developer#tags | 265 | See https://debbugs.gnu.org/Developer#tags |
| 265 | The list of tags can be prefixed with +, - or =, meaning to add (the | 266 | The list of tags can be prefixed with +, - or =, meaning to add (the |
| 266 | default), remove, or reset the tags. E.g.: | 267 | default), remove, or reset the tags. E.g.: |
| 267 | 268 | ||
| 268 | tags 123 + wontfix | 269 | tags 123 + wontfix |
| 269 | 270 | ||
| @@ -310,7 +311,7 @@ This will add a usertag "any-tag-you-like" to bug#1234. The tag will | |||
| 310 | be associated with the user "emacs". If you omit the first line, | 311 | be associated with the user "emacs". If you omit the first line, |
| 311 | the tag will be associated with your email address. | 312 | the tag will be associated with your email address. |
| 312 | 313 | ||
| 313 | The syntax of the usertags command is the same as that of tags (eg wrt | 314 | The syntax of the usertags command is the same as that of tags (e.g., wrt |
| 314 | the optional [=+-] argument). | 315 | the optional [=+-] argument). |
| 315 | 316 | ||
| 316 | b) In an initial submission, in the pseudo-header: | 317 | b) In an initial submission, in the pseudo-header: |
| @@ -340,15 +341,15 @@ than one email address, but it does not seem to work for me.) | |||
| 340 | **** To find bugs tagged with a specific usertag: | 341 | **** To find bugs tagged with a specific usertag: |
| 341 | 342 | ||
| 342 | This works just like a normal tags search, but with the addition of a | 343 | This works just like a normal tags search, but with the addition of a |
| 343 | "users" field. Eg: | 344 | "users" field. E.g.: |
| 344 | 345 | ||
| 345 | https://debbugs.gnu.org/cgi/pkgreport.cgi?users=emacs;tag=calendar | 346 | https://debbugs.gnu.org/cgi/pkgreport.cgi?users=emacs;tag=calendar |
| 346 | 347 | ||
| 347 | *** To merge bugs: | 348 | *** To merge bugs: |
| 348 | Eg when bad replies create a bunch of new bugs for the same report. | 349 | e.g., when bad replies create a bunch of new bugs for the same report. |
| 349 | Bugs must all be in the same state (e.g. same package(s) and severity | 350 | Bugs must all be in the same state (e.g., same package(s) and severity |
| 350 | -- see 'reassign' and 'severity' below), but need not have the same | 351 | -- see 'reassign' and 'severity' below), but need not have the same |
| 351 | tags (tags are merged). E.g.: | 352 | tags (tags are merged). E.g.: |
| 352 | 353 | ||
| 353 | merge 123 124 125 ... | 354 | merge 123 124 125 ... |
| 354 | 355 | ||
| @@ -557,7 +558,7 @@ debbugs-submit. Approved mail is passed on to the tracker. | |||
| 557 | tracker, since mail from whitelisted senders goes straight through.) | 558 | tracker, since mail from whitelisted senders goes straight through.) |
| 558 | 559 | ||
| 559 | NOTE: An alternative to this would be to use listhelper AT nongnu.org | 560 | NOTE: An alternative to this would be to use listhelper AT nongnu.org |
| 560 | as a moderator address. Eg the emacs-bug-tracker list uses this. | 561 | as a moderator address. E.g., the emacs-bug-tracker list uses this. |
| 561 | It does basic spam processing on the moderator requests and | 562 | It does basic spam processing on the moderator requests and |
| 562 | automatically rejects the obviously bogus ones. Someone still has to | 563 | automatically rejects the obviously bogus ones. Someone still has to |
| 563 | accept the good ones though. The advantage of this would not be having | 564 | accept the good ones though. The advantage of this would not be having |
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index e41dbf9def8..99bc10677cd 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi | |||
| @@ -2515,7 +2515,8 @@ get a non-selectable menu item. This is mostly useful when creating | |||
| 2515 | separator lines and the like. | 2515 | separator lines and the like. |
| 2516 | 2516 | ||
| 2517 | The tail of the list, @var{item-property-list}, has the form of a | 2517 | The tail of the list, @var{item-property-list}, has the form of a |
| 2518 | property list which contains other information. | 2518 | property list (@pxref{Property Lists}) which contains other |
| 2519 | information. | ||
| 2519 | 2520 | ||
| 2520 | Here is a table of the properties that are supported: | 2521 | Here is a table of the properties that are supported: |
| 2521 | 2522 | ||
| @@ -3196,14 +3197,15 @@ the menu. To put it elsewhere in the menu, use @code{keymap-set-after}: | |||
| 3196 | 3197 | ||
| 3197 | @defun keymap-set-after map key binding &optional after | 3198 | @defun keymap-set-after map key binding &optional after |
| 3198 | Define a binding in @var{map} for @var{key}, with value @var{binding}, | 3199 | Define a binding in @var{map} for @var{key}, with value @var{binding}, |
| 3199 | just like @code{define-key}, but position the binding in @var{map} after | 3200 | just like @code{keymap-set} (@pxref{Changing Key Bindings}), but |
| 3200 | the binding for the event @var{after}. The argument @var{key} should | 3201 | position the binding in @var{map} after the binding for the event |
| 3201 | represent a single menu item or key, and @var{after} should be a | 3202 | @var{after}. The argument @var{key} should represent a single menu |
| 3202 | single event type---a symbol or a character, not a sequence. The new | 3203 | item or key, and should satisfy @code{key-valid-p} (@pxref{Key |
| 3203 | binding goes after the binding for @var{after}. If @var{after} is | 3204 | Sequences}). @var{after} should be a single event type---a symbol or |
| 3204 | @code{t} or is omitted, then the new binding goes last, at the end of | 3205 | a character, not a sequence. The new binding goes after the binding |
| 3205 | the keymap. However, new bindings are added before any inherited | 3206 | for @var{after}. If @var{after} is @code{t} or is omitted, then the |
| 3206 | keymap. | 3207 | new binding goes last, at the end of the keymap. However, new |
| 3208 | bindings are added before any inherited keymap. | ||
| 3207 | 3209 | ||
| 3208 | Here is an example: | 3210 | Here is an example: |
| 3209 | 3211 | ||
diff --git a/etc/EGLOT-NEWS b/etc/EGLOT-NEWS index 6a2e9051ddc..0ccc8af3169 100644 --- a/etc/EGLOT-NEWS +++ b/etc/EGLOT-NEWS | |||
| @@ -27,6 +27,13 @@ watching requests. This change slightly reduces the number of file | |||
| 27 | watcher objects requested from the operating system, which can be a | 27 | watcher objects requested from the operating system, which can be a |
| 28 | problem, particularly on Mac OS. See github#1228 and github#1226. | 28 | problem, particularly on Mac OS. See github#1228 and github#1226. |
| 29 | 29 | ||
| 30 | ** Fixed "onTypeFormatting" feature | ||
| 31 | |||
| 32 | This feature wasn't triggered for the 'newline' command because | ||
| 33 | language servers often expect 10 (linefeed) to be the trigger | ||
| 34 | character, but 'newline' emits 13 (carriage return). Also made this | ||
| 35 | feature less chatty in the mode-line and messages buffer. | ||
| 36 | |||
| 30 | 37 | ||
| 31 | * Changes in Eglot 1.15 (29/4/2023) | 38 | * Changes in Eglot 1.15 (29/4/2023) |
| 32 | 39 | ||
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index d0eba71e754..fda44ff6a3b 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -3533,7 +3533,11 @@ GNUstep or Macintosh OS Cocoa interface.") | |||
| 3533 | (const :format "PGTK " | 3533 | (const :format "PGTK " |
| 3534 | :sibling-args (:help-echo "\ | 3534 | :sibling-args (:help-echo "\ |
| 3535 | Pure-GTK interface.") | 3535 | Pure-GTK interface.") |
| 3536 | ns) | 3536 | pgtk) |
| 3537 | (const :format "Haiku " | ||
| 3538 | :sibling-args (:help-echo "\ | ||
| 3539 | Haiku interface.") | ||
| 3540 | haiku) | ||
| 3537 | (const :format "DOS " | 3541 | (const :format "DOS " |
| 3538 | :sibling-args (:help-echo "\ | 3542 | :sibling-args (:help-echo "\ |
| 3539 | Plain MS-DOS.") | 3543 | Plain MS-DOS.") |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index bbe5f00fde1..392f8fafa79 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -4641,13 +4641,14 @@ DESC must be a `package-desc' object." | |||
| 4641 | vars) | 4641 | vars) |
| 4642 | (dolist-with-progress-reporter (group custom-current-group-alist) | 4642 | (dolist-with-progress-reporter (group custom-current-group-alist) |
| 4643 | "Scanning for modified user options..." | 4643 | "Scanning for modified user options..." |
| 4644 | (dolist (ent (get (cdr group) 'custom-group)) | 4644 | (when (and (car group) |
| 4645 | (when (and (custom-variable-p (car ent)) | 4645 | (file-in-directory-p (car group) (package-desc-dir desc))) |
| 4646 | (boundp (car ent)) | 4646 | (dolist (ent (get (cdr group) 'custom-group)) |
| 4647 | (not (eq (custom--standard-value (car ent)) | 4647 | (when (and (custom-variable-p (car ent)) |
| 4648 | (default-toplevel-value (car ent)))) | 4648 | (boundp (car ent)) |
| 4649 | (file-in-directory-p (car group) (package-desc-dir desc))) | 4649 | (not (eq (custom--standard-value (car ent)) |
| 4650 | (push (car ent) vars)))) | 4650 | (default-toplevel-value (car ent))))) |
| 4651 | (push (car ent) vars))))) | ||
| 4651 | (dlet ((reporter-prompt-for-summary-p t)) | 4652 | (dlet ((reporter-prompt-for-summary-p t)) |
| 4652 | (reporter-submit-bug-report maint name vars)))) | 4653 | (reporter-submit-bug-report maint name vars)))) |
| 4653 | 4654 | ||
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 0ee52d8ef6c..a6dad4b640d 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -2059,7 +2059,7 @@ connection." | |||
| 2059 | (point-min))) | 2059 | (point-min))) |
| 2060 | (when (let ((then (get-text-property (point) 'rcirc-time))) | 2060 | (when (let ((then (get-text-property (point) 'rcirc-time))) |
| 2061 | (and then (not (time-less-p time then)))) | 2061 | (and then (not (time-less-p time then)))) |
| 2062 | (next-single-property-change (point) 'hard) | 2062 | (goto-char (next-single-property-change (point) 'hard)) |
| 2063 | (forward-char 1) | 2063 | (forward-char 1) |
| 2064 | (throw 'exit nil)))) | 2064 | (throw 'exit nil)))) |
| 2065 | (goto-char (line-beginning-position)) | 2065 | (goto-char (line-beginning-position)) |
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 1df3a8844f8..172fd97fdb5 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el | |||
| @@ -2448,15 +2448,17 @@ buffer." | |||
| 2448 | (defun eglot--post-self-insert-hook () | 2448 | (defun eglot--post-self-insert-hook () |
| 2449 | "Set `eglot--last-inserted-char', maybe call on-type-formatting." | 2449 | "Set `eglot--last-inserted-char', maybe call on-type-formatting." |
| 2450 | (setq eglot--last-inserted-char last-input-event) | 2450 | (setq eglot--last-inserted-char last-input-event) |
| 2451 | (let ((ot-provider (eglot--server-capable :documentOnTypeFormattingProvider))) | 2451 | (let ((ot-provider (eglot--server-capable :documentOnTypeFormattingProvider)) |
| 2452 | ;; transform carriage return into line-feed | ||
| 2453 | (adjusted-ie (if (= last-input-event 13) 10 last-input-event))) | ||
| 2452 | (when (and ot-provider | 2454 | (when (and ot-provider |
| 2453 | (ignore-errors ; github#906, some LS's send empty strings | 2455 | (ignore-errors ; github#906, some LS's send empty strings |
| 2454 | (or (eq last-input-event | 2456 | (or (eq adjusted-ie |
| 2455 | (seq-first (plist-get ot-provider :firstTriggerCharacter))) | 2457 | (seq-first (plist-get ot-provider :firstTriggerCharacter))) |
| 2456 | (cl-find last-input-event | 2458 | (cl-find adjusted-ie |
| 2457 | (plist-get ot-provider :moreTriggerCharacter) | 2459 | (plist-get ot-provider :moreTriggerCharacter) |
| 2458 | :key #'seq-first)))) | 2460 | :key #'seq-first)))) |
| 2459 | (eglot-format (point) nil last-input-event)))) | 2461 | (eglot-format (point) nil adjusted-ie)))) |
| 2460 | 2462 | ||
| 2461 | (defvar eglot--workspace-symbols-cache (make-hash-table :test #'equal) | 2463 | (defvar eglot--workspace-symbols-cache (make-hash-table :test #'equal) |
| 2462 | "Cache of `workspace/Symbol' results used by `xref-find-definitions'.") | 2464 | "Cache of `workspace/Symbol' results used by `xref-find-definitions'.") |
| @@ -2973,7 +2975,9 @@ for which LSP on-type-formatting should be requested." | |||
| 2973 | :insertSpaces (if indent-tabs-mode :json-false t) | 2975 | :insertSpaces (if indent-tabs-mode :json-false t) |
| 2974 | :insertFinalNewline (if require-final-newline t :json-false) | 2976 | :insertFinalNewline (if require-final-newline t :json-false) |
| 2975 | :trimFinalNewlines (if delete-trailing-lines t :json-false)) | 2977 | :trimFinalNewlines (if delete-trailing-lines t :json-false)) |
| 2976 | args))))) | 2978 | args)) |
| 2979 | nil | ||
| 2980 | on-type-format))) | ||
| 2977 | 2981 | ||
| 2978 | (defvar eglot-cache-session-completions t | 2982 | (defvar eglot-cache-session-completions t |
| 2979 | "If non-nil Eglot caches data during completion sessions.") | 2983 | "If non-nil Eglot caches data during completion sessions.") |
| @@ -3380,8 +3384,9 @@ Returns a list as described in docstring of `imenu--index-alist'." | |||
| 3380 | (((SymbolInformation)) (eglot--imenu-SymbolInformation res)) | 3384 | (((SymbolInformation)) (eglot--imenu-SymbolInformation res)) |
| 3381 | (((DocumentSymbol)) (eglot--imenu-DocumentSymbol res)))))) | 3385 | (((DocumentSymbol)) (eglot--imenu-DocumentSymbol res)))))) |
| 3382 | 3386 | ||
| 3383 | (cl-defun eglot--apply-text-edits (edits &optional version) | 3387 | (cl-defun eglot--apply-text-edits (edits &optional version silent) |
| 3384 | "Apply EDITS for current buffer if at VERSION, or if it's nil." | 3388 | "Apply EDITS for current buffer if at VERSION, or if it's nil. |
| 3389 | If SILENT, don't echo progress in mode-line." | ||
| 3385 | (unless edits (cl-return-from eglot--apply-text-edits)) | 3390 | (unless edits (cl-return-from eglot--apply-text-edits)) |
| 3386 | (unless (or (not version) (equal version eglot--versioned-identifier)) | 3391 | (unless (or (not version) (equal version eglot--versioned-identifier)) |
| 3387 | (jsonrpc-error "Edits on `%s' require version %d, you have %d" | 3392 | (jsonrpc-error "Edits on `%s' require version %d, you have %d" |
| @@ -3389,10 +3394,11 @@ Returns a list as described in docstring of `imenu--index-alist'." | |||
| 3389 | (atomic-change-group | 3394 | (atomic-change-group |
| 3390 | (let* ((change-group (prepare-change-group)) | 3395 | (let* ((change-group (prepare-change-group)) |
| 3391 | (howmany (length edits)) | 3396 | (howmany (length edits)) |
| 3392 | (reporter (make-progress-reporter | 3397 | (reporter (unless silent |
| 3393 | (format "[eglot] applying %s edits to `%s'..." | 3398 | (make-progress-reporter |
| 3394 | howmany (current-buffer)) | 3399 | (format "[eglot] applying %s edits to `%s'..." |
| 3395 | 0 howmany)) | 3400 | howmany (current-buffer)) |
| 3401 | 0 howmany))) | ||
| 3396 | (done 0)) | 3402 | (done 0)) |
| 3397 | (mapc (pcase-lambda (`(,newText ,beg . ,end)) | 3403 | (mapc (pcase-lambda (`(,newText ,beg . ,end)) |
| 3398 | (let ((source (current-buffer))) | 3404 | (let ((source (current-buffer))) |
| @@ -3404,12 +3410,14 @@ Returns a list as described in docstring of `imenu--index-alist'." | |||
| 3404 | (save-restriction | 3410 | (save-restriction |
| 3405 | (narrow-to-region beg end) | 3411 | (narrow-to-region beg end) |
| 3406 | (replace-buffer-contents temp))) | 3412 | (replace-buffer-contents temp))) |
| 3407 | (eglot--reporter-update reporter (cl-incf done))))))) | 3413 | (when reporter |
| 3414 | (eglot--reporter-update reporter (cl-incf done)))))))) | ||
| 3408 | (mapcar (eglot--lambda ((TextEdit) range newText) | 3415 | (mapcar (eglot--lambda ((TextEdit) range newText) |
| 3409 | (cons newText (eglot--range-region range 'markers))) | 3416 | (cons newText (eglot--range-region range 'markers))) |
| 3410 | (reverse edits))) | 3417 | (reverse edits))) |
| 3411 | (undo-amalgamate-change-group change-group) | 3418 | (undo-amalgamate-change-group change-group) |
| 3412 | (progress-reporter-done reporter)))) | 3419 | (when reporter |
| 3420 | (progress-reporter-done reporter))))) | ||
| 3413 | 3421 | ||
| 3414 | (defun eglot--apply-workspace-edit (wedit &optional confirm) | 3422 | (defun eglot--apply-workspace-edit (wedit &optional confirm) |
| 3415 | "Apply the workspace edit WEDIT. If CONFIRM, ask user first." | 3423 | "Apply the workspace edit WEDIT. If CONFIRM, ask user first." |
diff --git a/src/nsfns.m b/src/nsfns.m index 90159533128..2519f1ebac8 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -3840,7 +3840,13 @@ all_nonzero_ascii (unsigned char *str, ptrdiff_t n) | |||
| 3840 | /* Make a Lisp string from an NSString. */ | 3840 | /* Make a Lisp string from an NSString. */ |
| 3841 | - (Lisp_Object)lispString | 3841 | - (Lisp_Object)lispString |
| 3842 | { | 3842 | { |
| 3843 | return build_string ([self UTF8String]); | 3843 | /* `make_string' creates a string with a given length, instead of |
| 3844 | searching for a trailing NULL byte to determine its end. This is | ||
| 3845 | important because this function is called to convert NSString | ||
| 3846 | objects containing clipboard data, which can contain NUL bytes, | ||
| 3847 | into Lisp strings. (bug#64697) */ | ||
| 3848 | return make_string ([self UTF8String], | ||
| 3849 | [self lengthOfBytesUsingEncoding: NSUTF8StringEncoding]); | ||
| 3844 | } | 3850 | } |
| 3845 | @end | 3851 | @end |
| 3846 | 3852 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index c5a2c081b53..4e9c5f49e58 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -21,17 +21,17 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 21 | 21 | ||
| 22 | Redisplay. | 22 | Redisplay. |
| 23 | 23 | ||
| 24 | Emacs separates the task of updating the display from code | 24 | Emacs separates the task of updating the display -- which we call |
| 25 | modifying global state, e.g. buffer text. This way functions | 25 | "redisplay" -- from the code modifying global state, e.g. buffer |
| 26 | operating on buffers don't also have to be concerned with updating | 26 | text. This way functions operating on buffers don't also have to |
| 27 | the display. | 27 | be concerned with updating the display as result of their |
| 28 | 28 | operations. | |
| 29 | Updating the display is triggered by the Lisp interpreter when it | 29 | |
| 30 | decides it's time to do it. This is done either automatically for | 30 | Redisplay is triggered by the Lisp interpreter when it decides it's |
| 31 | you as part of the interpreter's command loop or as the result of | 31 | time to do it. This is done either automatically for you as part |
| 32 | calling Lisp functions like `sit-for'. The C function | 32 | of the interpreter's command loop, or as the result of calling Lisp |
| 33 | `redisplay_internal' in xdisp.c is the only entry into the inner | 33 | functions like `sit-for'. The C function `redisplay_internal' in |
| 34 | redisplay code. | 34 | xdisp.c is the only entry into the inner redisplay code. |
| 35 | 35 | ||
| 36 | The following diagram shows how redisplay code is invoked. As you | 36 | The following diagram shows how redisplay code is invoked. As you |
| 37 | can see, Lisp calls redisplay and vice versa. | 37 | can see, Lisp calls redisplay and vice versa. |
| @@ -75,63 +75,97 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 75 | and to make these changes visible. Preferably it would do that in | 75 | and to make these changes visible. Preferably it would do that in |
| 76 | a moderately intelligent way, i.e. fast. | 76 | a moderately intelligent way, i.e. fast. |
| 77 | 77 | ||
| 78 | Changes in buffer text can be deduced from window and buffer | 78 | At its highest level, redisplay can be divided into 3 distinct |
| 79 | steps, all of which are visible in `redisplay_internal': | ||
| 80 | |||
| 81 | . decide which frames need their windows to be considered for redisplay | ||
| 82 | . for each window whose display might need to be updated, compute | ||
| 83 | a structure, called "glyph matrix", which describes how it | ||
| 84 | should look on display | ||
| 85 | . actually update the display of windows on the glass where the | ||
| 86 | newly obtained glyph matrix differs from the one produced by the | ||
| 87 | previous redisplay cycle | ||
| 88 | |||
| 89 | The first of these steps is done by `redisplay_internal' itself, by | ||
| 90 | looping through all the frames and testing their various flags, | ||
| 91 | such as their visibility. The result of this could be that only | ||
| 92 | the selected window on the selected frame must be redisplayed, or | ||
| 93 | it could conclude that other windows need to be considered as well. | ||
| 94 | |||
| 95 | The second step considers each window that might need to be | ||
| 96 | redisplayed. This could be only the selected window, or the window | ||
| 97 | trees of one or more frames. The function which considers a window | ||
| 98 | and decides whether it actually needs redisplay is | ||
| 99 | `redisplay_window'. It does so by looking at the changes in | ||
| 100 | position of point, in buffer text, in text properties, overlays, | ||
| 101 | etc. These changes can be deduced from window and buffer | ||
| 79 | structures, and from some global variables like `beg_unchanged' and | 102 | structures, and from some global variables like `beg_unchanged' and |
| 80 | `end_unchanged'. The contents of the display are additionally | 103 | `end_unchanged'. The current contents of the display are recorded |
| 81 | recorded in a `glyph matrix', a two-dimensional matrix of glyph | 104 | in a `glyph matrix', a two-dimensional matrix of glyph structures. |
| 82 | structures. Each row in such a matrix corresponds to a line on the | 105 | Each row in such a matrix corresponds to a line on the display, and |
| 83 | display, and each glyph in a row corresponds to a column displaying | 106 | each glyph in a row corresponds to a column displaying a character, |
| 84 | a character, an image, or what else. This matrix is called the | 107 | an image, or what else. This matrix is called the `current glyph |
| 85 | `current glyph matrix' or `current matrix' in redisplay | 108 | matrix', or `current matrix', in redisplay terminology. |
| 86 | terminology. | 109 | |
| 87 | 110 | For buffer parts that have been changed since the last redisplay, | |
| 88 | For buffer parts that have been changed since the last update, a | 111 | `redisplay_window' constructs a second glyph matrix, the so called |
| 89 | second glyph matrix is constructed, the so called `desired glyph | 112 | `desired glyph matrix' or short `desired matrix'. It does so in |
| 90 | matrix' or short `desired matrix'. Current and desired matrix are | 113 | the most optimal way possible, avoiding the examination of text |
| 91 | then compared to find a cheap way to update the display, e.g. by | 114 | that didn't change, reusing portions of the current matrix if |
| 92 | reusing part of the display by scrolling lines. The actual update | 115 | possible, etc. It could, in particular, decide that a window |
| 93 | of the display of each window by comparing the desired and the | 116 | doesn't need to be redisplayed at all. |
| 94 | current matrix is done by `update_window', which calls functions | 117 | |
| 95 | which draw to the glass (those functions are specific to the type | 118 | This second step of redisplay also updates the parts of the desired |
| 96 | of the window's frame: X, w32, NS, etc.). | 119 | matrix that correspond to the mode lines, header lines, and |
| 120 | tab-lines of the windows which need that; see `display_mode_lines'. | ||
| 121 | |||
| 122 | In the third and last step, the current and desired matrix are then | ||
| 123 | compared to find a cheap way to update the display, e.g. by reusing | ||
| 124 | part of the display by scrolling lines. The actual update of the | ||
| 125 | display of each window, by comparing the desired and the current | ||
| 126 | matrix, is done by `update_window', which calls functions which | ||
| 127 | draw to the glass (those functions are specific to the type of the | ||
| 128 | window's frame: X, w32, NS, etc.). | ||
| 97 | 129 | ||
| 98 | Once the display of a window on the glass has been updated, its | 130 | Once the display of a window on the glass has been updated, its |
| 99 | desired matrix is used to update the corresponding rows of the | 131 | desired matrix is used to update the corresponding rows of the |
| 100 | current matrix, and then the desired matrix is discarded. | 132 | current matrix, and then the desired matrix is discarded. |
| 101 | 133 | ||
| 102 | You will find a lot of redisplay optimizations when you start | 134 | You will find a lot of redisplay optimizations when you start |
| 103 | looking at the innards of redisplay. The overall goal of all these | 135 | looking at the innards of `redisplay_window'. The overall goal of |
| 104 | optimizations is to make redisplay fast because it is done | 136 | all these optimizations is to make redisplay fast because it is |
| 105 | frequently. Some of these optimizations are implemented by the | 137 | done frequently. Some of these optimizations are implemented by |
| 106 | following functions: | 138 | the following functions: |
| 107 | 139 | ||
| 108 | . try_cursor_movement | 140 | . try_cursor_movement |
| 109 | 141 | ||
| 110 | This function tries to update the display if the text in the | 142 | This optimization is applicable if the text in the window did |
| 111 | window did not change and did not scroll, only point moved, and | 143 | not change and did not scroll, only point moved, and it did not |
| 112 | it did not move off the displayed portion of the text. | 144 | move off the displayed portion of the text. In that case, the |
| 145 | window's glyph matrix is still valid, and only the position of | ||
| 146 | the cursor might need to be updated. | ||
| 113 | 147 | ||
| 114 | . try_window_reusing_current_matrix | 148 | . try_window_reusing_current_matrix |
| 115 | 149 | ||
| 116 | This function reuses the current matrix of a window when text | 150 | This function reuses the current glyph matrix of a window when |
| 117 | has not changed, but the window start changed (e.g., due to | 151 | text has not changed, but the window start changed (e.g., due to |
| 118 | scrolling). | 152 | scrolling). |
| 119 | 153 | ||
| 120 | . try_window_id | 154 | . try_window_id |
| 121 | 155 | ||
| 122 | This function attempts to redisplay a window by reusing parts of | 156 | This function attempts to update a window's glyph matrix by |
| 123 | its existing display. It finds and reuses the part that was not | 157 | reusing parts of its current glyph matrix. It finds and reuses |
| 124 | changed, and redraws the rest. (The "id" part in the function's | 158 | the part that was not changed, and regenerates the rest. (The |
| 125 | name stands for "insert/delete", not for "identification" or | 159 | "id" part in the function's name stands for "insert/delete", not |
| 126 | somesuch.) | 160 | for "identification" or somesuch.) |
| 127 | 161 | ||
| 128 | . try_window | 162 | . try_window |
| 129 | 163 | ||
| 130 | This function performs the full, unoptimized, redisplay of a | 164 | This function performs the full, unoptimized, generation of a |
| 131 | single window assuming that its fonts were not changed and that | 165 | single window's glyph matrix, assuming that its fonts were not |
| 132 | the cursor will not end up in the scroll margins. (Loading | 166 | changed and that the cursor will not end up in the scroll |
| 133 | fonts requires re-adjustment of dimensions of glyph matrices, | 167 | margins. (Loading fonts requires re-adjustment of dimensions of |
| 134 | which makes this method impossible to use.) | 168 | glyph matrices, which makes this method impossible to use.) |
| 135 | 169 | ||
| 136 | The optimizations are tried in sequence (some can be skipped if | 170 | The optimizations are tried in sequence (some can be skipped if |
| 137 | it is known that they are not applicable). If none of the | 171 | it is known that they are not applicable). If none of the |
| @@ -140,16 +174,17 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 140 | 174 | ||
| 141 | Note that there's one more important optimization up Emacs's | 175 | Note that there's one more important optimization up Emacs's |
| 142 | sleeve, but it is related to actually redrawing the potentially | 176 | sleeve, but it is related to actually redrawing the potentially |
| 143 | changed portions of the window/frame, not to reproducing the | 177 | changed portions of the window/frame as part of the third step, not |
| 144 | desired matrices of those potentially changed portions. Namely, | 178 | to generating the desired matrices of those potentially changed |
| 145 | the function update_frame and its subroutines, which you will find | 179 | portions. Namely, the function `update_frame' and its subroutines, |
| 146 | in dispnew.c, compare the desired matrices with the current | 180 | which you will find in dispnew.c, compare the desired matrices with |
| 147 | matrices, and only redraw the portions that changed. So it could | 181 | the current matrices, and only redraw the portions that changed. |
| 148 | happen that the functions in this file for some reason decide that | 182 | So it could happen that the functions in this file for some reason |
| 149 | the entire desired matrix needs to be regenerated from scratch, and | 183 | decide that the entire desired matrix needs to be regenerated from |
| 150 | still only parts of the Emacs display, or even nothing at all, will | 184 | scratch, and still only parts of the Emacs display, or even nothing |
| 151 | be actually delivered to the glass, because update_frame has found | 185 | at all, will be actually delivered to the glass, because |
| 152 | that the new and the old screen contents are similar or identical. | 186 | `update_frame' has found that the new and the old screen contents |
| 187 | are similar or identical. | ||
| 153 | 188 | ||
| 154 | Desired matrices. | 189 | Desired matrices. |
| 155 | 190 | ||
| @@ -159,7 +194,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 159 | redisplay tries to optimize its work, and thus only generates | 194 | redisplay tries to optimize its work, and thus only generates |
| 160 | glyphs for rows that need to be updated on the screen. Rows that | 195 | glyphs for rows that need to be updated on the screen. Rows that |
| 161 | don't need to be updated are left "disabled", and their contents | 196 | don't need to be updated are left "disabled", and their contents |
| 162 | should be ignored. | 197 | in the desired matrix should be ignored. |
| 163 | 198 | ||
| 164 | The function `display_line' is the central function to look at if | 199 | The function `display_line' is the central function to look at if |
| 165 | you are interested in how the rows of the desired matrix are | 200 | you are interested in how the rows of the desired matrix are |