emacs-diffs
[Top][All Lists]
Advanced

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

feature/android 8f87af4237d: Merge remote-tracking branch 'origin/master


From: Po Lu
Subject: feature/android 8f87af4237d: Merge remote-tracking branch 'origin/master' into feature/android
Date: Tue, 27 Jun 2023 20:30:01 -0400 (EDT)

branch: feature/android
commit 8f87af4237df02355cc4b4e9d0f73bf1c90210fa
Merge: 93d431f0048 28b7745c677
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge remote-tracking branch 'origin/master' into feature/android
---
 lisp/dired.el                         | 12 ++++------
 lisp/emacs-lisp/bytecomp.el           |  5 ++--
 lisp/misc.el                          |  6 +++--
 lisp/progmodes/cc-engine.el           | 44 +++++++++++++++++++++++++----------
 test/lisp/emacs-lisp/cl-macs-tests.el |  6 +++--
 5 files changed, 47 insertions(+), 26 deletions(-)

diff --git a/lisp/dired.el b/lisp/dired.el
index 914d0a0e783..b4cfaa1842f 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1632,6 +1632,7 @@ In other cases, DIR should be a directory name or a 
directory filename.
 If HDR is non-nil, insert a header line with the directory name."
   (let ((opoint (point))
        (process-environment (copy-sequence process-environment))
+        (remotep (file-remote-p dir))
        end)
     (if (and
         ;; Don't try to invoke `ls' if we are on DOS/Windows where
@@ -1641,7 +1642,7 @@ If HDR is non-nil, insert a header line with the 
directory name."
                   (null ls-lisp-use-insert-directory-program)))
          ;; FIXME: Big ugly hack for Eshell's eshell-ls-use-in-dired.
          (not (bound-and-true-p eshell-ls-use-in-dired))
-        (or (file-remote-p dir)
+        (or remotep
              (if (eq dired-use-ls-dired 'unspecified)
                 ;; Check whether "ls --dired" gives exit code 0, and
                 ;; save the answer in `dired-use-ls-dired'.
@@ -1656,19 +1657,14 @@ see `dired-use-ls-dired' for more details.")
         ;; Use -N with --dired, to countermand possible non-default
         ;; quoting style, in particular via the environment variable
         ;; QUOTING_STYLE.
-       (setq switches (concat "--dired -N " switches)))
+        (unless remotep
+         (setq switches (concat "--dired -N " switches))))
     ;; Expand directory wildcards and fill file-list.
     (let ((dir-wildcard (insert-directory-wildcard-in-dir-p dir)))
       (cond (dir-wildcard
              (setq switches (concat "-d " switches))
-             ;; We don't know whether the remote ls supports
-             ;; "--dired", so we cannot add it to the `process-file'
-             ;; call for wildcards.
-             (when (file-remote-p dir)
-               (setq switches (string-replace "--dired -N" "" switches)))
              (let* ((default-directory (car dir-wildcard))
                     (script (format "ls %s %s" switches (cdr dir-wildcard)))
-                    (remotep (file-remote-p dir))
                     (sh (or (and remotep "/bin/sh")
                             (executable-find shell-file-name)
                             (executable-find "sh")))
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 659d698b603..99202185d8d 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -3473,8 +3473,9 @@ lambda-expression."
                              run-hook-with-args-until-failure))
           (pcase (cdr form)
             (`(',var . ,_)
-             (when (memq var byte-compile-lexical-variables)
-               (byte-compile-report-error
+             (when (and (memq var byte-compile-lexical-variables)
+                        (byte-compile-warning-enabled-p 'lexical var))
+               (byte-compile-warn
                 (format-message "%s cannot use lexical var `%s'" fn var))))))
         ;; Warn about using obsolete hooks.
         (if (memq fn '(add-hook remove-hook))
diff --git a/lisp/misc.el b/lisp/misc.el
index 81769696f95..de82b97fa6f 100644
--- a/lisp/misc.el
+++ b/lisp/misc.el
@@ -71,13 +71,15 @@ Also see the `copy-from-above-command' command."
   (interactive "p")
   (unless n
     (setq n 1))
-  (let ((line (buffer-substring (line-beginning-position) 
(line-end-position))))
+  (let ((line (concat (buffer-substring (line-beginning-position)
+                                        (line-end-position))
+                      "\n")))
     (save-excursion
       (forward-line 1)
       (unless (bolp)
         (insert "\n"))
       (dotimes (_ n)
-        (insert line "\n")))))
+        (insert line)))))
 
 (declare-function rectangle--duplicate-right "rect" (n))
 
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index c4ae8aadd65..721daf9d53f 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -12997,11 +12997,19 @@ comment at the start of cc-engine.el for more info."
 (defvar c-laomib-cache nil)
 (make-variable-buffer-local 'c-laomib-cache)
 
-(defun c-laomib-get-cache (containing-sexp)
-  ;; Get an element from `c-laomib-cache' matching CONTAINING-SEXP.
+(defun c-laomib-get-cache (containing-sexp start)
+  ;; Get an element from `c-laomib-cache' matching CONTAINING-SEXP, and which
+  ;; is suitable for start postiion START.
   ;; Return that element or nil if one wasn't found.
-  (let ((elt (assq containing-sexp c-laomib-cache)))
-    (when elt
+  (let ((ptr c-laomib-cache)
+       elt)
+    (while
+       (and ptr
+            (setq elt (car ptr))
+            (or (not (eq (car elt) containing-sexp))
+                (< start (car (cddr elt)))))
+      (setq ptr (cdr ptr)))
+    (when ptr
       ;; Move the fetched `elt' to the front of the cache.
       (setq c-laomib-cache (delq elt c-laomib-cache))
       (push elt c-laomib-cache)
@@ -13013,18 +13021,26 @@ comment at the start of cc-engine.el for more info."
   ;; the components of the new element (see comment for `c-laomib-cache').
   ;; The return value is of no significance.
   (when lim
-    (let ((old-elt (assq lim c-laomib-cache))
-         ;; (elt (cons containing-sexp (cons start nil)))
+    (let (old-elt
          (new-elt (list lim start end result))
          big-ptr
          (cur-ptr c-laomib-cache)
-         togo (size 0) cur-size
-         )
-      (if old-elt (setq c-laomib-cache (delq old-elt c-laomib-cache)))
+         togo (size 0) cur-size)
+
+      ;; If there is an elt which overlaps with the new element, remove it.
+      (while
+         (and cur-ptr
+              (setq old-elt (car cur-ptr))
+              (or (not (eq (car old-elt) lim))
+                  (not (and (> start (car (cddr old-elt)))
+                            (<= start (cadr old-elt))))))
+       (setq cur-ptr (cdr cur-ptr)))
+      (when (and cur-ptr old-elt)
+       (setq c-laomib-cache (delq old-elt c-laomib-cache)))
 
       (while (>= (length c-laomib-cache) 4)
        ;; We delete the least recently used elt which doesn't enclose START,
-       ;; or..
+       ;; or ...
        (dolist (elt c-laomib-cache)
          (if (or (<= start (cadr elt))
                  (> start (car (cddr elt))))
@@ -13032,8 +13048,10 @@ comment at the start of cc-engine.el for more info."
 
        ;; ... delete the least recently used elt which isn't the biggest.
        (when (not togo)
+         (setq cur-ptr c-laomib-cache)
          (while (cdr cur-ptr)
-           (setq cur-size (- (nth 2 (cadr cur-ptr)) (car (cadr cur-ptr))))
+           (setq cur-size (- (cadr (cadr cur-ptr))
+                             (car (cddr (cadr cur-ptr)))))
            (when (> cur-size size)
              (setq size cur-size
                    big-ptr cur-ptr))
@@ -13225,7 +13243,7 @@ comment at the start of cc-engine.el for more info."
        (goto-char pos)
        (when (eq braceassignp 'dontknow)
          (let* ((cache-entry (and containing-sexp
-                                  (c-laomib-get-cache containing-sexp)))
+                                  (c-laomib-get-cache containing-sexp pos)))
                 (lim2 (or (cadr cache-entry) lim))
                 sub-bassign-p)
            (if cache-entry
@@ -13247,6 +13265,8 @@ comment at the start of cc-engine.el for more info."
                                            )
                        (setq braceassignp (nth 3 cache-entry))
                        (goto-char (nth 2 cache-entry)))
+                   (c-laomib-put-cache containing-sexp
+                                       start (point) sub-bassign-p)
                    (setq braceassignp sub-bassign-p)))
                 (t))
 
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el 
b/test/lisp/emacs-lisp/cl-macs-tests.el
index 01ca56386e3..983cbfc8bc7 100644
--- a/test/lisp/emacs-lisp/cl-macs-tests.el
+++ b/test/lisp/emacs-lisp/cl-macs-tests.el
@@ -812,8 +812,10 @@ See Bug#57915."
   ;; In ELisp function arguments are always statically scoped (bug#47552).
   (let ((cl--test-a 'dyn)
         ;; FIXME: How do we silence the "Lexical argument shadows" warning?
-        (f (cl-function (lambda (&key cl--test-a b)
-                          (list cl--test-a (symbol-value 'cl--test-a) b)))))
+        (f
+         (with-suppressed-warnings ((lexical cl--test-a))
+           (cl-function (lambda (&key cl--test-a b)
+                          (list cl--test-a (symbol-value 'cl--test-a) b))))))
     (should (equal (funcall f :cl--test-a 'lex :b 2) '(lex dyn 2)))))
 
 (cl-defstruct cl--test-s



reply via email to

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