commit 85a9b916db126add5a5e2bf4b2b9531ab998cad4 (HEAD, refs/remotes/origin/master) Author: Paul Nelson Date: Sat Feb 22 23:12:41 2025 +0100 Add :continue-only directive to bind-keys and use-package * lisp/bind-key.el (bind-keys-form): Add :continue-only binding. Fix indentation. * lisp/use-package/use-package-bind-key.el (use-package-normalize-binder): Add check for :continue-only. * test/lisp/repeat-tests.el (repeat-tests-bind-keys): Enable (and correct) test for :continue-only (bug#74140). diff --git a/etc/NEWS b/etc/NEWS index 7a5b96b5eae..a59a1a3017d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1653,8 +1653,9 @@ will be calculated based on the window width. A command with this symbol property whose value is a list of repeat maps will not activate the repeat map in 'repeat-mode'. It will only continue the already activated repeating sequence. Also 'defvar-keymap' -supports a new keyword ':continue' with a list of commands that -only continue the active repeating sequence. +supports a new keyword ':continue' with a list of commands that only +continue the active repeating sequence, and the 'use-package' and +'bind-keys' macros supports a similar keyword ':continue-only'. ** New function 'completion-table-with-metadata'. It offers a more concise way to create a completion table with metadata. diff --git a/lisp/bind-key.el b/lisp/bind-key.el index 66cb542d0b4..12417106783 100644 --- a/lisp/bind-key.el +++ b/lisp/bind-key.el @@ -290,6 +290,9 @@ Accepts keyword arguments: same behavior as if no special keyword had been used (that is, the command is bound, and it's `repeat-map' property set) +:continue-only BINDINGS - Within the scope of `:repeat-map', will make + the command continue but not enter the repeat + map, via the `repeat-continue' property :filter FORM - optional form to determine when bindings apply The rest of the arguments are conses of keybinding string and a @@ -325,11 +328,8 @@ function symbol (unquoted)." override-global-map)))) (setq repeat-map (cadr args)) (setq map repeat-map)) - ((eq :continue (car args)) - (setq repeat-type :continue - arg-change-func 'cdr)) - ((eq :exit (car args)) - (setq repeat-type :exit + ((memq (car args) '(:continue :continue-only :exit)) + (setq repeat-type (car args) arg-change-func 'cdr)) ((eq :prefix (car args)) (setq prefix (cadr args))) @@ -348,7 +348,7 @@ function symbol (unquoted)." (when repeat-type (unless repeat-map - (error ":continue and :exit require specifying :repeat-map"))) + (error ":continue(-only) and :exit require specifying :repeat-map"))) (when (and menu-name (not prefix)) (error "If :menu-name is supplied, :prefix must be too")) @@ -369,14 +369,14 @@ function symbol (unquoted)." (cl-flet ((wrap (map bindings) - (if (and map pkg (not (memq map '(global-map - override-global-map)))) - `((if (boundp ',map) - ,(macroexp-progn bindings) - (eval-after-load - ,(if (symbolp pkg) `',pkg pkg) - ',(macroexp-progn bindings)))) - bindings))) + (if (and map pkg (not (memq map '(global-map + override-global-map)))) + `((if (boundp ',map) + ,(macroexp-progn bindings) + (eval-after-load + ,(if (symbolp pkg) `',pkg pkg) + ',(macroexp-progn bindings)))) + bindings))) (append (when prefix-map @@ -401,9 +401,18 @@ function symbol (unquoted)." ;; Only needed in this branch, since when ;; repeat-map is non-nil, map is always ;; non-nil - `(,@(when (and repeat-map (not (eq repeat-type :exit))) - `((put ,fun 'repeat-map ',repeat-map))) - (bind-key ,(car form) ,fun ,map ,filter)) + (if (eq repeat-type :continue-only) + `((unless (memq ',repeat-map + (or (get ,fun 'repeat-continue) + '())) + (put ,fun 'repeat-continue + (append (or (get ,fun 'repeat-continue) + '()) + (list ',repeat-map)))) + (bind-key ,(car form) ,fun ,map ,filter)) + `(,@(when (and repeat-map (not (eq repeat-type :exit))) + `((put ,fun 'repeat-map ',repeat-map))) + (bind-key ,(car form) ,fun ,map ,filter))) `((bind-key ,(car form) ,fun nil ,filter)))))) first)) (when next diff --git a/lisp/use-package/use-package-bind-key.el b/lisp/use-package/use-package-bind-key.el index 396a1b3a2a1..19dc7e71f7a 100644 --- a/lisp/use-package/use-package-bind-key.el +++ b/lisp/use-package/use-package-bind-key.el @@ -88,14 +88,13 @@ deferred until the prefix key sequence is pressed." ;; :filter SEXP ;; :menu-name STRING ;; :package SYMBOL - ;; :continue and :exit are used within :repeat-map + ;; :continue(-only) and :exit are used within :repeat-map ((or (and (eq x :map) (symbolp (cadr arg))) (and (eq x :prefix) (stringp (cadr arg))) (and (eq x :prefix-map) (symbolp (cadr arg))) (and (eq x :prefix-docstring) (stringp (cadr arg))) - (and (eq x :repeat-map) (symbolp (cadr arg))) - (eq x :continue) - (eq x :exit) + (and (eq x :repeat-map) (symbolp (cadr arg))) + (memq x '(:continue :continue-only :exit)) (and (eq x :repeat-docstring) (stringp (cadr arg))) (eq x :filter) (and (eq x :menu-name) (stringp (cadr arg))) diff --git a/test/lisp/repeat-tests.el b/test/lisp/repeat-tests.el index 8e564b3e081..bfa838d383b 100644 --- a/test/lisp/repeat-tests.el +++ b/test/lisp/repeat-tests.el @@ -269,7 +269,7 @@ ("C-M-a" . repeat-tests-bind-call-a) ("C-M-o" . repeat-tests-bind-call-o) :repeat-map repeat-tests-bind-keys-repeat-map - :continue + :continue-only ("c" . repeat-tests-bind-call-c) ;; :continue ("C-M-o" . repeat-tests-bind-call-o) @@ -287,9 +287,9 @@ "C-M-a c C-M-o c z" '((1 a) (1 c) (1 o) (1 c)) "z") ;; 'C-M-o' should not activate - ;; (repeat-tests--check - ;; "C-M-o c z" - ;; '((1 o)) "cz") + (repeat-tests--check + "C-M-o c z" + '((1 o)) "cz") ;; 'q' should exit (repeat-tests--check "C-M-a c q c" commit 3de9994b9e7acf2a05e6b661a7cd440b7cb0365b Author: Gerd Möllmann Date: Thu Feb 27 06:56:02 2025 +0100 * src/dispnew.c (rect_intersect): Fix a typo (bug#76592) diff --git a/src/dispnew.c b/src/dispnew.c index cd0ed7e6414..511cf5634e5 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3293,7 +3293,7 @@ rect_intersect (struct rect *r, struct rect r1, struct rect r2) int w = min (r1.x + r1.w, r2.x + r2.w) - x; int h = min (r1.y + r1.h, r2.y + r2.h) - y; - if (w == 0 || h == 0) + if (w <= 0 || h <= 0) return false; *r = (struct rect) { .x = x, .y = y, .w = w, .h = h }; commit 0285a403e339bc5973f220a5f8a9693a359fe7ca Author: Eshel Yaron Date: Wed Feb 26 21:14:37 2025 +0100 ; * lisp/completion-preview.el: Add some commentary. Clarify the relation of Completion Preview mode with 'completion-at-point' and in-buffer completion interfaces. diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el index 2fe336c0a73..4fc9bb0c9f3 100644 --- a/lisp/completion-preview.el +++ b/lisp/completion-preview.el @@ -32,6 +32,15 @@ ;; the buffer. Completion Preview mode continues to update the ;; suggestion as you type according to the text around point. ;; +;; Completion Preview mode uses `completion-at-point-functions' to find +;; relevant completion suggestions, similarly to `completion-at-point'. +;; You can use `completion-at-point' with your favorite in-buffer +;; completion interface together with Completion Preview mode, just +;; invoke `completion-at-point' as usual when you want to see all +;; currently available completions. Another reason to invoke +;; `completion-at-point' is when you want non-prefix completion, since +;; Completion Preview mode only shows one prefix completion. +;; ;; The commands `completion-preview-next-candidate' and ;; `completion-preview-prev-candidate' allow you to cycle the ;; completion candidate that the preview suggests. These commands commit 50cded9c5502f34218873b762066a03682075222 Author: Eshel Yaron Date: Wed Feb 26 20:41:09 2025 +0100 Add 'help-echo' hint to completion preview * lisp/completion-preview.el (completion-preview--propertize-for-mouse): New function. * lisp/completion-preview.el (completion-preview--update) (completion-preview--show) (completion-preview-partial-insert) (completion-preview-complete) (completion-preview-next-candidate): Use it to propertize completion preview text with mouse-related properties, including a new 'help-echo' hint. diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el index f230dbe51a1..2fe336c0a73 100644 --- a/lisp/completion-preview.el +++ b/lisp/completion-preview.el @@ -373,6 +373,13 @@ Completion Preview mode avoids updating the preview after these commands.") (ensure-list completion-preview-adapt-background-color)))) completion-preview--overlay) +(defsubst completion-preview--propertize-for-mouse (str) + "`propertize' STR, a completion suggestion, with mouse-related properties." + (propertize str + 'mouse-face 'completion-preview-highlight + 'help-echo "click to accept, scroll to cycle" + 'keymap completion-preview--mouse-map)) + (defsubst completion-preview--get (prop) "Return property PROP of the completion preview overlay." (overlay-get completion-preview--overlay prop)) @@ -498,9 +505,8 @@ candidates or if there are multiple matching completions and 'completion-preview-exact)) common) (let ((ov (completion-preview--make-overlay - end (propertize (concat (substring common (- end beg)) suffix) - 'mouse-face 'completion-preview-highlight - 'keymap completion-preview--mouse-map)))) + end (completion-preview--propertize-for-mouse + (concat (substring common (- end beg)) suffix))))) (overlay-put ov 'completion-preview-beg beg) (overlay-put ov 'completion-preview-end end) (overlay-put ov 'completion-preview-index 0) @@ -557,9 +563,8 @@ point, otherwise hide it." (string-prefix-p (buffer-substring beg end) cand)) ;; The previous preview is still applicable, update it. (overlay-put (completion-preview--make-overlay - end (propertize (substring cand (- end beg)) - 'mouse-face 'completion-preview-highlight - 'keymap completion-preview--mouse-map)) + end (completion-preview--propertize-for-mouse + (substring cand (- end beg)))) 'completion-preview-end end) ;; The previous preview is no longer applicable, hide it. (completion-preview-active-mode -1)))) @@ -666,10 +671,8 @@ Beyond moving point, FUN should not modify the current buffer." (completion-preview--inhibit-update) (overlay-put (completion-preview--make-overlay (point) - (propertize - (substring aft (- (point) end)) - 'mouse-face 'completion-preview-highlight - 'keymap completion-preview--mouse-map)) + (completion-preview--propertize-for-mouse + (substring aft (- (point) end)))) 'completion-preview-end (point))) ;; If we kept nothing, do nothing. ))) @@ -748,9 +751,7 @@ completions list." ;; Otherwise, remove the common prefix from the preview. (completion-preview--inhibit-update) (overlay-put (completion-preview--make-overlay - pos (propertize - suf 'mouse-face 'completion-preview-highlight - 'keymap completion-preview--mouse-map)) + pos (completion-preview--propertize-for-mouse suf)) 'completion-preview-end pos)))))) (defun completion-preview-prev-candidate (n) @@ -792,9 +793,8 @@ prefix argument and defaults to 1." 'completion-preview 'completion-preview-exact)) suf) - (let ((aft (propertize (substring (concat com suf) (- end beg)) - 'mouse-face 'completion-preview-highlight - 'keymap completion-preview--mouse-map))) + (let ((aft (completion-preview--propertize-for-mouse + (substring (concat com suf) (- end beg))))) (add-text-properties 0 1 '(cursor 1) aft) (overlay-put completion-preview--overlay 'completion-preview-index new) (overlay-put completion-preview--overlay 'after-string aft)) commit 68f5518d00795c77dd8d48c2412f2fa9c0fed918 Author: Eshel Yaron Date: Wed Feb 26 20:11:20 2025 +0100 Simplify 'completion-preview-active-mode' command tagging * lisp/completion-preview.el (completion-preview-insert) (completion-preview-insert-word) (completion-preview-insert-sexp) (completion-preview-complete) (completion-preview-prev-candidate) (completion-preview-next-candidate): Use 'interactive' to associate command with 'completion-preview-active-mode' instead of using a bespoke 'completion-predicate' property. (completion-preview-active-p): Declare obsolete. diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el index 9bac9711331..f230dbe51a1 100644 --- a/lisp/completion-preview.el +++ b/lisp/completion-preview.el @@ -598,7 +598,7 @@ point, otherwise hide it." (defun completion-preview-insert () "Insert the completion candidate that the preview is showing." - (interactive) + (interactive nil completion-preview-active-mode) (completion-preview--barf-if-no-preview) (let* ((pre (completion-preview--get 'completion-preview-base)) (end (completion-preview--get 'completion-preview-end)) @@ -678,14 +678,14 @@ Beyond moving point, FUN should not modify the current buffer." "Insert the first N words of the current completion preview candidate. Interactively, N is the numeric prefix argument, and it defaults to 1." - (interactive "^p") + (interactive "^p" completion-preview-active-mode) (completion-preview-partial-insert #'forward-word n)) (defun completion-preview-insert-sexp (&optional n) "Insert the first N s-expressions of the current completion preview candidate. Interactively, N is the numeric prefix argument, and it defaults to 1." - (interactive "^p") + (interactive "^p" completion-preview-active-mode) (completion-preview-partial-insert #'forward-sexp n 'interactive)) (defun completion-preview-complete () @@ -696,7 +696,7 @@ common prefix to insert, it displays the list of matching completion candidates unless `completion-auto-help' is nil. If you repeat this command again when the completions list is visible, it scrolls the completions list." - (interactive) + (interactive nil completion-preview-active-mode) (completion-preview--barf-if-no-preview) (let* ((beg (completion-preview--get 'completion-preview-beg)) (end (completion-preview--get 'completion-preview-end)) @@ -758,7 +758,7 @@ completions list." If N is negative, cycle -N candidates forward. Interactively, N is the prefix argument and defaults to 1." - (interactive "p") + (interactive "p" completion-preview-active-mode) (completion-preview-next-candidate (- n))) (defun completion-preview-next-candidate (n) @@ -766,7 +766,7 @@ prefix argument and defaults to 1." If N is negative, cycle -N candidates backward. Interactively, N is the prefix argument and defaults to 1." - (interactive "p") + (interactive "p" completion-preview-active-mode) (when completion-preview-active-mode (let* ((beg (completion-preview--get 'completion-preview-beg)) (end (completion-preview--get 'completion-preview-end)) @@ -808,16 +808,10 @@ prefix argument and defaults to 1." The first argument, SYMBOL, is ignored. You can use this function as the `completion-predicate' property of commands that you define that should only be available when the completion preview is active." + (declare + (obsolete "check for `completion-preview-active-mode' instead." "31.1")) (buffer-local-value 'completion-preview-active-mode buffer)) -(dolist (cmd '(completion-preview-insert - completion-preview-insert-word - completion-preview-insert-sexp - completion-preview-complete - completion-preview-prev-candidate - completion-preview-next-candidate)) - (put cmd 'completion-predicate #'completion-preview-active-p)) - ;;;###autoload (define-minor-mode completion-preview-mode "Show in-buffer completion suggestions in a preview as you type. commit 8c165834913bb0dca214acc4b82ba1d9d4ac0a82 Author: Stefan Kangas Date: Wed Feb 26 18:11:22 2025 +0100 ; Whitespace fixes to silence git hooks diff --git a/admin/charsets/Makefile.in b/admin/charsets/Makefile.in index 4f366c829c9..3553f95336d 100644 --- a/admin/charsets/Makefile.in +++ b/admin/charsets/Makefile.in @@ -311,4 +311,3 @@ gen-clean: rm -f ${CHARSETS} ${SED_SCRIPT} ${TRANS_TABLE} ${srcdir}/charsets.stamp maintainer-clean: gen-clean distclean - diff --git a/doc/misc/org-setup.org b/doc/misc/org-setup.org index b567af30a2c..63cb9a4c654 100644 --- a/doc/misc/org-setup.org +++ b/doc/misc/org-setup.org @@ -50,4 +50,3 @@ # The "kbd" macro turns KBD into @kbd{KBD}. Additionally, it # encloses case-sensitive special keys (SPC, RET...) within @key{...}. #+macro: kbd (eval (org-texinfo-kbd-macro $1)) - diff --git a/etc/EGLOT-NEWS b/etc/EGLOT-NEWS index 20a2e694426..7b53d5943ba 100644 --- a/etc/EGLOT-NEWS +++ b/etc/EGLOT-NEWS @@ -777,4 +777,3 @@ bug-reference-bug-regexp: "\\(\\(github\\|bug\\)#\\([0-9]+\\)\\)" bug-reference-url-format: eglot--debbugs-or-github-bug-uri paragraph-separate: "[ ]" End: - diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 1446e04c3c4..493f6dcebb2 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1939,7 +1939,7 @@ casts and declarations are fontified. Used on level 2 and higher." (cons (match-end 1) (match-beginning 2))) string-delims (cons open-delim (c-get-ml-closer open-delim))) (goto-char (caar string-delims)))) - + ;; Point is in the body of an ml string. ((and string-delims (>= (point) (cadar string-delims)) diff --git a/src/intervals.c b/src/intervals.c index a6c7d938df7..8b2366a5581 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -2051,17 +2051,17 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos) if (! EQ (leave_before, enter_before) && !NILP (leave_before)) calln (leave_before, make_fixnum (old_position), - make_fixnum (charpos)); + make_fixnum (charpos)); if (! EQ (leave_after, enter_after) && !NILP (leave_after)) calln (leave_after, make_fixnum (old_position), - make_fixnum (charpos)); + make_fixnum (charpos)); if (! EQ (enter_before, leave_before) && !NILP (enter_before)) calln (enter_before, make_fixnum (old_position), - make_fixnum (charpos)); + make_fixnum (charpos)); if (! EQ (enter_after, leave_after) && !NILP (enter_after)) calln (enter_after, make_fixnum (old_position), - make_fixnum (charpos)); + make_fixnum (charpos)); } } diff --git a/src/term.c b/src/term.c index ba7b14de158..cd4c1f45426 100644 --- a/src/term.c +++ b/src/term.c @@ -3678,7 +3678,7 @@ tty_menu_help_callback (char const *help_string, int pane, int item) /* (menu-item MENU-NAME PANE-NUMBER) */ menu_object = list3 (Qmenu_item, pane_name, make_fixnum (pane)); show_help_echo (help_string ? build_string (help_string) : Qnil, - Qnil, menu_object, make_fixnum (item)); + Qnil, menu_object, make_fixnum (item)); } struct tty_pop_down_menu commit 5815bd52279fdedc752f9f92ace86f8243fbd604 Author: Stefan Monnier Date: Wed Feb 26 09:13:04 2025 -0500 (define-ibuffer-op): Minor tweak to Shipmints's patch * lisp/ibuf-macs.el (define-ibuffer-op): Evaluate `(active-)opstring` args when defining the operation rather than every time the operation is used. Move the `:autoload-end` marker back to the level of `progn`. diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el index 4595d24da11..22db912be52 100644 --- a/lisp/ibuf-macs.el +++ b/lisp/ibuf-macs.el @@ -221,19 +221,20 @@ buffer object. (defalias ',(intern (concat (if (string-match "^ibuffer-do" (symbol-name op)) "" "ibuffer-do-") (symbol-name op))) - (lambda ,args - ,(if (stringp documentation) - documentation - (format "%s marked buffers." (if (functionp active-opstring) - (funcall active-opstring) - active-opstring))) - ,(if (not (null interactive)) - `(interactive ,interactive) - '(interactive)) - (cl-assert (derived-mode-p 'ibuffer-mode)) - (setq ibuffer-did-modification nil) - (let ((,opstring-sym ,opstring) - (,active-opstring-sym ,active-opstring)) + (let ((,opstring-sym ,opstring) + (,active-opstring-sym ,active-opstring)) + (lambda ,args + ,(if (stringp documentation) + documentation + (format "%s marked buffers." (if (functionp active-opstring) + ;; FIXME: Unused? + (funcall active-opstring) + active-opstring))) + ,(if (not (null interactive)) + `(interactive ,interactive) + '(interactive)) + (cl-assert (derived-mode-p 'ibuffer-mode)) + (setq ibuffer-did-modification nil) (let ((marked-names (,(pcase mark (:deletion 'ibuffer-deletion-marked-buffer-names) @@ -243,7 +244,8 @@ buffer object. (cl-assert (get-text-property (line-beginning-position) 'ibuffer-properties) nil "No buffer on this line") - (setq marked-names (list (buffer-name (ibuffer-current-buffer)))) + (setq marked-names + (list (buffer-name (ibuffer-current-buffer)))) (ibuffer-set-mark ,(pcase mark (:deletion 'ibuffer-deletion-char) @@ -258,6 +260,7 @@ buffer object. `((ibuffer-redisplay t) (message (concat "Operation finished; " (if (functionp ,opstring-sym) + ;; FIXME: Unused? (funcall ,opstring-sym) ,opstring-sym) " %s %s") @@ -266,40 +269,42 @@ buffer object. (inner-body (if complex `(progn ,@body) `(progn - (with-current-buffer buf - (save-excursion - ,@body)) - t))) - (body `(let ((_ ,before) ; pre-operation form. - (count - (,(pcase mark - (:deletion - 'ibuffer-map-deletion-lines) - (_ - 'ibuffer-map-marked-lines)) - (lambda (buf mark) - ;; Silence warning for code that doesn't - ;; use `mark'. - (ignore mark) - ,(if (eq modifier-p :maybe) - `(let ((ibuffer-tmp-previous-buffer-modification - (buffer-modified-p buf))) - (prog1 ,inner-body - (when (not (eq ibuffer-tmp-previous-buffer-modification - (buffer-modified-p buf))) - (setq - ibuffer-did-modification t)))) - inner-body))))) - ,finish))) + (with-current-buffer buf + (save-excursion + ,@body)) + t))) + (body + `(let ((_ ,before) ; pre-operation form. + (count + (,(pcase mark + (:deletion + 'ibuffer-map-deletion-lines) + (_ + 'ibuffer-map-marked-lines)) + (lambda (buf mark) + ;; Silence warning for code that doesn't + ;; use `mark'. + (ignore mark) + ,(if (eq modifier-p :maybe) + `(let ((ibuffer-tmp-previous-buffer-modification + (buffer-modified-p buf))) + (prog1 ,inner-body + (unless (eq ibuffer-tmp-previous-buffer-modification + (buffer-modified-p buf)) + (setq + ibuffer-did-modification t)))) + inner-body))))) + ,finish))) (if dangerous `(when (ibuffer-confirm-operation-on (if (functionp ,active-opstring-sym) + ;; FIXME: Unused? (funcall ,active-opstring-sym) ,active-opstring-sym) marked-names) ,body) - body)))) - :autoload-end))))) + body)))))) + :autoload-end))) ;;;###autoload (cl-defmacro define-ibuffer-filter (name documentation commit 5d75c6e44da9f27d28ff60d5dee308f2247a1cf5 Author: shipmints Date: Mon Feb 24 17:45:54 2025 -0500 Improve 'define-ibuffer-op' macro (bug#76222) * lisp/ibuf-macs.el (define-ibuffer-op): Change defun to defalias and place it before the macro-local lets. * lisp/ibuffer.el: (ibuffer-do-toggle-lock): Remove declare-function. (ibuffer-do-toggle-read-only): Remove declare-function. (ibuffer-do-save): Remove declare-function. (ibuffer-do-delete): Remove declare-function. (ibuffer-do-toggle-modified): Remove declare-function. (ibuffer-do-kill-on-deletion-marks): Remove declare-function. diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el index 4a283420efd..4595d24da11 100644 --- a/lisp/ibuf-macs.el +++ b/lisp/ibuf-macs.el @@ -218,12 +218,10 @@ buffer object. (let ((opstring-sym (make-symbol "opstring")) (active-opstring-sym (make-symbol "active-opstring"))) `(progn - (let ((,opstring-sym ,opstring) - (,active-opstring-sym ,active-opstring)) - (defun ,(intern (concat (if (string-match "^ibuffer-do" (symbol-name op)) - "" "ibuffer-do-") - (symbol-name op))) - ,args + (defalias ',(intern (concat (if (string-match "^ibuffer-do" (symbol-name op)) + "" "ibuffer-do-") + (symbol-name op))) + (lambda ,args ,(if (stringp documentation) documentation (format "%s marked buffers." (if (functionp active-opstring) @@ -234,45 +232,47 @@ buffer object. '(interactive)) (cl-assert (derived-mode-p 'ibuffer-mode)) (setq ibuffer-did-modification nil) - (let ((marked-names (,(pcase mark - (:deletion - 'ibuffer-deletion-marked-buffer-names) - (_ - 'ibuffer-marked-buffer-names))))) - (when (null marked-names) - (cl-assert (get-text-property (line-beginning-position) - 'ibuffer-properties) - nil "No buffer on this line") - (setq marked-names (list (buffer-name (ibuffer-current-buffer)))) - (ibuffer-set-mark ,(pcase mark - (:deletion - 'ibuffer-deletion-char) - (_ - 'ibuffer-marked-char)))) - ,(let* ((finish (append - '(progn) - (if (eq modifier-p t) - '((setq ibuffer-did-modification t)) - ()) - (and after `(,after)) ; post-operation form. - `((ibuffer-redisplay t) - (message (concat "Operation finished; " - (if (functionp ,opstring-sym) - (funcall ,opstring-sym) - ,opstring-sym) - " %s %s") - count (ngettext "buffer" "buffers" - count))))) - (inner-body (if complex - `(progn ,@body) - `(progn + (let ((,opstring-sym ,opstring) + (,active-opstring-sym ,active-opstring)) + (let ((marked-names (,(pcase mark + (:deletion + 'ibuffer-deletion-marked-buffer-names) + (_ + 'ibuffer-marked-buffer-names))))) + (when (null marked-names) + (cl-assert (get-text-property (line-beginning-position) + 'ibuffer-properties) + nil "No buffer on this line") + (setq marked-names (list (buffer-name (ibuffer-current-buffer)))) + (ibuffer-set-mark ,(pcase mark + (:deletion + 'ibuffer-deletion-char) + (_ + 'ibuffer-marked-char)))) + ,(let* ((finish (append + '(progn) + (if (eq modifier-p t) + '((setq ibuffer-did-modification t)) + ()) + (and after `(,after)) ; post-operation form. + `((ibuffer-redisplay t) + (message (concat "Operation finished; " + (if (functionp ,opstring-sym) + (funcall ,opstring-sym) + ,opstring-sym) + " %s %s") + count (ngettext "buffer" "buffers" + count))))) + (inner-body (if complex + `(progn ,@body) + `(progn (with-current-buffer buf (save-excursion ,@body)) t))) - (body `(let ((_ ,before) ; pre-operation form. - (count - (,(pcase mark + (body `(let ((_ ,before) ; pre-operation form. + (count + (,(pcase mark (:deletion 'ibuffer-map-deletion-lines) (_ @@ -290,16 +290,16 @@ buffer object. (setq ibuffer-did-modification t)))) inner-body))))) - ,finish))) - (if dangerous - `(when (ibuffer-confirm-operation-on - (if (functionp ,active-opstring-sym) - (funcall ,active-opstring-sym) - ,active-opstring-sym) - marked-names) - ,body) - body)))) - :autoload-end)))) + ,finish))) + (if dangerous + `(when (ibuffer-confirm-operation-on + (if (functionp ,active-opstring-sym) + (funcall ,active-opstring-sym) + ,active-opstring-sym) + marked-names) + ,body) + body)))) + :autoload-end))))) ;;;###autoload (cl-defmacro define-ibuffer-filter (name documentation diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 53cf62b142b..95deb2db478 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -372,15 +372,6 @@ directory, like `default-directory'." (regexp :tag "From") (regexp :tag "To")))) -;; These declarations are here to avoid byte-compiler warnings about -;; functions defined later via 'define-ibuffer-op'. -(declare-function ibuffer-do-toggle-lock "ibuffer.el") -(declare-function ibuffer-do-toggle-read-only "ibuffer.el") -(declare-function ibuffer-do-save "ibuffer.el") -(declare-function ibuffer-do-delete "ibuffer.el") -(declare-function ibuffer-do-toggle-modified "ibuffer.el") -(declare-function ibuffer-do-kill-on-deletion-marks "ibuffer.el") - (defvar-keymap ibuffer--filter-map "RET" #'ibuffer-filter-by-mode "SPC" #'ibuffer-filter-chosen-by-completion commit 7ae069b676a19d9a477d629403e2ff236a5303af Author: Po Lu Date: Wed Feb 26 21:22:03 2025 +0800 ; * test/infra/android/test-controller.el: Fix typos. diff --git a/test/infra/android/test-controller.el b/test/infra/android/test-controller.el index f17d58e415e..38d486c3c02 100644 --- a/test/infra/android/test-controller.el +++ b/test/infra/android/test-controller.el @@ -2502,7 +2502,7 @@ Call this function from the command line, with, for example: (let ((nth 0)) (dolist (device devices) (message "%2d. %-24s(API level %d, %s)" - (incf nth) (car device) + (setq nth (1+ nth)) (car device) (ats-get-sdk-version (car device)) (ats-getprop (car device) "ro.product.cpu.abi")))) (let* ((number (string-to-number @@ -2511,10 +2511,10 @@ Call this function from the command line, with, for example: (device (if (or (< number 1) (> number (length devices))) (user-error "Invalid selection: %s" number) (car (nth (1- number) devices)))) - (users (ats-list-users device))) - (setq nth 0) + (users (ats-list-users device)) + (nth 0)) (dolist (user users) - (message "%2d. %s (id=%d)" (incf nth) + (message "%2d. %s (id=%d)" (setq nth (1+ nth)) (cadr user) (car user))) (setq number (string-to-number (read-string commit 67b444e2907da1a27fc2db64aae9b4dcf299f2d9 Author: Po Lu Date: Wed Feb 26 20:41:02 2025 +0800 ; New function for executing Android tests in batch mode * test/infra/android/test-controller.el (ats-execute-tests-batch): New function. diff --git a/test/infra/android/test-controller.el b/test/infra/android/test-controller.el index d318c9a0d4b..f17d58e415e 100644 --- a/test/infra/android/test-controller.el +++ b/test/infra/android/test-controller.el @@ -2482,6 +2482,73 @@ subject to SELECTOR, as in `ert-run-tests'." "Running tests..." (ats-run-test process test selector)))) + + +;; Batch mode text execution. +(defun ats-execute-tests-batch () + "Execute tests in batch mode, in the manner of `test/Makefile'. +Prompt for a device and execute tests on the same. Save log +files to a directory specified by the user. +Call this function from the command line, with, for example: + + $ emacs --batch -l test-controller.el -f ats-execute-tests-batch" + (let* ((ats-adb-host (getenv "ATS_ADB_HOST")) + (devices (ats-enumerate-devices + (lambda (name state _) + (and (equal state "device") + (ignore-errors + (ats-get-package-aid name "org.gnu.emacs"))))))) + (message "These devices are presently available for test execution:") + (let ((nth 0)) + (dolist (device devices) + (message "%2d. %-24s(API level %d, %s)" + (incf nth) (car device) + (ats-get-sdk-version (car device)) + (ats-getprop (car device) "ro.product.cpu.abi")))) + (let* ((number (string-to-number + (read-string + "Select a device by typing its number, and Return: "))) + (device (if (or (< number 1) (> number (length devices))) + (user-error "Invalid selection: %s" number) + (car (nth (1- number) devices)))) + (users (ats-list-users device))) + (setq nth 0) + (dolist (user users) + (message "%2d. %s (id=%d)" (incf nth) + (cadr user) (car user))) + (setq number (string-to-number + (read-string + "As which user should tests be executed? "))) + (when (or (< number 1) (> number (length users))) + (user-error "Invalid selection: %s" number)) + (let* ((user (car (nth (1- number) users))) + (connection (ats-connect device user))) + (ats-upload-all-tests + connection + (or ats-emacs-test-directory + (read-directory-name "Test base directory: " + nil nil t))) + (let ((output-directory + (read-directory-name + "Where to save test log files? "))) + (mkdir output-directory t) + (let ((tests (ats-list-tests connection))) + (dolist (test tests) + (message "Generating `%s/%s-test.log'" + output-directory test) + (ats-run-test connection test) + (let ((output-file + (concat (file-name-as-directory + output-directory) + test "-test.log"))) + (mkdir (file-name-directory output-file) t) + (with-current-buffer "*Test Output*" + (write-region (point-min) (point-max) + (concat (file-name-as-directory + output-directory) + test "-test.log")) + (erase-buffer)))))))))) + (provide 'test-controller) ;;; test-controller.el ends here commit 3e496fc31746517440285c2cd9f2b4a09c227d7b Author: Po Lu Date: Wed Feb 26 16:03:12 2025 +0800 Port Eshell tests to Android * test/infra/android/test-controller.el (ats-run-test): Run tests in a temp buffer. * test/lisp/eshell/em-alias-tests.el (ert, em-alias) (eshell-tests-helpers): * test/lisp/eshell/em-basic-tests.el (em-basic) (eshell-tests-helpers): * test/lisp/eshell/em-cmpl-tests.el (em-unix) (eshell-tests-helpers): * test/lisp/eshell/em-dirs-tests.el (em-dirs) (eshell-tests-helpers): * test/lisp/eshell/em-extpipe-tests.el (ert-x) (eshell-tests-helpers): * test/lisp/eshell/em-glob-tests.el (ert, eshell-tests-helpers): * test/lisp/eshell/em-hist-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/em-pred-tests.el (em-pred) (eshell-tests-helpers): * test/lisp/eshell/em-prompt-tests.el (em-prompt) (eshell-tests-helpers): * test/lisp/eshell/em-script-tests.el (em-script) (eshell-tests-helpers): * test/lisp/eshell/em-unix-tests.el (ert-x) (eshell-tests-helpers): * test/lisp/eshell/esh-arg-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/esh-cmd-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/esh-ext-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/esh-io-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/esh-mode-tests.el (em-prompt) (eshell-tests-helpers): * test/lisp/eshell/esh-proc-tests.el (em-prompt) (eshell-tests-helpers): * test/lisp/eshell/esh-util-tests.el (esh-util) (eshell-tests-helpers): * test/lisp/eshell/esh-var-tests.el (eshell) (eshell-tests-helpers): * test/lisp/eshell/eshell-tests.el (esh-mode) (eshell-tests-helpers): Load `eshell-tests-helpers' from the resource directory. * test/lisp/eshell/resources/eshell-tests-helpers.el: Move from `test/lisp/eshell'. diff --git a/test/infra/android/test-controller.el b/test/infra/android/test-controller.el index 89b9b93f7b1..d318c9a0d4b 100644 --- a/test/infra/android/test-controller.el +++ b/test/infra/android/test-controller.el @@ -2442,7 +2442,11 @@ Display the output of the tests executed in a buffer." (with-current-buffer temp-buffer (insert message "\n"))))) (let ((noninteractive t)) - (ert-run-tests-batch ',selector)) + ;; Prevent activation of the mark and + ;; other actions taken by the tests + ;; from affecting the test buffer. + (with-temp-buffer + (ert-run-tests-batch ',selector))) (insert "=== Test execution complete ===\n") (buffer-substring-no-properties (point-min) (point-max))))))) diff --git a/test/lisp/eshell/em-alias-tests.el b/test/lisp/eshell/em-alias-tests.el index 2386e04bbd3..51af80af148 100644 --- a/test/lisp/eshell/em-alias-tests.el +++ b/test/lisp/eshell/em-alias-tests.el @@ -24,14 +24,14 @@ ;;; Code: (require 'ert) +(require 'ert-x) (require 'esh-mode) (require 'eshell) (require 'em-alias) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) ;;; Tests: (ert-deftest em-alias-test/simple-alias () diff --git a/test/lisp/eshell/em-basic-tests.el b/test/lisp/eshell/em-basic-tests.el index ee2a624cf6f..cd141dc440e 100644 --- a/test/lisp/eshell/em-basic-tests.el +++ b/test/lisp/eshell/em-basic-tests.el @@ -25,11 +25,10 @@ (require 'ert) (require 'em-basic) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) ;;; Tests: diff --git a/test/lisp/eshell/em-cmpl-tests.el b/test/lisp/eshell/em-cmpl-tests.el index fcfcd76c862..df459533fb9 100644 --- a/test/lisp/eshell/em-cmpl-tests.el +++ b/test/lisp/eshell/em-cmpl-tests.el @@ -30,11 +30,10 @@ (require 'em-hist) (require 'em-tramp) (require 'em-unix) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defvar eshell-test-value nil) diff --git a/test/lisp/eshell/em-dirs-tests.el b/test/lisp/eshell/em-dirs-tests.el index ae3c19aa022..a3e2ad7287c 100644 --- a/test/lisp/eshell/em-dirs-tests.el +++ b/test/lisp/eshell/em-dirs-tests.el @@ -27,11 +27,10 @@ (require 'esh-mode) (require 'eshell) (require 'em-dirs) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) ;;; Tests: diff --git a/test/lisp/eshell/em-extpipe-tests.el b/test/lisp/eshell/em-extpipe-tests.el index ed7ed2a35b8..b2c55256341 100644 --- a/test/lisp/eshell/em-extpipe-tests.el +++ b/test/lisp/eshell/em-extpipe-tests.el @@ -27,11 +27,10 @@ (require 'cl-lib) (require 'ert) (require 'ert-x) +(require 'ert-x) (require 'em-extpipe) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defmacro em-extpipe-tests--deftest (name input &rest body) (declare (indent 2)) diff --git a/test/lisp/eshell/em-glob-tests.el b/test/lisp/eshell/em-glob-tests.el index 4bc32848518..fd5ef537a0b 100644 --- a/test/lisp/eshell/em-glob-tests.el +++ b/test/lisp/eshell/em-glob-tests.el @@ -25,12 +25,11 @@ (require 'tramp) (require 'ert) +(require 'ert-x) (require 'em-glob) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defvar eshell-prefer-lisp-functions) diff --git a/test/lisp/eshell/em-hist-tests.el b/test/lisp/eshell/em-hist-tests.el index f0bb4dd16c3..6288ae071dc 100644 --- a/test/lisp/eshell/em-hist-tests.el +++ b/test/lisp/eshell/em-hist-tests.el @@ -26,11 +26,10 @@ (require 'ert-x) (require 'em-hist) (require 'eshell) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (cl-defun em-hist-test/check-history-file (file-name expected &optional (expected-ring t)) diff --git a/test/lisp/eshell/em-pred-tests.el b/test/lisp/eshell/em-pred-tests.el index a050c6426e9..05ee5d4c4c3 100644 --- a/test/lisp/eshell/em-pred-tests.el +++ b/test/lisp/eshell/em-pred-tests.el @@ -28,11 +28,10 @@ (require 'eshell) (require 'em-glob) (require 'em-pred) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defvar eshell-test-value nil) diff --git a/test/lisp/eshell/em-prompt-tests.el b/test/lisp/eshell/em-prompt-tests.el index 62ad76f644b..73cd6b14478 100644 --- a/test/lisp/eshell/em-prompt-tests.el +++ b/test/lisp/eshell/em-prompt-tests.el @@ -26,11 +26,10 @@ (require 'ert) (require 'eshell) (require 'em-prompt) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defmacro em-prompt-test--with-multiline (&rest body) "Execute BODY with a multiline Eshell prompt." diff --git a/test/lisp/eshell/em-script-tests.el b/test/lisp/eshell/em-script-tests.el index 3259022957b..01dc5fd9a72 100644 --- a/test/lisp/eshell/em-script-tests.el +++ b/test/lisp/eshell/em-script-tests.el @@ -28,11 +28,10 @@ (require 'esh-mode) (require 'eshell) (require 'em-script) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defvar eshell-execute-file-output) diff --git a/test/lisp/eshell/em-unix-tests.el b/test/lisp/eshell/em-unix-tests.el index 59cd0034507..b8969c5568a 100644 --- a/test/lisp/eshell/em-unix-tests.el +++ b/test/lisp/eshell/em-unix-tests.el @@ -30,8 +30,9 @@ (defvar this-directory (file-name-directory (or load-file-name default-directory)))) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" this-directory)) + (ert-resource-file "eshell-tests-helpers")) ;;; Tests: diff --git a/test/lisp/eshell/esh-arg-tests.el b/test/lisp/eshell/esh-arg-tests.el index f498cf6674c..4c34711ec2e 100644 --- a/test/lisp/eshell/esh-arg-tests.el +++ b/test/lisp/eshell/esh-arg-tests.el @@ -26,11 +26,10 @@ (require 'ert) (require 'esh-mode) (require 'eshell) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defvar eshell-test-value nil) diff --git a/test/lisp/eshell/esh-cmd-tests.el b/test/lisp/eshell/esh-cmd-tests.el index 7c04749e7ec..25e6c0fda7c 100644 --- a/test/lisp/eshell/esh-cmd-tests.el +++ b/test/lisp/eshell/esh-cmd-tests.el @@ -26,11 +26,10 @@ (require 'ert) (require 'esh-mode) (require 'eshell) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defvar eshell-test-value nil) diff --git a/test/lisp/eshell/esh-ext-tests.el b/test/lisp/eshell/esh-ext-tests.el index 696e679ccec..c6f5c48ae3e 100644 --- a/test/lisp/eshell/esh-ext-tests.el +++ b/test/lisp/eshell/esh-ext-tests.el @@ -28,11 +28,10 @@ (require 'esh-mode) (require 'esh-ext) (require 'eshell) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) ;;; Tests: diff --git a/test/lisp/eshell/esh-io-tests.el b/test/lisp/eshell/esh-io-tests.el index 0b25ad812fa..d95b52297c7 100644 --- a/test/lisp/eshell/esh-io-tests.el +++ b/test/lisp/eshell/esh-io-tests.el @@ -23,11 +23,10 @@ (require 'ert-x) (require 'esh-mode) (require 'eshell) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defvar eshell-test-value nil) diff --git a/test/lisp/eshell/esh-mode-tests.el b/test/lisp/eshell/esh-mode-tests.el index 052f62d6b9b..b8023029369 100644 --- a/test/lisp/eshell/esh-mode-tests.el +++ b/test/lisp/eshell/esh-mode-tests.el @@ -28,11 +28,10 @@ (require 'eshell) (require 'em-banner) (require 'em-prompt) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) ;;; Tests: diff --git a/test/lisp/eshell/esh-proc-tests.el b/test/lisp/eshell/esh-proc-tests.el index 16f8d82e976..2ef8b9d7536 100644 --- a/test/lisp/eshell/esh-proc-tests.el +++ b/test/lisp/eshell/esh-proc-tests.el @@ -24,11 +24,10 @@ (require 'esh-mode) (require 'eshell) (require 'em-prompt) ; For `eshell-previous-prompt' +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defvar esh-proc-test--output-cmd (concat "sh -c '" diff --git a/test/lisp/eshell/esh-util-tests.el b/test/lisp/eshell/esh-util-tests.el index 6967dbcf012..39fc6288110 100644 --- a/test/lisp/eshell/esh-util-tests.el +++ b/test/lisp/eshell/esh-util-tests.el @@ -22,11 +22,10 @@ (require 'tramp) (require 'ert) (require 'esh-util) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) ;;; Tests: diff --git a/test/lisp/eshell/esh-var-tests.el b/test/lisp/eshell/esh-var-tests.el index 153f8418153..20575d93407 100644 --- a/test/lisp/eshell/esh-var-tests.el +++ b/test/lisp/eshell/esh-var-tests.el @@ -28,11 +28,10 @@ (require 'esh-mode) (require 'esh-var) (require 'eshell) +(require 'ert-x) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defvar eshell-test-value nil) (defvar eshell-test-begin nil) diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index 6565a4be65c..99e4528ab00 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -28,11 +28,10 @@ (require 'ert) (require 'ert-x) (require 'esh-mode) +(require 'ert-x) (require 'eshell) (require 'eshell-tests-helpers - (expand-file-name "eshell-tests-helpers" - (file-name-directory (or load-file-name - default-directory)))) + (ert-resource-file "eshell-tests-helpers")) (defvar eshell-test-value nil) (defvar eshell-command-output) diff --git a/test/lisp/eshell/eshell-tests-helpers.el b/test/lisp/eshell/resources/eshell-tests-helpers.el similarity index 100% rename from test/lisp/eshell/eshell-tests-helpers.el rename to test/lisp/eshell/resources/eshell-tests-helpers.el commit 86dd455e9c7402737e2c0c45190fabbf1d3ee8c1 Author: Mauro Aranda Date: Wed Feb 26 08:06:14 2025 -0300 Avoid display bugs after editable-field widgets * lisp/wid-edit.el (widget-specify-button): Don't add an invisible space before the button to avoid bugs that surface with the widget-field face. The Widget library is not the one that puts a :box attribute for the button face, and we can't control what library users put after editable-field widgets. (widget-specify-field): Rather, add the invisible space here, after the newline. That way, we protect whatever comes after the editable-field widget. (Bug#51550) diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 84e1cec24bc..7cf7ae43b73 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -427,7 +427,12 @@ the :notify function can't know the new value.") (overlay-put overlay 'local-map keymap) (overlay-put overlay 'face face) (overlay-put overlay 'follow-link follow-link) - (overlay-put overlay 'help-echo help-echo)) + (overlay-put overlay 'help-echo help-echo) + ;; Since the `widget-field' face has a :box attribute, we need to add + ;; some character with no face after the newline character, to avoid + ;; clashing with text that comes after the field and has a face with + ;; a :box attribute too. (Bug#51550) + (overlay-put overlay 'after-string #(" " 0 1 (invisible t)))) (setq to (1- to)) (setq rear-sticky t)) (let ((overlay (make-overlay from to nil nil rear-sticky))) @@ -468,8 +473,6 @@ the :notify function can't know the new value.") (widget-put widget :button-overlay overlay) (when (functionp help-echo) (setq help-echo 'widget-mouse-help)) - (overlay-put overlay 'before-string - (propertize " " 'invisible t 'face face)) (overlay-put overlay 'button widget) (overlay-put overlay 'keymap (widget-get widget :keymap)) (overlay-put overlay 'evaporate t)