1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

Merge from origin/emacs-30

afb34a3b23 ; Improve documentation of ':box' face attribute
b38eb6da1d Fix docstring of c-ts-mode-indent-style
9fdb764898 Support PHP 8.4 and more reliable indentation (bug#74525)
bda0bce9e4 Don't inadvertently reset frame scroll bar sizes (Bug#74435)
3f99cdaf26 Mention special variables in lexical binding documentation
0ef0f18f16 Allow to go back to using 'ruby-mode' after loading 'ruby...
fc17e8727d Delete obsolete section in admin/notes/repo
3e396b2c5b Improve documentation for 'while-let'
50b91ed458 Remove mention of treesit-defun-prefer-top-level (bug#74474)
03ae07291e Fix NS non-native fullscreen on initial frame load (bug#5...
8261d7224d Fix user options for listing and marking diary files

# Conflicts:
#	lisp/progmodes/c-ts-mode.el
This commit is contained in:
Eli Zaretskii 2024-11-30 06:44:06 -05:00
commit 88f6b045f4
13 changed files with 213 additions and 119 deletions

View file

@ -77,16 +77,6 @@ variable in admin/merge-gnulib before running it.
If you remove a gnulib module, or if a gnulib module
removes a file, then remove the corresponding files by hand.
* How to merge changes from emacs-24 to master
[The section on git merge procedure has not yet been written.]
You may see conflicts in autoload md5sums in comments. Strictly
speaking, the right thing to do is merge everything else, resolve the
conflict by choosing either the master or branch version, then run
'make -C lisp autoloads' to update the md5sums to the correct master
value before committing.
* Re-adding a file that has been removed from the repository
Let's suppose you've done:

View file

@ -322,25 +322,46 @@ There's a number of variations on this theme, and they're briefly
described below.
@defmac if-let* varlist then-form else-forms...
Evaluate each binding in @var{varlist} in turn, like in @code{let*}
(@pxref{Local Variables}), stopping if a binding value is @code{nil}.
If all are non-@code{nil}, return the value of @var{then-form},
otherwise the last form in @var{else-forms}.
Evaluate each binding in @var{varlist}, stopping if a binding value is
@code{nil}. If all are non-@code{nil}, return the value of
@var{then-form}, otherwise the last form in @var{else-forms}.
Each element of @code{varlist} has the form @w{@code{(@var{symbol}
@var{value-form})}}: @var{value-form} is evaluated and @var{symbol} is
locally bound to the result. Bindings are sequential, as in @code{let*}
(@pxref{Local Variables}). As a special case, @var{symbol} can be
omitted if only the test result of @var{value-form} is of interest:
@var{value-form} is evaluated and checked for @code{nil}, but its value
is not bound.
@end defmac
@defmac when-let* varlist then-forms...
Like @code{if-let*}, but without @var{else-forms}.
Evaluate each binding in @var{varlist}, stopping if a binding value is
@code{nil}. If all are non-@code{nil}, return the value of the last
form in @var{then-forms}.
@var{varlist} has the same form as in @code{if-let*}: Each element of
@code{varlist} has the form @w{@code{(@var{symbol} @var{value-form})}},
in which @var{value-form} is evaluated and @var{symbol} is locally bound
to the result. Bindings are sequential, as in @code{let*} (@pxref{Local
Variables}). As a special case, @var{symbol} can be omitted if only the
test result of @var{value-form} is of interest: @var{value-form} is
evaluated and checked for @code{nil}, but its value is not bound.
@end defmac
@defmac and-let* varlist then-forms...
Like @code{when-let*}, but in addition, if there are no
@var{then-forms} and all the bindings evaluate to non-@code{nil}, return
Evaluate each binding in @var{varlist}, stopping if a binding value is
@code{nil}. If all are non-@code{nil}, return the value of the last
form in @var{then-forms}, or, if there are no @var{then-forms}, return
the value of the last binding.
@end defmac
@defmac while-let spec then-forms...
Like @code{when-let*}, but repeat until a binding in @var{spec} is
@code{nil}. The return value is always @code{nil}.
@var{varlist} has the same form as in @code{if-let*}: Each element of
@code{varlist} has the form @w{@code{(@var{symbol} @var{value-form})}},
in which @var{value-form} is evaluated and @var{symbol} is locally bound
to the result. Bindings are sequential, as in @code{let*} (@pxref{Local
Variables}). As a special case, @var{symbol} can be omitted if only the
test result of @var{value-form} is of interest: @var{value-form} is
evaluated and checked for @code{nil}, but its value is not bound.
@end defmac
Some Lisp programmers follow the convention that @code{and} and
@ -348,6 +369,27 @@ Some Lisp programmers follow the convention that @code{and} and
@code{when} and @code{when-let*} are for forms evaluated for side-effect
with returned values ignored.
A similar macro exists to run a loop until one binding evaluates to
@code{nil}:
@defmac while-let spec then-forms...
Evaluate each binding in @var{spec} in turn, stopping if a binding value
is @code{nil}. If all are non-@code{nil}, execute @var{then-forms},
then repeat the loop. Note that when the loop is repeated, the
@var{value-forms} in @var{spec} are re-evaluated and the bindings are
established anew.
@var{varlist} has the same form as in @code{if-let*}: Each element of
@code{varlist} has the form @w{@code{(@var{symbol} @var{value-form})}},
in which @var{value-form} is evaluated and @var{symbol} is locally bound
to the result. Bindings are sequential, as in @code{let*} (@pxref{Local
Variables}). As a special case, @var{symbol} can be omitted if only the
test result of @var{value-form} is of interest: @var{value-form} is
evaluated and checked for @code{nil}, but its value is not bound.
The return value of @code{while-let} is always @code{nil}.
@end defmac
@node Combining Conditions
@section Constructs for Combining Conditions
@cindex combining conditions

View file

@ -2805,7 +2805,11 @@ being pressed. If it is @code{pressed-button}, the box looks like a
If you use the @code{:box} face attribute on strings displayed instead
of buffer text via the @code{display} text property, special
considerations might apply if the surrounding buffer text also has the
@code{:box} face attribute. @xref{Replacing Specs}.
@code{:box} face attribute. @xref{Replacing Specs}. Also note that the
vertical lines of the box are only drawn when @code{:box} attribute
changes from @code{nil} to non-@code{nil} or vice versa; two consecutive
face properties with a non-@code{nil} @code{:box} attribute will be
displayed without the vertical line between them.
@item :inverse-video
Whether or not characters should be displayed in inverse video. The

View file

@ -1096,7 +1096,7 @@ x ; @r{Note that @code{x} has no global value.}
@end example
@noindent
The @code{let} binding defines a lexical environment in which the
Here, the @code{let} binding defines a lexical environment in which the
variable @code{x} is locally bound to 0. Within this binding
construct, we define a lambda expression which increments @code{x} by
one and returns the incremented value. This lambda expression is
@ -1113,6 +1113,12 @@ functions which take a symbol argument (like @code{symbol-value},
variable's dynamic binding (i.e., the contents of its symbol's value
cell).
Note also that variables may be declared special, in which case they
will use dynamic binding, even for new bindings such as a @code{let}
binding. Depending on how the variable is declared, it can be
special globally, for a single file, or for a portion of a file.
@xref{Dynamic Binding} for details.
@node Dynamic Binding
@subsection Dynamic Binding

View file

@ -235,7 +235,8 @@ use `diary-list-entries-hook', which runs only for the main diary file."
:type 'hook
:options '(diary-bahai-list-entries
diary-hebrew-list-entries
diary-islamic-list-entries)
diary-islamic-list-entries
diary-chinese-list-entries)
:group 'diary)
(defcustom diary-nongregorian-marking-hook nil
@ -252,7 +253,8 @@ use `diary-mark-entries-hook', which runs only for the main diary file."
:type 'hook
:options '(diary-bahai-mark-entries
diary-hebrew-mark-entries
diary-islamic-mark-entries)
diary-islamic-mark-entries
diary-chinese-mark-entries)
:group 'diary)
(defcustom diary-print-entries-hook #'lpr-buffer

View file

@ -35,7 +35,7 @@
;; To use these modes by default, assuming you have the respective
;; tree-sitter grammars available, do one of the following:
;;
;; - Add one or mode of the following to your init file:
;; - Add one or more of the following lines to your init file:
;;
;; (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
;; (add-to-list 'major-mode-remap-alist '(c++-mode . c++-ts-mode))
@ -150,10 +150,11 @@ symbol."
(defcustom c-ts-mode-indent-style 'gnu
"Style used for indentation.
The selected style could be one of GNU, K&R, LINUX or BSD. If
one of the supplied styles doesn't suffice, the value could be
a function instead. This function is expected to return a list
that follows the form of `treesit-simple-indent-rules'."
The selected style could be one of GNU, K&R, LINUX or BSD. If the
supplied styles don't suffice, the value could be a function instead.
This function takes no arguments and is expected to return a list of
indent RULEs as described in `treesit-simple-indent-rules'. Note that
the list of RULEs doesn't need to contain the language symbol."
:version "29.1"
:type '(choice (symbol :tag "Gnu" gnu)
(symbol :tag "K&R" k&r)
@ -1277,9 +1278,6 @@ BEG and END are described in `treesit-range-rules'."
`((c ,@c-ts-mode--thing-settings)
(cpp ,@c-ts-mode--thing-settings)))
;; Nodes like struct/enum/union_specifier can appear in
;; function_definitions, so we need to find the top-level node.
(setq-local treesit-defun-prefer-top-level t)
;; When the code is in incomplete state, try to make a better guess
;; about which node to indent against.
@ -1370,6 +1368,9 @@ in your init files."
(setq-local treesit-font-lock-settings
(c-ts-mode--font-lock-settings 'c))
;; Navigation.
;;
;; Nodes like struct/enum/union_specifier can appear in
;; function_definitions, so we need to find the top-level node.
(setq-local treesit-defun-tactic 'top-level)
(treesit-major-mode-setup)

View file

@ -3918,7 +3918,6 @@ See `treesit-thing-settings' for more information.")
;; Indent.
(setq-local treesit-simple-indent-rules js--treesit-indent-rules)
;; Navigation.
(setq-local treesit-defun-prefer-top-level t)
(setq-local treesit-defun-type-regexp
(rx (or "class_declaration"
"method_definition"

View file

@ -84,7 +84,7 @@
;;; Install treesitter language parsers
(defvar php-ts-mode--language-source-alist
'((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.23.5" "php/src"))
'((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.23.11" "php/src"))
(phpdoc . ("https://github.com/claytonrcarter/tree-sitter-phpdoc"))
(html . ("https://github.com/tree-sitter/tree-sitter-html" "v0.23.0"))
(javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.23.0"))
@ -477,16 +477,20 @@ PARENT is its parent."
(treesit-node-start parent)
(line-end-position))))))
(defun php-ts-mode--js-css-tag-bol (node _parent &rest _)
(defun php-ts-mode--js-css-tag-bol (_node parent &rest _)
"Find the first non-space characters of html tags <script> or <style>.
If NODE is nil return `line-beginning-position'. PARENT is ignored.
NODE is the node to match and PARENT is its parent."
(if (null node)
(line-beginning-position)
Return `line-beginning-position' when `treesit-node-at' is HTML or PHP.
Otherwise go to the PARENT and search backward for <script> or <style> tags.
Should be used only for Javascript or CSS indenting rules.
NODE, ignored, is the node to match and PARENT is its parent."
(let ((lang (treesit-language-at (point))))
(if (or (eq lang 'javascript)
(eq lang 'css))
(save-excursion
(goto-char (treesit-node-start node))
(re-search-backward "<script>\\|<style>" nil t))))
(goto-char (treesit-node-start parent))
(re-search-backward "<script.*>\\|<style.*>" nil t))
(line-beginning-position))))
(defun php-ts-mode--parent-eol (_node parent &rest _)
"Find the last non-space characters of the PARENT of the current NODE.
@ -840,6 +844,11 @@ characters of the current line."
(ignore-errors
(progn (treesit-query-compile 'php "(visibility_modifier (operation))" t) t)))
(defun php-ts-mode--test-property-hook-clause-p ()
"Return t if property_hook is a named node, nil otherwise."
(ignore-errors
(progn (treesit-query-compile 'php "(property_hook)" t) t)))
(defun php-ts-mode--font-lock-settings ()
"Tree-sitter font-lock settings."
(treesit-font-lock-rules
@ -948,6 +957,8 @@ characters of the current line."
name: (_) @font-lock-type-face)
(function_definition
name: (_) @font-lock-function-name-face)
,@(when (php-ts-mode--test-property-hook-clause-p)
'((property_hook (name) @font-lock-function-name-face)))
(method_declaration
name: (_) @font-lock-function-name-face)
(method_declaration
@ -1108,14 +1119,13 @@ For NODE, OVERRIDE, START, and END, see `treesit-font-lock-rules'."
(string-equal "plain_value" (treesit-node-type node)))
(let ((color (css--compute-color start (treesit-node-text node t))))
(when color
(treesit-fontify-with-override
(with-silent-modifications
(add-text-properties
(treesit-node-start node) (treesit-node-end node)
(list 'face
(list :background color
(list 'face (list :background color
:foreground (readable-foreground-color
color)
:box '(:line-width -1)))
override start end)))
:box '(:line-width -1)))))))
(treesit-fontify-with-override
(treesit-node-start node) (treesit-node-end node)
'font-lock-variable-name-face
@ -1372,14 +1382,14 @@ Depends on `c-ts-common-comment-setup'."
;; PHPDOC specific
document
phpdoc-error)
(keyword string type name)
(keyword string property type name)
(;; common
attribute assignment constant escape-sequence function-scope
base-clause literal variable-name variable
;; Javascript specific
jsx number pattern string-interpolation)
(;; common
argument bracket delimiter error function-call operator property
argument bracket delimiter error function-call operator
;; Javascript specific
function)))
@ -1479,10 +1489,6 @@ Depends on `c-ts-common-comment-setup'."
"statement")))
(text ,(regexp-opt '("comment" "text"))))))
;; Nodes like struct/enum/union_specifier can appear in
;; function_definitions, so we need to find the top-level node.
(setq-local treesit-defun-prefer-top-level t)
;; Indent.
(when (eq php-ts-mode-indent-style 'wordpress)
(setq-local indent-tabs-mode t))

View file

@ -2748,6 +2748,10 @@ Currently there are `ruby-mode' and `ruby-ts-mode'."
(dolist (name (list "ruby" "rbx" "jruby" "j?ruby\\(?:[0-9.]+\\)"))
(add-to-list 'interpreter-mode-alist (cons (purecopy name) 'ruby-mode)))
;; See ruby-ts-mode.el for why we do this.
(setq major-mode-remap-defaults
(assq-delete-all 'ruby-mode major-mode-remap-defaults))
(provide 'ruby-mode)
;;; ruby-mode.el ends here

View file

@ -34,9 +34,38 @@
;; put somewhere Emacs can find it. See the docstring of
;; `treesit-extra-load-path'.
;; This mode doesn't associate itself with .rb files automatically.
;; You can do that either by prepending to the value of
;; `auto-mode-alist', or using `major-mode-remap-alist'.
;; This mode doesn't associate itself with .rb files automatically. To
;; use this mode by default, assuming you have the tree-sitter grammar
;; available, do one of the following:
;;
;; - Add the following to your init file:
;;
;; (add-to-list 'major-mode-remap-alist '(ruby-mode . ruby-ts-mode))
;;
;; - Customize 'auto-mode-alist' to turn ruby-ts-mode automatically.
;; For example:
;;
;; (add-to-list 'auto-mode-alist
;; (cons (concat "\\(?:\\.\\(?:"
;; "rbw?\\|ru\\|rake\\|thor\\|axlsx"
;; "\\|jbuilder\\|rabl\\|gemspec\\|podspec"
;; "\\)"
;; "\\|/"
;; "\\(?:Gem\\|Rake\\|Cap\\|Thor"
;; "\\|Puppet\\|Berks\\|Brew\\|Fast"
;; "\\|Vagrant\\|Guard\\|Pod\\)file"
;; "\\)\\'")
;; 'ruby-ts-mode))
;;
;; will turn on the ruby-ts-mode for Ruby source files.
;;
;; - If you have the Ruby grammar installed, add
;;
;; (load "ruby-ts-mode")
;;
;; to your init file.
;;
;; You can also turn on this mode manually in a buffer.
;; Tree Sitter brings a lot of power and versitility which can be
;; broken into these features.
@ -1198,9 +1227,6 @@ leading double colon is not added."
(treesit-node-parent node))
"interpolation"))))))))
;; AFAIK, Ruby can not nest methods
(setq-local treesit-defun-prefer-top-level nil)
;; Imenu.
(setq-local imenu-create-index-function #'ruby-ts--imenu)
@ -1237,7 +1263,9 @@ leading double colon is not added."
(derived-mode-add-parents 'ruby-ts-mode '(ruby-mode))
(if (treesit-ready-p 'ruby)
(when (treesit-ready-p 'ruby)
(setq major-mode-remap-defaults
(assq-delete-all 'ruby-mode major-mode-remap-defaults))
(add-to-list 'major-mode-remap-defaults
'(ruby-mode . ruby-ts-mode)))

View file

@ -475,7 +475,6 @@ This mode is intended to be inherited by concrete major modes."
;; Comments.
(c-ts-common-comment-setup)
(setq-local treesit-defun-prefer-top-level t)
;; Electric
(setq-local electric-indent-chars

View file

@ -5102,8 +5102,11 @@ gui_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
int unit = FRAME_COLUMN_WIDTH (f);
if (RANGED_FIXNUMP (1, arg, INT_MAX)
&& XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
if (RANGED_FIXNUMP (1, arg, INT_MAX))
{
if (XFIXNAT (arg) == FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
return;
else
{
FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFIXNAT (arg);
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFIXNAT (arg) + unit - 1) / unit;
@ -5112,6 +5115,7 @@ gui_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
SET_FRAME_GARBAGED (f);
}
}
else
{
if (FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook)
@ -5133,8 +5137,11 @@ gui_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
#if USE_HORIZONTAL_SCROLL_BARS
int unit = FRAME_LINE_HEIGHT (f);
if (RANGED_FIXNUMP (1, arg, INT_MAX)
&& XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_HEIGHT (f))
if (RANGED_FIXNUMP (1, arg, INT_MAX))
{
if (XFIXNAT (arg) == FRAME_CONFIG_SCROLL_BAR_HEIGHT (f))
return;
else
{
FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = XFIXNAT (arg);
FRAME_CONFIG_SCROLL_BAR_LINES (f) = (XFIXNAT (arg) + unit - 1) / unit;
@ -5143,6 +5150,7 @@ gui_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
SET_FRAME_GARBAGED (f);
}
}
else
{
if (FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook)

View file

@ -8524,6 +8524,11 @@ ns_in_echo_area (void)
NSTRACE ("[EmacsView toggleFullScreen:]");
/* Reset fs_is_native to value of ns-use-native-full-screen if not
fullscreen already */
if (fs_state != FULLSCREEN_BOTH)
fs_is_native = ns_use_native_fullscreen;
if (fs_is_native)
{
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070