diff options
| author | Eli Zaretskii | 2024-11-30 06:44:06 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2024-11-30 06:44:06 -0500 |
| commit | 88f6b045f482d5d842eaed1d7e949e488e8cedd1 (patch) | |
| tree | b816c883b0ed01d9f1e6828c869a85c0b27013d6 | |
| parent | 82bdb3bfd035577a43afdf1eafd18ee1a60a987c (diff) | |
| parent | afb34a3b2393decb50e250ed8caa559b64020379 (diff) | |
| download | emacs-88f6b045f482d5d842eaed1d7e949e488e8cedd1.tar.gz emacs-88f6b045f482d5d842eaed1d7e949e488e8cedd1.zip | |
Merge from origin/emacs-30
afb34a3b239 ; Improve documentation of ':box' face attribute
b38eb6da1d1 Fix docstring of c-ts-mode-indent-style
9fdb764898d Support PHP 8.4 and more reliable indentation (bug#74525)
bda0bce9e43 Don't inadvertently reset frame scroll bar sizes (Bug#74435)
3f99cdaf26d Mention special variables in lexical binding documentation
0ef0f18f163 Allow to go back to using 'ruby-mode' after loading 'ruby...
fc17e8727d4 Delete obsolete section in admin/notes/repo
3e396b2c5bb Improve documentation for 'while-let'
50b91ed458d Remove mention of treesit-defun-prefer-top-level (bug#74474)
03ae07291e8 Fix NS non-native fullscreen on initial frame load (bug#5...
8261d7224d3 Fix user options for listing and marking diary files
# Conflicts:
# lisp/progmodes/c-ts-mode.el
| -rw-r--r-- | admin/notes/repo | 10 | ||||
| -rw-r--r-- | doc/lispref/control.texi | 64 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 6 | ||||
| -rw-r--r-- | doc/lispref/variables.texi | 8 | ||||
| -rw-r--r-- | lisp/calendar/diary-lib.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/c-ts-mode.el | 91 | ||||
| -rw-r--r-- | lisp/progmodes/js.el | 1 | ||||
| -rw-r--r-- | lisp/progmodes/php-ts-mode.el | 52 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-ts-mode.el | 44 | ||||
| -rw-r--r-- | lisp/progmodes/typescript-ts-mode.el | 1 | ||||
| -rw-r--r-- | src/frame.c | 36 | ||||
| -rw-r--r-- | src/nsterm.m | 5 |
13 files changed, 211 insertions, 117 deletions
diff --git a/admin/notes/repo b/admin/notes/repo index b4535bcb556..c5caec11e35 100644 --- a/admin/notes/repo +++ b/admin/notes/repo | |||
| @@ -77,16 +77,6 @@ variable in admin/merge-gnulib before running it. | |||
| 77 | If you remove a gnulib module, or if a gnulib module | 77 | If you remove a gnulib module, or if a gnulib module |
| 78 | removes a file, then remove the corresponding files by hand. | 78 | removes a file, then remove the corresponding files by hand. |
| 79 | 79 | ||
| 80 | * How to merge changes from emacs-24 to master | ||
| 81 | |||
| 82 | [The section on git merge procedure has not yet been written.] | ||
| 83 | |||
| 84 | You may see conflicts in autoload md5sums in comments. Strictly | ||
| 85 | speaking, the right thing to do is merge everything else, resolve the | ||
| 86 | conflict by choosing either the master or branch version, then run | ||
| 87 | 'make -C lisp autoloads' to update the md5sums to the correct master | ||
| 88 | value before committing. | ||
| 89 | |||
| 90 | * Re-adding a file that has been removed from the repository | 80 | * Re-adding a file that has been removed from the repository |
| 91 | 81 | ||
| 92 | Let's suppose you've done: | 82 | Let's suppose you've done: |
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index 80ed2ce899b..27ce932433d 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi | |||
| @@ -322,25 +322,46 @@ There's a number of variations on this theme, and they're briefly | |||
| 322 | described below. | 322 | described below. |
| 323 | 323 | ||
| 324 | @defmac if-let* varlist then-form else-forms... | 324 | @defmac if-let* varlist then-form else-forms... |
| 325 | Evaluate each binding in @var{varlist} in turn, like in @code{let*} | 325 | Evaluate each binding in @var{varlist}, stopping if a binding value is |
| 326 | (@pxref{Local Variables}), stopping if a binding value is @code{nil}. | 326 | @code{nil}. If all are non-@code{nil}, return the value of |
| 327 | If all are non-@code{nil}, return the value of @var{then-form}, | 327 | @var{then-form}, otherwise the last form in @var{else-forms}. |
| 328 | otherwise the last form in @var{else-forms}. | 328 | |
| 329 | Each element of @code{varlist} has the form @w{@code{(@var{symbol} | ||
| 330 | @var{value-form})}}: @var{value-form} is evaluated and @var{symbol} is | ||
| 331 | locally bound to the result. Bindings are sequential, as in @code{let*} | ||
| 332 | (@pxref{Local Variables}). As a special case, @var{symbol} can be | ||
| 333 | omitted if only the test result of @var{value-form} is of interest: | ||
| 334 | @var{value-form} is evaluated and checked for @code{nil}, but its value | ||
| 335 | is not bound. | ||
| 329 | @end defmac | 336 | @end defmac |
| 330 | 337 | ||
| 331 | @defmac when-let* varlist then-forms... | 338 | @defmac when-let* varlist then-forms... |
| 332 | Like @code{if-let*}, but without @var{else-forms}. | 339 | Evaluate each binding in @var{varlist}, stopping if a binding value is |
| 340 | @code{nil}. If all are non-@code{nil}, return the value of the last | ||
| 341 | form in @var{then-forms}. | ||
| 342 | |||
| 343 | @var{varlist} has the same form as in @code{if-let*}: Each element of | ||
| 344 | @code{varlist} has the form @w{@code{(@var{symbol} @var{value-form})}}, | ||
| 345 | in which @var{value-form} is evaluated and @var{symbol} is locally bound | ||
| 346 | to the result. Bindings are sequential, as in @code{let*} (@pxref{Local | ||
| 347 | Variables}). As a special case, @var{symbol} can be omitted if only the | ||
| 348 | test result of @var{value-form} is of interest: @var{value-form} is | ||
| 349 | evaluated and checked for @code{nil}, but its value is not bound. | ||
| 333 | @end defmac | 350 | @end defmac |
| 334 | 351 | ||
| 335 | @defmac and-let* varlist then-forms... | 352 | @defmac and-let* varlist then-forms... |
| 336 | Like @code{when-let*}, but in addition, if there are no | 353 | Evaluate each binding in @var{varlist}, stopping if a binding value is |
| 337 | @var{then-forms} and all the bindings evaluate to non-@code{nil}, return | 354 | @code{nil}. If all are non-@code{nil}, return the value of the last |
| 355 | form in @var{then-forms}, or, if there are no @var{then-forms}, return | ||
| 338 | the value of the last binding. | 356 | the value of the last binding. |
| 339 | @end defmac | ||
| 340 | 357 | ||
| 341 | @defmac while-let spec then-forms... | 358 | @var{varlist} has the same form as in @code{if-let*}: Each element of |
| 342 | Like @code{when-let*}, but repeat until a binding in @var{spec} is | 359 | @code{varlist} has the form @w{@code{(@var{symbol} @var{value-form})}}, |
| 343 | @code{nil}. The return value is always @code{nil}. | 360 | in which @var{value-form} is evaluated and @var{symbol} is locally bound |
| 361 | to the result. Bindings are sequential, as in @code{let*} (@pxref{Local | ||
| 362 | Variables}). As a special case, @var{symbol} can be omitted if only the | ||
| 363 | test result of @var{value-form} is of interest: @var{value-form} is | ||
| 364 | evaluated and checked for @code{nil}, but its value is not bound. | ||
| 344 | @end defmac | 365 | @end defmac |
| 345 | 366 | ||
| 346 | Some Lisp programmers follow the convention that @code{and} and | 367 | Some Lisp programmers follow the convention that @code{and} and |
| @@ -348,6 +369,27 @@ Some Lisp programmers follow the convention that @code{and} and | |||
| 348 | @code{when} and @code{when-let*} are for forms evaluated for side-effect | 369 | @code{when} and @code{when-let*} are for forms evaluated for side-effect |
| 349 | with returned values ignored. | 370 | with returned values ignored. |
| 350 | 371 | ||
| 372 | A similar macro exists to run a loop until one binding evaluates to | ||
| 373 | @code{nil}: | ||
| 374 | |||
| 375 | @defmac while-let spec then-forms... | ||
| 376 | Evaluate each binding in @var{spec} in turn, stopping if a binding value | ||
| 377 | is @code{nil}. If all are non-@code{nil}, execute @var{then-forms}, | ||
| 378 | then repeat the loop. Note that when the loop is repeated, the | ||
| 379 | @var{value-forms} in @var{spec} are re-evaluated and the bindings are | ||
| 380 | established anew. | ||
| 381 | |||
| 382 | @var{varlist} has the same form as in @code{if-let*}: Each element of | ||
| 383 | @code{varlist} has the form @w{@code{(@var{symbol} @var{value-form})}}, | ||
| 384 | in which @var{value-form} is evaluated and @var{symbol} is locally bound | ||
| 385 | to the result. Bindings are sequential, as in @code{let*} (@pxref{Local | ||
| 386 | Variables}). As a special case, @var{symbol} can be omitted if only the | ||
| 387 | test result of @var{value-form} is of interest: @var{value-form} is | ||
| 388 | evaluated and checked for @code{nil}, but its value is not bound. | ||
| 389 | |||
| 390 | The return value of @code{while-let} is always @code{nil}. | ||
| 391 | @end defmac | ||
| 392 | |||
| 351 | @node Combining Conditions | 393 | @node Combining Conditions |
| 352 | @section Constructs for Combining Conditions | 394 | @section Constructs for Combining Conditions |
| 353 | @cindex combining conditions | 395 | @cindex combining conditions |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 7ada57d3d9c..a7c5ae561be 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -2805,7 +2805,11 @@ being pressed. If it is @code{pressed-button}, the box looks like a | |||
| 2805 | If you use the @code{:box} face attribute on strings displayed instead | 2805 | If you use the @code{:box} face attribute on strings displayed instead |
| 2806 | of buffer text via the @code{display} text property, special | 2806 | of buffer text via the @code{display} text property, special |
| 2807 | considerations might apply if the surrounding buffer text also has the | 2807 | considerations might apply if the surrounding buffer text also has the |
| 2808 | @code{:box} face attribute. @xref{Replacing Specs}. | 2808 | @code{:box} face attribute. @xref{Replacing Specs}. Also note that the |
| 2809 | vertical lines of the box are only drawn when @code{:box} attribute | ||
| 2810 | changes from @code{nil} to non-@code{nil} or vice versa; two consecutive | ||
| 2811 | face properties with a non-@code{nil} @code{:box} attribute will be | ||
| 2812 | displayed without the vertical line between them. | ||
| 2809 | 2813 | ||
| 2810 | @item :inverse-video | 2814 | @item :inverse-video |
| 2811 | Whether or not characters should be displayed in inverse video. The | 2815 | Whether or not characters should be displayed in inverse video. The |
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index af11e498d86..0e9124920d1 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi | |||
| @@ -1096,7 +1096,7 @@ x ; @r{Note that @code{x} has no global value.} | |||
| 1096 | @end example | 1096 | @end example |
| 1097 | 1097 | ||
| 1098 | @noindent | 1098 | @noindent |
| 1099 | The @code{let} binding defines a lexical environment in which the | 1099 | Here, the @code{let} binding defines a lexical environment in which the |
| 1100 | variable @code{x} is locally bound to 0. Within this binding | 1100 | variable @code{x} is locally bound to 0. Within this binding |
| 1101 | construct, we define a lambda expression which increments @code{x} by | 1101 | construct, we define a lambda expression which increments @code{x} by |
| 1102 | one and returns the incremented value. This lambda expression is | 1102 | one and returns the incremented value. This lambda expression is |
| @@ -1113,6 +1113,12 @@ functions which take a symbol argument (like @code{symbol-value}, | |||
| 1113 | variable's dynamic binding (i.e., the contents of its symbol's value | 1113 | variable's dynamic binding (i.e., the contents of its symbol's value |
| 1114 | cell). | 1114 | cell). |
| 1115 | 1115 | ||
| 1116 | Note also that variables may be declared special, in which case they | ||
| 1117 | will use dynamic binding, even for new bindings such as a @code{let} | ||
| 1118 | binding. Depending on how the variable is declared, it can be | ||
| 1119 | special globally, for a single file, or for a portion of a file. | ||
| 1120 | @xref{Dynamic Binding} for details. | ||
| 1121 | |||
| 1116 | @node Dynamic Binding | 1122 | @node Dynamic Binding |
| 1117 | @subsection Dynamic Binding | 1123 | @subsection Dynamic Binding |
| 1118 | 1124 | ||
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 63bbae4d8ed..5d582f973bc 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -235,7 +235,8 @@ use `diary-list-entries-hook', which runs only for the main diary file." | |||
| 235 | :type 'hook | 235 | :type 'hook |
| 236 | :options '(diary-bahai-list-entries | 236 | :options '(diary-bahai-list-entries |
| 237 | diary-hebrew-list-entries | 237 | diary-hebrew-list-entries |
| 238 | diary-islamic-list-entries) | 238 | diary-islamic-list-entries |
| 239 | diary-chinese-list-entries) | ||
| 239 | :group 'diary) | 240 | :group 'diary) |
| 240 | 241 | ||
| 241 | (defcustom diary-nongregorian-marking-hook nil | 242 | (defcustom diary-nongregorian-marking-hook nil |
| @@ -252,7 +253,8 @@ use `diary-mark-entries-hook', which runs only for the main diary file." | |||
| 252 | :type 'hook | 253 | :type 'hook |
| 253 | :options '(diary-bahai-mark-entries | 254 | :options '(diary-bahai-mark-entries |
| 254 | diary-hebrew-mark-entries | 255 | diary-hebrew-mark-entries |
| 255 | diary-islamic-mark-entries) | 256 | diary-islamic-mark-entries |
| 257 | diary-chinese-mark-entries) | ||
| 256 | :group 'diary) | 258 | :group 'diary) |
| 257 | 259 | ||
| 258 | (defcustom diary-print-entries-hook #'lpr-buffer | 260 | (defcustom diary-print-entries-hook #'lpr-buffer |
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 9bbb78e0862..cbb103cfaf7 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | ;; To use these modes by default, assuming you have the respective | 35 | ;; To use these modes by default, assuming you have the respective |
| 36 | ;; tree-sitter grammars available, do one of the following: | 36 | ;; tree-sitter grammars available, do one of the following: |
| 37 | ;; | 37 | ;; |
| 38 | ;; - Add one or mode of the following to your init file: | 38 | ;; - Add one or more of the following lines to your init file: |
| 39 | ;; | 39 | ;; |
| 40 | ;; (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode)) | 40 | ;; (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode)) |
| 41 | ;; (add-to-list 'major-mode-remap-alist '(c++-mode . c++-ts-mode)) | 41 | ;; (add-to-list 'major-mode-remap-alist '(c++-mode . c++-ts-mode)) |
| @@ -150,10 +150,11 @@ symbol." | |||
| 150 | (defcustom c-ts-mode-indent-style 'gnu | 150 | (defcustom c-ts-mode-indent-style 'gnu |
| 151 | "Style used for indentation. | 151 | "Style used for indentation. |
| 152 | 152 | ||
| 153 | The selected style could be one of GNU, K&R, LINUX or BSD. If | 153 | The selected style could be one of GNU, K&R, LINUX or BSD. If the |
| 154 | one of the supplied styles doesn't suffice, the value could be | 154 | supplied styles don't suffice, the value could be a function instead. |
| 155 | a function instead. This function is expected to return a list | 155 | This function takes no arguments and is expected to return a list of |
| 156 | that follows the form of `treesit-simple-indent-rules'." | 156 | indent RULEs as described in `treesit-simple-indent-rules'. Note that |
| 157 | the list of RULEs doesn't need to contain the language symbol." | ||
| 157 | :version "29.1" | 158 | :version "29.1" |
| 158 | :type '(choice (symbol :tag "Gnu" gnu) | 159 | :type '(choice (symbol :tag "Gnu" gnu) |
| 159 | (symbol :tag "K&R" k&r) | 160 | (symbol :tag "K&R" k&r) |
| @@ -1277,9 +1278,6 @@ BEG and END are described in `treesit-range-rules'." | |||
| 1277 | `((c ,@c-ts-mode--thing-settings) | 1278 | `((c ,@c-ts-mode--thing-settings) |
| 1278 | (cpp ,@c-ts-mode--thing-settings))) | 1279 | (cpp ,@c-ts-mode--thing-settings))) |
| 1279 | 1280 | ||
| 1280 | ;; Nodes like struct/enum/union_specifier can appear in | ||
| 1281 | ;; function_definitions, so we need to find the top-level node. | ||
| 1282 | (setq-local treesit-defun-prefer-top-level t) | ||
| 1283 | 1281 | ||
| 1284 | ;; When the code is in incomplete state, try to make a better guess | 1282 | ;; When the code is in incomplete state, try to make a better guess |
| 1285 | ;; about which node to indent against. | 1283 | ;; about which node to indent against. |
| @@ -1360,46 +1358,49 @@ in your init files." | |||
| 1360 | (treesit-parser-create 'c nil nil 'for-each))) | 1358 | (treesit-parser-create 'c nil nil 'for-each))) |
| 1361 | 1359 | ||
| 1362 | (let ((primary-parser (treesit-parser-create 'c))) | 1360 | (let ((primary-parser (treesit-parser-create 'c))) |
| 1363 | ;; Comments. | 1361 | ;; Comments. |
| 1364 | (setq-local comment-start "/* ") | 1362 | (setq-local comment-start "/* ") |
| 1365 | (setq-local comment-end " */") | 1363 | (setq-local comment-end " */") |
| 1366 | ;; Indent. | 1364 | ;; Indent. |
| 1367 | (setq-local treesit-simple-indent-rules | 1365 | (setq-local treesit-simple-indent-rules |
| 1368 | (c-ts-mode--get-indent-style 'c)) | 1366 | (c-ts-mode--get-indent-style 'c)) |
| 1369 | ;; Font-lock. | 1367 | ;; Font-lock. |
| 1370 | (setq-local treesit-font-lock-settings | 1368 | (setq-local treesit-font-lock-settings |
| 1371 | (c-ts-mode--font-lock-settings 'c)) | 1369 | (c-ts-mode--font-lock-settings 'c)) |
| 1372 | ;; Navigation. | 1370 | ;; Navigation. |
| 1373 | (setq-local treesit-defun-tactic 'top-level) | 1371 | ;; |
| 1374 | (treesit-major-mode-setup) | 1372 | ;; Nodes like struct/enum/union_specifier can appear in |
| 1375 | 1373 | ;; function_definitions, so we need to find the top-level node. | |
| 1376 | ;; Emacs source support: handle DEFUN and FOR_EACH_* gracefully. | 1374 | (setq-local treesit-defun-tactic 'top-level) |
| 1377 | (when c-ts-mode-emacs-sources-support | 1375 | (treesit-major-mode-setup) |
| 1378 | (setq-local add-log-current-defun-function | 1376 | |
| 1379 | #'c-ts-mode--emacs-current-defun-name) | 1377 | ;; Emacs source support: handle DEFUN and FOR_EACH_* gracefully. |
| 1378 | (when c-ts-mode-emacs-sources-support | ||
| 1379 | (setq-local add-log-current-defun-function | ||
| 1380 | #'c-ts-mode--emacs-current-defun-name) | ||
| 1380 | 1381 | ||
| 1381 | (setq-local treesit-range-settings | 1382 | (setq-local treesit-range-settings |
| 1382 | (treesit-range-rules 'c-ts-mode--emacs-set-ranges)) | 1383 | (treesit-range-rules 'c-ts-mode--emacs-set-ranges)) |
| 1383 | 1384 | ||
| 1384 | (setq-local treesit-language-at-point-function | 1385 | (setq-local treesit-language-at-point-function |
| 1385 | (lambda (_pos) 'c)) | 1386 | (lambda (_pos) 'c)) |
| 1386 | (treesit-font-lock-recompute-features '(emacs-devel))) | 1387 | (treesit-font-lock-recompute-features '(emacs-devel))) |
| 1387 | 1388 | ||
| 1388 | ;; Inject doxygen parser for comment. | 1389 | ;; Inject doxygen parser for comment. |
| 1389 | (when (and c-ts-mode-enable-doxygen (treesit-ready-p 'doxygen t)) | 1390 | (when (and c-ts-mode-enable-doxygen (treesit-ready-p 'doxygen t)) |
| 1390 | (setq-local treesit-primary-parser primary-parser) | 1391 | (setq-local treesit-primary-parser primary-parser) |
| 1391 | (setq-local treesit-font-lock-settings | 1392 | (setq-local treesit-font-lock-settings |
| 1392 | (append | 1393 | (append |
| 1393 | treesit-font-lock-settings | 1394 | treesit-font-lock-settings |
| 1394 | c-ts-mode-doxygen-comment-font-lock-settings)) | 1395 | c-ts-mode-doxygen-comment-font-lock-settings)) |
| 1395 | (setq-local treesit-range-settings | 1396 | (setq-local treesit-range-settings |
| 1396 | (treesit-range-rules | 1397 | (treesit-range-rules |
| 1397 | :embed 'doxygen | 1398 | :embed 'doxygen |
| 1398 | :host 'c | 1399 | :host 'c |
| 1399 | :local t | 1400 | :local t |
| 1400 | `(((comment) @cap | 1401 | `(((comment) @cap |
| 1401 | (:match | 1402 | (:match |
| 1402 | ,c-ts-mode--doxygen-comment-regex @cap))))))))) | 1403 | ,c-ts-mode--doxygen-comment-regex @cap))))))))) |
| 1403 | 1404 | ||
| 1404 | (derived-mode-add-parents 'c-ts-mode '(c-mode)) | 1405 | (derived-mode-add-parents 'c-ts-mode '(c-mode)) |
| 1405 | 1406 | ||
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index f74b8ab1c46..57889338650 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -3918,7 +3918,6 @@ See `treesit-thing-settings' for more information.") | |||
| 3918 | ;; Indent. | 3918 | ;; Indent. |
| 3919 | (setq-local treesit-simple-indent-rules js--treesit-indent-rules) | 3919 | (setq-local treesit-simple-indent-rules js--treesit-indent-rules) |
| 3920 | ;; Navigation. | 3920 | ;; Navigation. |
| 3921 | (setq-local treesit-defun-prefer-top-level t) | ||
| 3922 | (setq-local treesit-defun-type-regexp | 3921 | (setq-local treesit-defun-type-regexp |
| 3923 | (rx (or "class_declaration" | 3922 | (rx (or "class_declaration" |
| 3924 | "method_definition" | 3923 | "method_definition" |
diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index b0271c4ea6a..b6fe17f7d41 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el | |||
| @@ -84,7 +84,7 @@ | |||
| 84 | 84 | ||
| 85 | ;;; Install treesitter language parsers | 85 | ;;; Install treesitter language parsers |
| 86 | (defvar php-ts-mode--language-source-alist | 86 | (defvar php-ts-mode--language-source-alist |
| 87 | '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.23.5" "php/src")) | 87 | '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.23.11" "php/src")) |
| 88 | (phpdoc . ("https://github.com/claytonrcarter/tree-sitter-phpdoc")) | 88 | (phpdoc . ("https://github.com/claytonrcarter/tree-sitter-phpdoc")) |
| 89 | (html . ("https://github.com/tree-sitter/tree-sitter-html" "v0.23.0")) | 89 | (html . ("https://github.com/tree-sitter/tree-sitter-html" "v0.23.0")) |
| 90 | (javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.23.0")) | 90 | (javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.23.0")) |
| @@ -477,16 +477,20 @@ PARENT is its parent." | |||
| 477 | (treesit-node-start parent) | 477 | (treesit-node-start parent) |
| 478 | (line-end-position)))))) | 478 | (line-end-position)))))) |
| 479 | 479 | ||
| 480 | (defun php-ts-mode--js-css-tag-bol (node _parent &rest _) | 480 | (defun php-ts-mode--js-css-tag-bol (_node parent &rest _) |
| 481 | "Find the first non-space characters of html tags <script> or <style>. | 481 | "Find the first non-space characters of html tags <script> or <style>. |
| 482 | 482 | ||
| 483 | If NODE is nil return `line-beginning-position'. PARENT is ignored. | 483 | Return `line-beginning-position' when `treesit-node-at' is HTML or PHP. |
| 484 | NODE is the node to match and PARENT is its parent." | 484 | Otherwise go to the PARENT and search backward for <script> or <style> tags. |
| 485 | (if (null node) | 485 | Should be used only for Javascript or CSS indenting rules. |
| 486 | (line-beginning-position) | 486 | NODE, ignored, is the node to match and PARENT is its parent." |
| 487 | (save-excursion | 487 | (let ((lang (treesit-language-at (point)))) |
| 488 | (goto-char (treesit-node-start node)) | 488 | (if (or (eq lang 'javascript) |
| 489 | (re-search-backward "<script>\\|<style>" nil t)))) | 489 | (eq lang 'css)) |
| 490 | (save-excursion | ||
| 491 | (goto-char (treesit-node-start parent)) | ||
| 492 | (re-search-backward "<script.*>\\|<style.*>" nil t)) | ||
| 493 | (line-beginning-position)))) | ||
| 490 | 494 | ||
| 491 | (defun php-ts-mode--parent-eol (_node parent &rest _) | 495 | (defun php-ts-mode--parent-eol (_node parent &rest _) |
| 492 | "Find the last non-space characters of the PARENT of the current NODE. | 496 | "Find the last non-space characters of the PARENT of the current NODE. |
| @@ -840,6 +844,11 @@ characters of the current line." | |||
| 840 | (ignore-errors | 844 | (ignore-errors |
| 841 | (progn (treesit-query-compile 'php "(visibility_modifier (operation))" t) t))) | 845 | (progn (treesit-query-compile 'php "(visibility_modifier (operation))" t) t))) |
| 842 | 846 | ||
| 847 | (defun php-ts-mode--test-property-hook-clause-p () | ||
| 848 | "Return t if property_hook is a named node, nil otherwise." | ||
| 849 | (ignore-errors | ||
| 850 | (progn (treesit-query-compile 'php "(property_hook)" t) t))) | ||
| 851 | |||
| 843 | (defun php-ts-mode--font-lock-settings () | 852 | (defun php-ts-mode--font-lock-settings () |
| 844 | "Tree-sitter font-lock settings." | 853 | "Tree-sitter font-lock settings." |
| 845 | (treesit-font-lock-rules | 854 | (treesit-font-lock-rules |
| @@ -948,6 +957,8 @@ characters of the current line." | |||
| 948 | name: (_) @font-lock-type-face) | 957 | name: (_) @font-lock-type-face) |
| 949 | (function_definition | 958 | (function_definition |
| 950 | name: (_) @font-lock-function-name-face) | 959 | name: (_) @font-lock-function-name-face) |
| 960 | ,@(when (php-ts-mode--test-property-hook-clause-p) | ||
| 961 | '((property_hook (name) @font-lock-function-name-face))) | ||
| 951 | (method_declaration | 962 | (method_declaration |
| 952 | name: (_) @font-lock-function-name-face) | 963 | name: (_) @font-lock-function-name-face) |
| 953 | (method_declaration | 964 | (method_declaration |
| @@ -1108,14 +1119,13 @@ For NODE, OVERRIDE, START, and END, see `treesit-font-lock-rules'." | |||
| 1108 | (string-equal "plain_value" (treesit-node-type node))) | 1119 | (string-equal "plain_value" (treesit-node-type node))) |
| 1109 | (let ((color (css--compute-color start (treesit-node-text node t)))) | 1120 | (let ((color (css--compute-color start (treesit-node-text node t)))) |
| 1110 | (when color | 1121 | (when color |
| 1111 | (treesit-fontify-with-override | 1122 | (with-silent-modifications |
| 1112 | (treesit-node-start node) (treesit-node-end node) | 1123 | (add-text-properties |
| 1113 | (list 'face | 1124 | (treesit-node-start node) (treesit-node-end node) |
| 1114 | (list :background color | 1125 | (list 'face (list :background color |
| 1115 | :foreground (readable-foreground-color | 1126 | :foreground (readable-foreground-color |
| 1116 | color) | 1127 | color) |
| 1117 | :box '(:line-width -1))) | 1128 | :box '(:line-width -1))))))) |
| 1118 | override start end))) | ||
| 1119 | (treesit-fontify-with-override | 1129 | (treesit-fontify-with-override |
| 1120 | (treesit-node-start node) (treesit-node-end node) | 1130 | (treesit-node-start node) (treesit-node-end node) |
| 1121 | 'font-lock-variable-name-face | 1131 | 'font-lock-variable-name-face |
| @@ -1372,14 +1382,14 @@ Depends on `c-ts-common-comment-setup'." | |||
| 1372 | ;; PHPDOC specific | 1382 | ;; PHPDOC specific |
| 1373 | document | 1383 | document |
| 1374 | phpdoc-error) | 1384 | phpdoc-error) |
| 1375 | (keyword string type name) | 1385 | (keyword string property type name) |
| 1376 | (;; common | 1386 | (;; common |
| 1377 | attribute assignment constant escape-sequence function-scope | 1387 | attribute assignment constant escape-sequence function-scope |
| 1378 | base-clause literal variable-name variable | 1388 | base-clause literal variable-name variable |
| 1379 | ;; Javascript specific | 1389 | ;; Javascript specific |
| 1380 | jsx number pattern string-interpolation) | 1390 | jsx number pattern string-interpolation) |
| 1381 | (;; common | 1391 | (;; common |
| 1382 | argument bracket delimiter error function-call operator property | 1392 | argument bracket delimiter error function-call operator |
| 1383 | ;; Javascript specific | 1393 | ;; Javascript specific |
| 1384 | function))) | 1394 | function))) |
| 1385 | 1395 | ||
| @@ -1479,10 +1489,6 @@ Depends on `c-ts-common-comment-setup'." | |||
| 1479 | "statement"))) | 1489 | "statement"))) |
| 1480 | (text ,(regexp-opt '("comment" "text")))))) | 1490 | (text ,(regexp-opt '("comment" "text")))))) |
| 1481 | 1491 | ||
| 1482 | ;; Nodes like struct/enum/union_specifier can appear in | ||
| 1483 | ;; function_definitions, so we need to find the top-level node. | ||
| 1484 | (setq-local treesit-defun-prefer-top-level t) | ||
| 1485 | |||
| 1486 | ;; Indent. | 1492 | ;; Indent. |
| 1487 | (when (eq php-ts-mode-indent-style 'wordpress) | 1493 | (when (eq php-ts-mode-indent-style 'wordpress) |
| 1488 | (setq-local indent-tabs-mode t)) | 1494 | (setq-local indent-tabs-mode t)) |
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index d953ec8b25c..4c37ef45ddf 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -2748,6 +2748,10 @@ Currently there are `ruby-mode' and `ruby-ts-mode'." | |||
| 2748 | (dolist (name (list "ruby" "rbx" "jruby" "j?ruby\\(?:[0-9.]+\\)")) | 2748 | (dolist (name (list "ruby" "rbx" "jruby" "j?ruby\\(?:[0-9.]+\\)")) |
| 2749 | (add-to-list 'interpreter-mode-alist (cons (purecopy name) 'ruby-mode))) | 2749 | (add-to-list 'interpreter-mode-alist (cons (purecopy name) 'ruby-mode))) |
| 2750 | 2750 | ||
| 2751 | ;; See ruby-ts-mode.el for why we do this. | ||
| 2752 | (setq major-mode-remap-defaults | ||
| 2753 | (assq-delete-all 'ruby-mode major-mode-remap-defaults)) | ||
| 2754 | |||
| 2751 | (provide 'ruby-mode) | 2755 | (provide 'ruby-mode) |
| 2752 | 2756 | ||
| 2753 | ;;; ruby-mode.el ends here | 2757 | ;;; ruby-mode.el ends here |
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index aff0b8911b9..2b36c68bb6c 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el | |||
| @@ -34,9 +34,38 @@ | |||
| 34 | ;; put somewhere Emacs can find it. See the docstring of | 34 | ;; put somewhere Emacs can find it. See the docstring of |
| 35 | ;; `treesit-extra-load-path'. | 35 | ;; `treesit-extra-load-path'. |
| 36 | 36 | ||
| 37 | ;; This mode doesn't associate itself with .rb files automatically. | 37 | ;; This mode doesn't associate itself with .rb files automatically. To |
| 38 | ;; You can do that either by prepending to the value of | 38 | ;; use this mode by default, assuming you have the tree-sitter grammar |
| 39 | ;; `auto-mode-alist', or using `major-mode-remap-alist'. | 39 | ;; available, do one of the following: |
| 40 | ;; | ||
| 41 | ;; - Add the following to your init file: | ||
| 42 | ;; | ||
| 43 | ;; (add-to-list 'major-mode-remap-alist '(ruby-mode . ruby-ts-mode)) | ||
| 44 | ;; | ||
| 45 | ;; - Customize 'auto-mode-alist' to turn ruby-ts-mode automatically. | ||
| 46 | ;; For example: | ||
| 47 | ;; | ||
| 48 | ;; (add-to-list 'auto-mode-alist | ||
| 49 | ;; (cons (concat "\\(?:\\.\\(?:" | ||
| 50 | ;; "rbw?\\|ru\\|rake\\|thor\\|axlsx" | ||
| 51 | ;; "\\|jbuilder\\|rabl\\|gemspec\\|podspec" | ||
| 52 | ;; "\\)" | ||
| 53 | ;; "\\|/" | ||
| 54 | ;; "\\(?:Gem\\|Rake\\|Cap\\|Thor" | ||
| 55 | ;; "\\|Puppet\\|Berks\\|Brew\\|Fast" | ||
| 56 | ;; "\\|Vagrant\\|Guard\\|Pod\\)file" | ||
| 57 | ;; "\\)\\'") | ||
| 58 | ;; 'ruby-ts-mode)) | ||
| 59 | ;; | ||
| 60 | ;; will turn on the ruby-ts-mode for Ruby source files. | ||
| 61 | ;; | ||
| 62 | ;; - If you have the Ruby grammar installed, add | ||
| 63 | ;; | ||
| 64 | ;; (load "ruby-ts-mode") | ||
| 65 | ;; | ||
| 66 | ;; to your init file. | ||
| 67 | ;; | ||
| 68 | ;; You can also turn on this mode manually in a buffer. | ||
| 40 | 69 | ||
| 41 | ;; Tree Sitter brings a lot of power and versitility which can be | 70 | ;; Tree Sitter brings a lot of power and versitility which can be |
| 42 | ;; broken into these features. | 71 | ;; broken into these features. |
| @@ -1198,9 +1227,6 @@ leading double colon is not added." | |||
| 1198 | (treesit-node-parent node)) | 1227 | (treesit-node-parent node)) |
| 1199 | "interpolation")))))))) | 1228 | "interpolation")))))))) |
| 1200 | 1229 | ||
| 1201 | ;; AFAIK, Ruby can not nest methods | ||
| 1202 | (setq-local treesit-defun-prefer-top-level nil) | ||
| 1203 | |||
| 1204 | ;; Imenu. | 1230 | ;; Imenu. |
| 1205 | (setq-local imenu-create-index-function #'ruby-ts--imenu) | 1231 | (setq-local imenu-create-index-function #'ruby-ts--imenu) |
| 1206 | 1232 | ||
| @@ -1237,8 +1263,10 @@ leading double colon is not added." | |||
| 1237 | 1263 | ||
| 1238 | (derived-mode-add-parents 'ruby-ts-mode '(ruby-mode)) | 1264 | (derived-mode-add-parents 'ruby-ts-mode '(ruby-mode)) |
| 1239 | 1265 | ||
| 1240 | (if (treesit-ready-p 'ruby) | 1266 | (when (treesit-ready-p 'ruby) |
| 1241 | (add-to-list 'major-mode-remap-defaults | 1267 | (setq major-mode-remap-defaults |
| 1268 | (assq-delete-all 'ruby-mode major-mode-remap-defaults)) | ||
| 1269 | (add-to-list 'major-mode-remap-defaults | ||
| 1242 | '(ruby-mode . ruby-ts-mode))) | 1270 | '(ruby-mode . ruby-ts-mode))) |
| 1243 | 1271 | ||
| 1244 | (provide 'ruby-ts-mode) | 1272 | (provide 'ruby-ts-mode) |
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 860588995be..3dfb623c667 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el | |||
| @@ -475,7 +475,6 @@ This mode is intended to be inherited by concrete major modes." | |||
| 475 | 475 | ||
| 476 | ;; Comments. | 476 | ;; Comments. |
| 477 | (c-ts-common-comment-setup) | 477 | (c-ts-common-comment-setup) |
| 478 | (setq-local treesit-defun-prefer-top-level t) | ||
| 479 | 478 | ||
| 480 | ;; Electric | 479 | ;; Electric |
| 481 | (setq-local electric-indent-chars | 480 | (setq-local electric-indent-chars |
diff --git a/src/frame.c b/src/frame.c index 7f4bf274ad9..f6053fca3ef 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -5102,15 +5102,19 @@ gui_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 5102 | { | 5102 | { |
| 5103 | int unit = FRAME_COLUMN_WIDTH (f); | 5103 | int unit = FRAME_COLUMN_WIDTH (f); |
| 5104 | 5104 | ||
| 5105 | if (RANGED_FIXNUMP (1, arg, INT_MAX) | 5105 | if (RANGED_FIXNUMP (1, arg, INT_MAX)) |
| 5106 | && XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f)) | ||
| 5107 | { | 5106 | { |
| 5108 | FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFIXNAT (arg); | 5107 | if (XFIXNAT (arg) == FRAME_CONFIG_SCROLL_BAR_WIDTH (f)) |
| 5109 | FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFIXNAT (arg) + unit - 1) / unit; | 5108 | return; |
| 5110 | if (FRAME_NATIVE_WINDOW (f)) | 5109 | else |
| 5111 | adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width); | 5110 | { |
| 5111 | FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFIXNAT (arg); | ||
| 5112 | FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFIXNAT (arg) + unit - 1) / unit; | ||
| 5113 | if (FRAME_NATIVE_WINDOW (f)) | ||
| 5114 | adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width); | ||
| 5112 | 5115 | ||
| 5113 | SET_FRAME_GARBAGED (f); | 5116 | SET_FRAME_GARBAGED (f); |
| 5117 | } | ||
| 5114 | } | 5118 | } |
| 5115 | else | 5119 | else |
| 5116 | { | 5120 | { |
| @@ -5133,15 +5137,19 @@ gui_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 5133 | #if USE_HORIZONTAL_SCROLL_BARS | 5137 | #if USE_HORIZONTAL_SCROLL_BARS |
| 5134 | int unit = FRAME_LINE_HEIGHT (f); | 5138 | int unit = FRAME_LINE_HEIGHT (f); |
| 5135 | 5139 | ||
| 5136 | if (RANGED_FIXNUMP (1, arg, INT_MAX) | 5140 | if (RANGED_FIXNUMP (1, arg, INT_MAX)) |
| 5137 | && XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_HEIGHT (f)) | ||
| 5138 | { | 5141 | { |
| 5139 | FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = XFIXNAT (arg); | 5142 | if (XFIXNAT (arg) == FRAME_CONFIG_SCROLL_BAR_HEIGHT (f)) |
| 5140 | FRAME_CONFIG_SCROLL_BAR_LINES (f) = (XFIXNAT (arg) + unit - 1) / unit; | 5143 | return; |
| 5141 | if (FRAME_NATIVE_WINDOW (f)) | 5144 | else |
| 5142 | adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height); | 5145 | { |
| 5146 | FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = XFIXNAT (arg); | ||
| 5147 | FRAME_CONFIG_SCROLL_BAR_LINES (f) = (XFIXNAT (arg) + unit - 1) / unit; | ||
| 5148 | if (FRAME_NATIVE_WINDOW (f)) | ||
| 5149 | adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height); | ||
| 5143 | 5150 | ||
| 5144 | SET_FRAME_GARBAGED (f); | 5151 | SET_FRAME_GARBAGED (f); |
| 5152 | } | ||
| 5145 | } | 5153 | } |
| 5146 | else | 5154 | else |
| 5147 | { | 5155 | { |
diff --git a/src/nsterm.m b/src/nsterm.m index 205b1621399..dceb3cebb4d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -8524,6 +8524,11 @@ ns_in_echo_area (void) | |||
| 8524 | 8524 | ||
| 8525 | NSTRACE ("[EmacsView toggleFullScreen:]"); | 8525 | NSTRACE ("[EmacsView toggleFullScreen:]"); |
| 8526 | 8526 | ||
| 8527 | /* Reset fs_is_native to value of ns-use-native-full-screen if not | ||
| 8528 | fullscreen already */ | ||
| 8529 | if (fs_state != FULLSCREEN_BOTH) | ||
| 8530 | fs_is_native = ns_use_native_fullscreen; | ||
| 8531 | |||
| 8527 | if (fs_is_native) | 8532 | if (fs_is_native) |
| 8528 | { | 8533 | { |
| 8529 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 | 8534 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 |