From 893c40c63e8e30eae6be577670612aa21768d312 Mon Sep 17 00:00:00 2001 From: Sora Takai Date: Wed, 19 Mar 2025 23:50:38 +0900 Subject: [PATCH 1/4] Make isearch lazy-highlights non-sticky at both ends (bug#77121) Copyright-paperwork-exempt: yes --- lisp/isearch.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index 31ad96d4a78..fa678740810 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -4265,7 +4265,7 @@ Attempt to do the search exactly the way the pending Isearch would." (and (eq isearch-lazy-highlight-invisible 'open) 'can-be-opened))) (funcall isearch-filter-predicate mb me))) - (let ((ov (make-overlay mb me))) + (let ((ov (make-overlay mb me nil t nil))) (push ov isearch-lazy-highlight-overlays) ;; 1000 is higher than ediff's 100+, ;; but lower than isearch main overlay's 1001 From 81c21d89ede8dfa664b7a3700acd7bf4c9fa54aa Mon Sep 17 00:00:00 2001 From: shipmints Date: Sun, 16 Feb 2025 14:30:45 -0500 Subject: [PATCH 2/4] Ensure .dir-locals-2.el behavior as documented (bug#75890) * lisp/files.el (dir-locals--all-files): New &optional 'base-el-only' argument. (dir-locals--base-file): New function. (dir-locals-find-file): 'locate-dominating-file' only for the base .dir-locals.el. * test/lisp/files-tests.el (files-test-dir-locals-2-solo): New test. * test/lisp/files-resources/dir-locals-2-solo: New test support. (files-test-dir-locals-2-paired): New test. * test/lisp/files-resources/dir-locals-and-2: New test support. --- lisp/files.el | 21 ++++++++++++------- .../dir-locals-2-solo/.dir-locals-2.el | 1 + .../dir-locals-2-solo/dir-locals-2-solo.txt | 3 +++ .../dir-locals-and-2/.dir-locals-2.el | 1 + .../dir-locals-and-2/.dir-locals.el | 1 + .../dir-locals-and-2/dir-locals-and-2.txt | 4 ++++ test/lisp/files-tests.el | 15 +++++++++++++ 7 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 test/lisp/files-resources/dir-locals-2-solo/.dir-locals-2.el create mode 100644 test/lisp/files-resources/dir-locals-2-solo/dir-locals-2-solo.txt create mode 100644 test/lisp/files-resources/dir-locals-and-2/.dir-locals-2.el create mode 100644 test/lisp/files-resources/dir-locals-and-2/.dir-locals.el create mode 100644 test/lisp/files-resources/dir-locals-and-2/dir-locals-and-2.txt diff --git a/lisp/files.el b/lisp/files.el index 461960d6f2b..4e3aeeb9246 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4713,21 +4713,22 @@ the \".dir-locals.el\". See Info node `(elisp)Directory Local Variables' for details.") -(defun dir-locals--all-files (directory) +(defun dir-locals--all-files (directory &optional base-el-only) "Return a list of all readable dir-locals files in DIRECTORY. The returned list is sorted by increasing priority. That is, values specified in the last file should take precedence over those in the first." (when (file-readable-p directory) (let* ((file-1 (expand-file-name (if (eq system-type 'ms-dos) - (dosified-file-name dir-locals-file) - dir-locals-file) - directory)) + (dosified-file-name dir-locals-file) + dir-locals-file) + directory)) (file-2 (when (string-match "\\.el\\'" file-1) (replace-match "-2.el" t nil file-1))) - (out nil)) - ;; The order here is important. - (dolist (f (list file-2 file-1)) + out) + (dolist (f (or (and base-el-only (list file-1)) + ;; The order here is important. + (list file-2 file-1))) (when (and f (file-readable-p f) ;; FIXME: Aren't file-regular-p and @@ -4737,6 +4738,10 @@ those in the first." (push f out))) out))) +(defun dir-locals--base-file (directory) + "Return readable `dir-locals-file' in DIRECTORY, or nil." + (dir-locals--all-files directory 'base-el-only)) + (defun dir-locals-find-file (file) "Find the directory-local variables for FILE. This searches upward in the directory tree from FILE. @@ -4758,7 +4763,7 @@ This function returns either: entry." (setq file (expand-file-name file)) (let* ((locals-dir (locate-dominating-file (file-name-directory file) - #'dir-locals--all-files)) + #'dir-locals--base-file)) dir-elt) ;; `locate-dominating-file' may have abbreviated the name. (when locals-dir diff --git a/test/lisp/files-resources/dir-locals-2-solo/.dir-locals-2.el b/test/lisp/files-resources/dir-locals-2-solo/.dir-locals-2.el new file mode 100644 index 00000000000..08584933c41 --- /dev/null +++ b/test/lisp/files-resources/dir-locals-2-solo/.dir-locals-2.el @@ -0,0 +1 @@ +((nil . ((dir-locals-2-loaded . t)))) diff --git a/test/lisp/files-resources/dir-locals-2-solo/dir-locals-2-solo.txt b/test/lisp/files-resources/dir-locals-2-solo/dir-locals-2-solo.txt new file mode 100644 index 00000000000..83ed6482e06 --- /dev/null +++ b/test/lisp/files-resources/dir-locals-2-solo/dir-locals-2-solo.txt @@ -0,0 +1,3 @@ +# Used by files-test.el. +# Due to solo .dir-locals-2.el, the local variable `dir-locals-2-loaded' +# should be undefined. diff --git a/test/lisp/files-resources/dir-locals-and-2/.dir-locals-2.el b/test/lisp/files-resources/dir-locals-and-2/.dir-locals-2.el new file mode 100644 index 00000000000..08584933c41 --- /dev/null +++ b/test/lisp/files-resources/dir-locals-and-2/.dir-locals-2.el @@ -0,0 +1 @@ +((nil . ((dir-locals-2-loaded . t)))) diff --git a/test/lisp/files-resources/dir-locals-and-2/.dir-locals.el b/test/lisp/files-resources/dir-locals-and-2/.dir-locals.el new file mode 100644 index 00000000000..2b57bf9e7c0 --- /dev/null +++ b/test/lisp/files-resources/dir-locals-and-2/.dir-locals.el @@ -0,0 +1 @@ +((nil . ((dir-locals-loaded . t)))) diff --git a/test/lisp/files-resources/dir-locals-and-2/dir-locals-and-2.txt b/test/lisp/files-resources/dir-locals-and-2/dir-locals-and-2.txt new file mode 100644 index 00000000000..bb8a31ca147 --- /dev/null +++ b/test/lisp/files-resources/dir-locals-and-2/dir-locals-and-2.txt @@ -0,0 +1,4 @@ +# Used by files-test.el. +# .dir-locals.el and .dir-locals-2.el should define: +# local variable `dir-locals-loaded' +# local variable `dir-locals-2-loaded' diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 9f17747da1f..91ca557204e 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1782,6 +1782,21 @@ set to." ;; Invocation through env, with modified environment. (files-tests--check-shebang "#!/usr/bin/env -S PYTHONPATH=/...:${PYTHONPATH} python" 'python-base-mode)) +(ert-deftest files-test-dir-locals-2-solo () + "Ensure that solo `.dir-locals-2.el' is ignored." + (with-current-buffer + (find-file-noselect (ert-resource-file + (concat "dir-locals-2-solo/dir-locals-2-solo.txt"))) + (should-not (local-variable-p 'dir-locals-2-loaded)))) + +(ert-deftest files-test-dir-locals-2-paired () + "Ensure that `.dir-locals-2.el' is loaded, if paired." + (let ((enable-local-variables :all)) + (with-current-buffer (find-file-noselect + (ert-resource-file (concat "dir-locals-and-2/dir-locals-and-2.txt"))) + (should (local-variable-p 'dir-locals-loaded)) + (should (local-variable-p 'dir-locals-2-loaded))))) + (ert-deftest files-test-dir-locals-auto-mode-alist () "Test an `auto-mode-alist' entry in `.dir-locals.el'" (find-file (ert-resource-file "whatever.quux")) From 92b373318d2401f98f0ad5590ef799904c96506f Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 22 Mar 2025 22:41:53 +0100 Subject: [PATCH 3/4] Reduce code duplication in ns_set_appearance * src/nsterm.h (ns_set_appearance_1): Declare. * src/nsterm.m (ns_set_appearance_1): Break out new function... (ns_set_appearance): ...here. * src/nsfns.m (Fx_create_frame): Use above new function. --- src/nsfns.m | 7 +------ src/nsterm.h | 1 + src/nsterm.m | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/nsfns.m b/src/nsfns.m index 9f52777879c..b1ed0eff58a 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1404,12 +1404,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, #ifdef NS_IMPL_COCOA tem = gui_display_get_arg (dpyinfo, parms, Qns_appearance, NULL, NULL, RES_TYPE_SYMBOL); - if (EQ (tem, Qdark)) - FRAME_NS_APPEARANCE (f) = ns_appearance_vibrant_dark; - else if (EQ (tem, Qlight)) - FRAME_NS_APPEARANCE (f) = ns_appearance_aqua; - else - FRAME_NS_APPEARANCE (f) = ns_appearance_system_default; + ns_set_appearance_1 (f, tem); store_frame_param (f, Qns_appearance, (!NILP (tem) && !EQ (tem, Qunbound)) ? tem : Qnil); diff --git a/src/nsterm.h b/src/nsterm.h index 2616dacc3e2..2abf402f8bc 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1236,6 +1236,7 @@ extern void ns_set_no_accept_focus (struct frame *f, Lisp_Object new_value, extern void ns_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value); #ifdef NS_IMPL_COCOA +extern void ns_set_appearance_1 (struct frame *f, Lisp_Object value); extern void ns_set_appearance (struct frame *f, Lisp_Object new_value, Lisp_Object old_value); extern void ns_set_transparent_titlebar (struct frame *f, diff --git a/src/nsterm.m b/src/nsterm.m index 46bb3f5dd7a..5514a693c86 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1931,6 +1931,17 @@ ns_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) } #ifdef NS_IMPL_COCOA +void +ns_set_appearance_1 (struct frame *f, Lisp_Object new_value) +{ + if (EQ (new_value, Qdark)) + FRAME_NS_APPEARANCE (f) = ns_appearance_vibrant_dark; + else if (EQ (new_value, Qlight)) + FRAME_NS_APPEARANCE (f) = ns_appearance_aqua; + else + FRAME_NS_APPEARANCE (f) = ns_appearance_system_default; +} + void ns_set_appearance (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { @@ -1943,12 +1954,7 @@ ns_set_appearance (struct frame *f, Lisp_Object new_value, Lisp_Object old_value if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10) return; - if (EQ (new_value, Qdark)) - FRAME_NS_APPEARANCE (f) = ns_appearance_vibrant_dark; - else if (EQ (new_value, Qlight)) - FRAME_NS_APPEARANCE (f) = ns_appearance_aqua; - else - FRAME_NS_APPEARANCE (f) = ns_appearance_system_default; + ns_set_appearance_1 (f, new_value); [window setAppearance]; #endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 */ From aa12cebaa684d7b3ea7e131666d33bcc71b45625 Mon Sep 17 00:00:00 2001 From: Stephen Gildea Date: Sat, 22 Mar 2025 17:07:05 -0700 Subject: [PATCH 4/4] Consistent wording in top-level headers in NEWS.19 * etc/NEWS.19: Put the word "Emacs" in front of each version number. This change lets 'help-fns--first-release' parse the headers, which produces more accurate "probably introduced at" versions from 'describe-function' and 'describe-variable'. --- etc/NEWS.19 | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/etc/NEWS.19 b/etc/NEWS.19 index 0a1ef56c0fb..2ee6f95c820 100644 --- a/etc/NEWS.19 +++ b/etc/NEWS.19 @@ -3149,7 +3149,7 @@ tempo.el Template insertion with hotspots. -* User Editing Changes in 19.23. +* User Editing Changes in Emacs 19.23 ** Emacs 19.23 uses Ispell version 3. @@ -4021,7 +4021,7 @@ by building Emacs. ** New macro 'easy-menu-define' -* Changes in 19.22. +* Changes in Emacs 19.22 ** The mouse click M-mouse-2 now inserts the current secondary selection (from Emacs or any other X client) where you click. @@ -4085,7 +4085,7 @@ different properties. -* User editing changes in version 19.21. +* User editing changes in Emacs 19.21 ** ISO Accents mode supports four additional characters: A-with-ring (entered as /A), AE ligature (entered as /E), @@ -4093,7 +4093,7 @@ and their lower-case equivalents. -* User editing changes in version 19.20. +* User editing changes in Emacs 19.20 (See following page for Lisp programming changes.) Note that some of these changes were made subsequent to the Emacs 19.20 @@ -4493,7 +4493,7 @@ Emacs command history. -* Changes in version 19.19. +* Changes in Emacs 19.19 ** The new package bookmark.el records named bookmarks: positions that you can jump to. Bookmarks are saved automatically between Emacs @@ -4527,7 +4527,7 @@ inconsistent with integer `%'. -* Changes in version 19.18. +* Changes in Emacs 19.18 ** Typing C-z in an iconified Emacs frame now deiconifies it. @@ -4669,7 +4669,7 @@ minibuffer window, and returns t if the window is currently active. -* Changes in version 19.17. +* Changes in Emacs 19.17 ** When Emacs displays a list of completions in a buffer, you can select a completion by clicking mouse button 2 @@ -4857,7 +4857,7 @@ argument FRAME, which specifies which frames it should affect. -* Changes in version 19.16. +* Changes in Emacs 19.16 ** When dragging the mouse to select a region, Emacs now highlights the region as you drag (if Transient Mark mode is enabled). If you @@ -4984,7 +4984,7 @@ already thus enclosed. -* Changes in version 19.15. +* Changes in Emacs 19.15 ** 'make-frame-visible', which uniconified frames, is now a command, and thus may be bound to a key. This makes sense because frames @@ -5032,7 +5032,7 @@ and thus didn't document it.) -* Changes in version 19.14. +* Changes in Emacs 19.14 ** To modify read-only text, bind the variable 'inhibit-read-only' to a non-nil value. If the value is t, then all reasons that might @@ -5078,7 +5078,7 @@ If you specify BEG or END, then the argument VISIT must be nil. -* Changes in version 19.13. +* Changes in Emacs 19.13 ** Magic file names can now handle the 'load' operation. @@ -5098,14 +5098,14 @@ We may move them again for greater consistency with other modes. -* Changes in version 19.12. +* Changes in Emacs 19.12 ** You can now make many of the sort commands ignore case by setting 'sort-fold-case' to a non-nil value. -* Changes in version 19.11. +* Changes in Emacs 19.11 ** Supercite is installed. @@ -5124,7 +5124,7 @@ it writes a file in the usual way. -* Changes in version 19.10. +* Changes in Emacs 19.10 ** The command 'repeat-complex-command' is now on C-x ESC ESC. It used to be bound to C-x ESC. @@ -5138,7 +5138,7 @@ using X). -* Changes in version 19.8. +* Changes in Emacs 19.8 ** It is now simpler to tell Emacs to display accented characters under X windows. M-x standard-display-european toggles the display of @@ -5184,7 +5184,7 @@ If the optional arguments FACE and FRAME are specified, then -* Changes in version 19. +* Changes in Emacs 19.1 ** When you kill buffers, Emacs now returns memory to the operating system, thus reducing the size of the Emacs process. All the space that you free