From 8261d7224d30feca885e031d901923c550606db0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 24 Nov 2024 11:27:00 +0200 Subject: [PATCH 01/11] Fix user options for listing and marking diary files * lisp/calendar/diary-lib.el (diary-nongregorian-listing-hook) (diary-nongregorian-marking-hook): Add Chinese functions to the list of variable's options. (Bug#74498) --- lisp/calendar/diary-lib.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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." :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 From 03ae07291e85fd353595806c3ce1ad3315c47649 Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Sat, 16 Nov 2024 20:54:59 -0800 Subject: [PATCH 02/11] Fix NS non-native fullscreen on initial frame load (bug#59790) * src/nsterm.m ([EmacsView toggleFullScreen:]): Reset fs_is_native --- src/nsterm.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/nsterm.m b/src/nsterm.m index 97b829d0e4c..e311e3654e8 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -8522,6 +8522,11 @@ - (void)toggleFullScreen: (id)sender 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 From 50b91ed458df8f04359996b31b18fb318ba64a47 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sat, 23 Nov 2024 21:39:40 -0800 Subject: [PATCH 03/11] Remove mention of treesit-defun-prefer-top-level (bug#74474) treesit-defun-prefer-top-level is removed before Emacs 29 released and was replaced by treesit-defun-tactic. These statements that set it doesn't do anything other than introduce confusion, so we should remove them. * lisp/progmodes/c-ts-mode.el (c-ts-base-mode): * lisp/progmodes/js.el (js-ts-mode): * lisp/progmodes/php-ts-mode.el (php-ts-mode): * lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode): * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-base-mode): Remove statements setting treesit-defun-prefer-top-level. --- lisp/progmodes/c-ts-mode.el | 6 +++--- lisp/progmodes/js.el | 1 - lisp/progmodes/php-ts-mode.el | 4 ---- lisp/progmodes/ruby-ts-mode.el | 3 --- lisp/progmodes/typescript-ts-mode.el | 1 - 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 90eeffe370c..73c1411ad0f 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -1254,9 +1254,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. @@ -1346,6 +1343,9 @@ in your init files." ;; Font-lock. (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) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 75c8111035c..5ac5b88d17f 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3916,7 +3916,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" diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index d8a3f60508b..f9fd03cbf72 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -1479,10 +1479,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)) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index adcdf15c7ad..7c1c07ac5b6 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1198,9 +1198,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) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 3606a139d50..dcf1f721f2f 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -462,7 +462,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 From 3e396b2c5bb8abdc16218ca8c9d617b9dcf9f01e Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Mon, 11 Nov 2024 23:38:49 +0100 Subject: [PATCH 04/11] Improve documentation for 'while-let' * doc/lispref/control.texi (Conditionals): Reorganise describing what's overlapping between the macros (and between the macros and let*), and then improve the documentation for 'while-let'. --- doc/lispref/control.texi | 64 +++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index 41f40ea852c..17f91606a86 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 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 From fc17e8727d48c32f2610c6fe7c17147bff7be52b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 24 Nov 2024 11:27:19 +0100 Subject: [PATCH 05/11] Delete obsolete section in admin/notes/repo * admin/notes/repo: Delete section "How to merge changes from emacs-24 to master", which is documented in admin/notes/git-workflow. Also delete out-of-date autoload advice. --- admin/notes/repo | 10 ---------- 1 file changed, 10 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. 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: From 0ef0f18f163c37a9d5c0b63c34eb3f37016a0d5e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 28 Nov 2024 16:55:26 +0200 Subject: [PATCH 06/11] Allow to go back to using 'ruby-mode' after loading 'ruby-ts-mode' * lisp/progmodes/ruby-ts-mode.el (major-mode-remap-defaults): Remap 'ruby-mode' to 'ruby-ts-mode'. Add commentary. * lisp/progmodes/ruby-mode.el (major-mode-remap-defaults): Remove any remappings of ruby-mode'. * lisp/progmodes/c-ts-mode.el: Fix a typo in a comment. (Bug#74339) --- lisp/progmodes/c-ts-mode.el | 2 +- lisp/progmodes/ruby-mode.el | 4 ++++ lisp/progmodes/ruby-ts-mode.el | 41 +++++++++++++++++++++++++++++----- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 73c1411ad0f..31f822b219d 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -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)) 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'." (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 diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 7c1c07ac5b6..c86ef7e0a3e 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -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. @@ -1234,8 +1263,10 @@ leading double colon is not added." (derived-mode-add-parents 'ruby-ts-mode '(ruby-mode)) -(if (treesit-ready-p 'ruby) - (add-to-list 'major-mode-remap-defaults +(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))) (provide 'ruby-ts-mode) From 3f99cdaf26dc606012384a6f191dc9d96483d437 Mon Sep 17 00:00:00 2001 From: Mike Kupfer Date: Mon, 25 Nov 2024 16:52:05 -0800 Subject: [PATCH 07/11] Mention special variables in lexical binding documentation * doc/lispref/variables.texi (Lexical Binding): Briefly mention special variables and their semantics. (Bug#74540) --- doc/lispref/variables.texi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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.} @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 From bda0bce9e4313c496fcfdcf4b6abeba3f68e5fac Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Thu, 28 Nov 2024 18:53:45 +0100 Subject: [PATCH 08/11] Don't inadvertently reset frame scroll bar sizes (Bug#74435) * src/frame.c (gui_set_scroll_bar_width) (gui_set_scroll_bar_height): When the new size equals the old one do not reset size to default size (Bug#74435). --- src/frame.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) 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) { 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)) { - FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFIXNAT (arg); - FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFIXNAT (arg) + unit - 1) / unit; - if (FRAME_NATIVE_WINDOW (f)) - adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width); + 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; + if (FRAME_NATIVE_WINDOW (f)) + adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width); - SET_FRAME_GARBAGED (f); + SET_FRAME_GARBAGED (f); + } } else { @@ -5133,15 +5137,19 @@ 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)) { - FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = XFIXNAT (arg); - FRAME_CONFIG_SCROLL_BAR_LINES (f) = (XFIXNAT (arg) + unit - 1) / unit; - if (FRAME_NATIVE_WINDOW (f)) - adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height); + 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; + if (FRAME_NATIVE_WINDOW (f)) + adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height); - SET_FRAME_GARBAGED (f); + SET_FRAME_GARBAGED (f); + } } else { From 9fdb764898dd4f40f562f8540767a18c827fe7d3 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Mon, 25 Nov 2024 11:06:02 +0100 Subject: [PATCH 09/11] Support PHP 8.4 and more reliable indentation (bug#74525) Added support for PHP 8.4 property hook. More reliable CSS and Javascript syntax indentation when there are attributes in