emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b5edfdbf861: Merge branch 'emacs-29'


From: Stefan Monnier
Subject: master b5edfdbf861: Merge branch 'emacs-29'
Date: Fri, 24 Feb 2023 13:15:01 -0500 (EST)

branch: master
commit b5edfdbf8611a415b578ffc117be8c0b31a3c1a2
Merge: 5f38dcd43d7 b2ae4e77c74
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    Merge branch 'emacs-29'
---
 lisp/emacs-lisp/package-vc.el |  9 +++++----
 lisp/kmacro.el                |  8 +++++---
 lisp/progmodes/eglot.el       | 34 +++++++++++++++++++++++++++-------
 lisp/wdired.el                |  1 +
 test/lisp/kmacro-tests.el     | 14 ++++++++++++++
 test/lisp/wdired-tests.el     | 23 +++++++++++++++++++++++
 6 files changed, 75 insertions(+), 14 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index b753adcb8a0..ea2766b8dc4 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -309,7 +309,6 @@ asynchronously."
          (directory (file-name-concat
                      (or (package-desc-dir pkg-desc)
                          (expand-file-name name package-user-dir))
-                     (plist-get pkg-spec :lisp-dir)
                      (and-let* ((extras (package-desc-extras pkg-desc)))
                        (alist-get :lisp-dir extras))))
          (file (or (plist-get pkg-spec :main-file)
@@ -615,6 +614,10 @@ PKG-SPEC is a package specification, a property list 
describing
 how to fetch and build the package.  See `package-vc--archive-spec-alist'
 for details.  The optional argument REV specifies a specific revision to
 checkout.  This overrides the `:branch' attribute in PKG-SPEC."
+  (unless (eq (package-desc-kind pkg-desc) 'vc)
+    (let ((copy (copy-package-desc pkg-desc)))
+      (setf (package-desc-kind copy) 'vc
+            pkg-desc copy)))
   (pcase-let* (((map :lisp-dir) pkg-spec)
                (name (package-desc-name pkg-desc))
                (dirname (package-desc-full-name pkg-desc))
@@ -826,9 +829,7 @@ regular package, but it will not remove a VC package.
        rev)))
    ((and-let* ((desc (assoc package package-archive-contents #'string=)))
       (package-vc--unpack
-       (let ((copy (copy-package-desc (cadr desc))))
-         (setf (package-desc-kind copy) 'vc)
-         copy)
+       (cadr desc)
        (or (package-vc--desc->spec (cadr desc))
            (and-let* ((extras (package-desc-extras (cadr desc)))
                       (url (alist-get :url extras))
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 94d8794bd23..aec4b805474 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -377,10 +377,14 @@ and `kmacro-counter-format'.")
 (defvar kmacro-view-item-no 0)
 
 
+(autoload 'macro--string-to-vector "macros")
 (defun kmacro-ring-head ()
   "Return pseudo head element in macro ring."
   (and last-kbd-macro
-       (kmacro last-kbd-macro kmacro-counter kmacro-counter-format-start)))
+       (kmacro (if (stringp last-kbd-macro)
+                   (macro--string-to-vector last-kbd-macro)
+                 last-kbd-macro)
+               kmacro-counter kmacro-counter-format-start)))
 
 
 (defun kmacro-push-ring (&optional elt)
@@ -841,8 +845,6 @@ KEYS should be a vector or a string that obeys 
`key-valid-p'."
       (setq mac     (nth 0 mac)))
     (when (stringp mac)
       ;; `kmacro' interprets a string according to `key-parse'.
-      (require 'macros)
-      (declare-function macro--string-to-vector "macros")
       (setq mac (macro--string-to-vector mac)))
     (kmacro mac counter format)))
 
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 4a09da65e53..d0e899cbed5 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3492,12 +3492,15 @@ If NOERROR, return predicate, else erroring function."
 (defvar-local eglot--outstanding-inlay-hints-region (cons nil nil)
   "Jit-lock-calculated (FROM . TO) region with potentially outdated hints")
 
+(defvar-local eglot--outstanding-inlay-hints-last-region nil)
+
 (defvar-local eglot--outstanding-inlay-regions-timer nil
   "Helper timer for `eglot--update-hints'")
 
 (defun eglot--update-hints (from to)
   "Jit-lock function for Eglot inlay hints."
   (cl-symbol-macrolet ((region eglot--outstanding-inlay-hints-region)
+                       (last-region eglot--outstanding-inlay-hints-last-region)
                        (timer eglot--outstanding-inlay-regions-timer))
     (setcar region (min (or (car region) (point-max)) from))
     (setcdr region (max (or (cdr region) (point-min)) to))
@@ -3513,12 +3516,28 @@ If NOERROR, return predicate, else erroring function."
     ;; not introducing any more delay over jit-lock's timers.
     (when (= jit-lock-context-unfontify-pos (point-max))
       (if timer (cancel-timer timer))
-      (setq timer (run-at-time
-                   0 nil
-                   (lambda ()
-                     (eglot--update-hints-1 (max (car region) (point-min))
-                                            (min (cdr region) (point-max)))
-                     (setq region (cons nil nil) timer nil)))))))
+      (let ((buf (current-buffer)))
+        (setq timer (run-at-time
+                     0 nil
+                     (lambda ()
+                       (eglot--when-live-buffer buf
+                         ;; HACK: In some pathological situations
+                         ;; (Emacs's own coding.c, for example),
+                         ;; jit-lock is calling `eglot--update-hints'
+                         ;; repeatedly with same sequence of
+                         ;; arguments, which leads to
+                         ;; `eglot--update-hints-1' being called with
+                         ;; the same region repeatedly.  This happens
+                         ;; even if the hint-painting code does
+                         ;; nothing else other than widen, narrow,
+                         ;; move point then restore these things.
+                         ;; Possible Emacs bug, but this fixes it.
+                         (unless (equal last-region region)
+                           (eglot--update-hints-1 (max (car region) 
(point-min))
+                                                  (min (cdr region) 
(point-max)))
+                           (setq last-region region))
+                         (setq region (cons nil nil)
+                               timer nil)))))))))
 
 (defun eglot--update-hints-1 (from to)
   "Do most work for `eglot--update-hints', including LSP request."
@@ -3529,7 +3548,8 @@ If NOERROR, return predicate, else erroring function."
             (let ((ov (make-overlay (point) (point)))
                   (left-pad (and paddingLeft (not (memq (char-before) '(32 
9)))))
                   (right-pad (and paddingRight (not (memq (char-after) '(32 
9)))))
-                  (text (if (stringp label) label (plist-get label :value))))
+                  (text (if (stringp label)
+                            label (plist-get (elt label 0) :value))))
               (overlay-put ov 'before-string
                            (propertize
                             (concat (and left-pad " ") text (and right-pad " 
"))
diff --git a/lisp/wdired.el b/lisp/wdired.el
index 771458508e6..5572dcb32f3 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -455,6 +455,7 @@ non-nil means return old filename."
   (setq major-mode 'dired-mode)
   (setq mode-name "Dired")
   (dired-advertise)
+  (dired-hide-details-update-invisibility-spec)
   (remove-hook 'kill-buffer-hook #'wdired-check-kill-buffer t)
   (remove-hook 'before-change-functions #'wdired--before-change-fn t)
   (remove-hook 'after-change-functions #'wdired--restore-properties t)
diff --git a/test/lisp/kmacro-tests.el b/test/lisp/kmacro-tests.el
index 551fd8b60fc..a325220e8d9 100644
--- a/test/lisp/kmacro-tests.el
+++ b/test/lisp/kmacro-tests.el
@@ -614,6 +614,20 @@ This is a regression test for: Bug#3412, Bug#11817."
   (kmacro-tests-should-insert "bb"
     (kmacro-tests-simulate-command '(kmacro-tests-symbol-for-test))))
 
+;; Bug#61700 inserting named macro when the definition contains things
+;; that `key-parse' thinks are named keys
+(kmacro-tests-deftest kmacro-tests-name-last-macro-key-parse-syntax ()
+  "Name last macro can rebind a symbol it binds."
+  ;; Make sure our symbol is unbound.
+  (when (fboundp 'kmacro-tests-symbol-for-test)
+    (fmakunbound 'kmacro-tests-symbol-for-test))
+  (setplist 'kmacro-tests-symbol-for-test nil)
+  (kmacro-tests-define-macro "<b> hello </>")
+  (kmacro-name-last-macro 'kmacro-tests-symbol-for-test)
+  ;; Now run the function bound to the symbol.
+  (kmacro-tests-should-insert "<b> hello </>"
+    (kmacro-tests-simulate-command '(kmacro-tests-symbol-for-test))))
+
 (kmacro-tests-deftest kmacro-tests-store-in-register ()
   "Macro can be stored in and retrieved from a register."
   (use-local-map kmacro-tests-keymap)
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el
index 74c2449076f..897c6cd69a8 100644
--- a/test/lisp/wdired-tests.el
+++ b/test/lisp/wdired-tests.el
@@ -189,5 +189,28 @@ wdired-get-filename before and after editing."
               (wdired-finish-edit))
           (if buf (kill-buffer buf)))))))
 
+(ert-deftest wdired-test-bug61510 ()
+  "Test visibility of symlink target on leaving wdired-mode.
+When dired-hide-details-mode is enabled and
+dired-hide-details-hide-symlink-targets is non-nil (the default),
+the link target becomes invisible.  When wdired-mode is enabled
+the target becomes visible, but on returning to dired-mode, it
+should be invisible again."
+  (ert-with-temp-directory test-dir
+    (let ((buf (find-file-noselect test-dir))
+          ;; Default value is t, but set it anyway, to be sure.
+          (dired-hide-details-hide-symlink-targets t))
+      (unwind-protect
+          (with-current-buffer buf
+            (make-symbolic-link "bar" "foo")
+            (dired-hide-details-mode)
+            (should (memq 'dired-hide-details-link buffer-invisibility-spec))
+            (dired-toggle-read-only)
+            (should-not (memq 'dired-hide-details-link
+                              buffer-invisibility-spec))
+            (wdired-finish-edit)
+            (should (memq 'dired-hide-details-link buffer-invisibility-spec)))
+        (if buf (kill-buffer buf))))))
+
 (provide 'wdired-tests)
 ;;; wdired-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]