emacs-diffs
[Top][All Lists]
Advanced

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

feature/android 1d84b4b2865: Merge remote-tracking branch 'origin/master


From: Po Lu
Subject: feature/android 1d84b4b2865: Merge remote-tracking branch 'origin/master' into feature/android
Date: Sat, 1 Apr 2023 21:11:13 -0400 (EDT)

branch: feature/android
commit 1d84b4b28659b5f2cc60872ce095e3887bed6fdd
Merge: aeac57fbbd7 97e35b14987
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge remote-tracking branch 'origin/master' into feature/android
---
 etc/images/symbols/README               | 37 +++++++++++++++++++++++++++++++++
 etc/images/symbols/check-mark_16.svg    |  3 +++
 etc/images/symbols/chevron_down_16.svg  |  3 +++
 etc/images/symbols/chevron_left_16.svg  |  3 +++
 etc/images/symbols/chevron_right_16.svg |  3 +++
 etc/images/symbols/chevron_up_16.svg    |  3 +++
 etc/images/symbols/cross_16.svg         |  3 +++
 etc/images/symbols/cross_circle_16.svg  |  3 +++
 etc/images/symbols/menu_16.svg          |  3 +++
 etc/images/symbols/minus_16.svg         |  3 +++
 etc/images/symbols/minus_circle_16.svg  |  3 +++
 etc/images/symbols/plus_16.svg          |  3 +++
 etc/images/symbols/plus_circle_16.svg   |  3 +++
 etc/images/symbols/star_16.svg          |  3 +++
 etc/images/symbols/star_fill_16.svg     |  3 +++
 etc/images/symbols/star_half_16.svg     |  3 +++
 lisp/eshell/esh-cmd.el                  | 36 +++++++++++++++++++-------------
 src/fns.c                               | 13 ++++++------
 test/lisp/eshell/esh-cmd-tests.el       | 18 ++++++++++++++--
 19 files changed, 125 insertions(+), 24 deletions(-)

diff --git a/etc/images/symbols/README b/etc/images/symbols/README
new file mode 100644
index 00000000000..b2c7b8c3179
--- /dev/null
+++ b/etc/images/symbols/README
@@ -0,0 +1,37 @@
+This directory contains icons for some inline symbols.
+
+COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
+
+Files: *.svg
+Author: Yuan Fu <casouri@gmail.com>
+Copyright (C) 2023 Free Software Foundation, Inc.
+License: GNU General Public License version 3 or later (see COPYING)
+
+How I made these icons: I made them with Figma, and exported them into
+SVG. I made the shapes with vectors (SVG paths) rather than strokes,
+merged all the shapes into a single shape with union operation, and
+stripped filling attributes from the SVG files. This way the icons can
+be colored like normal text! I'm not exactly sure how it works, but as
+long as the icon uses SVG path, and there is only one path in the
+file, and there is no filling attributes, the icons can be colored as
+text.
+
+FWIW, this is the command I used to strip filling attributes:
+
+sed -i 's/fill="none"//g' <file>
+sed -i 's/fill="black"//g' <file>
+
+Naming: Use underscore to separate styles, dash are considered normal
+character so you can use it for names. End with the intended optical
+size for the icon.
+
+There should also be an order for all the keywords. Right now we have
+directions (left/right), circle, fill, and optical size. Among them,
+the order should be
+
+1. direction
+2. circle
+3. fill
+4. size
+
+E.g., arrow_right_circle_fill_16.
\ No newline at end of file
diff --git a/etc/images/symbols/check-mark_16.svg 
b/etc/images/symbols/check-mark_16.svg
new file mode 100644
index 00000000000..10bf765f4d2
--- /dev/null
+++ b/etc/images/symbols/check-mark_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path d="M6.58449 9.82778L3.75736 6.99807L2.3425 8.41164L6.58321 
12.6562L13.6575 5.58837L12.2439 4.17351L6.58449 9.82778Z" />
+</svg>
diff --git a/etc/images/symbols/chevron_down_16.svg 
b/etc/images/symbols/chevron_down_16.svg
new file mode 100644
index 00000000000..016e4a5720e
--- /dev/null
+++ b/etc/images/symbols/chevron_down_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path d="M14 4.5L14 7L8 12L2 7L2 4.5L8 9.5L14 4.5Z" />
+</svg>
diff --git a/etc/images/symbols/chevron_left_16.svg 
b/etc/images/symbols/chevron_left_16.svg
new file mode 100644
index 00000000000..84ca3e28d8f
--- /dev/null
+++ b/etc/images/symbols/chevron_left_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path d="M11.5 2H9L4 8L9 14H11.5L6.5 8L11.5 2Z" />
+</svg>
diff --git a/etc/images/symbols/chevron_right_16.svg 
b/etc/images/symbols/chevron_right_16.svg
new file mode 100644
index 00000000000..9ad6e1bf328
--- /dev/null
+++ b/etc/images/symbols/chevron_right_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path d="M4.5 2H7L12 8L7 14H4.5L9.5 8L4.5 2Z" />
+</svg>
diff --git a/etc/images/symbols/chevron_up_16.svg 
b/etc/images/symbols/chevron_up_16.svg
new file mode 100644
index 00000000000..1c4b9c47622
--- /dev/null
+++ b/etc/images/symbols/chevron_up_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path d="M2 11.5L2 9L8 4L14 9L14 11.5L8 6.5L2 11.5Z" />
+</svg>
diff --git a/etc/images/symbols/cross_16.svg b/etc/images/symbols/cross_16.svg
new file mode 100644
index 00000000000..f210cf230b6
--- /dev/null
+++ b/etc/images/symbols/cross_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path d="M5.17157 3.75736L3.75736 5.17157L6.58579 8L3.75736 10.8284L5.17157 
12.2426L8 9.41421L10.8284 12.2426L12.2426 10.8284L9.41421 8L12.2426 
5.17157L10.8284 3.75736L8 6.58579L5.17157 3.75736Z" />
+</svg>
diff --git a/etc/images/symbols/cross_circle_16.svg 
b/etc/images/symbols/cross_circle_16.svg
new file mode 100644
index 00000000000..1c05c7d8611
--- /dev/null
+++ b/etc/images/symbols/cross_circle_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M15 8C15 11.866 11.866 15 8 
15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM13 
8C13 10.7614 10.7614 13 8 13C5.23858 13 3 10.7614 3 8C3 5.23858 5.23858 3 8 
3C10.7614 3 13 5.23858 13 8ZM9.76777 4.81802L11.182 6.23223L9.41421 8L11.182 
9.76777L9.76777 11.182L8 9.41421L6.23223 11.182L4.81802 9.76777L6.58579 
8L4.81802 6.23223L6.23223 4.81802L8 6.58579L9.76777 4.81802Z" />
+</svg>
diff --git a/etc/images/symbols/menu_16.svg b/etc/images/symbols/menu_16.svg
new file mode 100644
index 00000000000..bddc433b2eb
--- /dev/null
+++ b/etc/images/symbols/menu_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M14 3H2V5H14V3ZM14 
7H2V9H14V7ZM2 11H14V13H2V11Z" />
+</svg>
diff --git a/etc/images/symbols/minus_16.svg b/etc/images/symbols/minus_16.svg
new file mode 100644
index 00000000000..9cb61d8d379
--- /dev/null
+++ b/etc/images/symbols/minus_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path d="M13 7H3V9H13V7Z" />
+</svg>
diff --git a/etc/images/symbols/minus_circle_16.svg 
b/etc/images/symbols/minus_circle_16.svg
new file mode 100644
index 00000000000..ced8594774f
--- /dev/null
+++ b/etc/images/symbols/minus_circle_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M15 8C15 11.866 11.866 15 8 
15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM13 
8C13 10.7614 10.7614 13 8 13C5.23858 13 3 10.7614 3 8C3 5.23858 5.23858 3 8 
3C10.7614 3 13 5.23858 13 8ZM11.5 7V9H4.5V7H11.5Z" />
+</svg>
diff --git a/etc/images/symbols/plus_16.svg b/etc/images/symbols/plus_16.svg
new file mode 100644
index 00000000000..a4d2f84f318
--- /dev/null
+++ b/etc/images/symbols/plus_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path d="M9 3H7V7H3V9H7V13H9V9H13V7H9V3Z" />
+</svg>
diff --git a/etc/images/symbols/plus_circle_16.svg 
b/etc/images/symbols/plus_circle_16.svg
new file mode 100644
index 00000000000..921857f5a84
--- /dev/null
+++ b/etc/images/symbols/plus_circle_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M15 8C15 11.866 11.866 15 8 
15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM13 
8C13 10.7614 10.7614 13 8 13C5.23858 13 3 10.7614 3 8C3 5.23858 5.23858 3 8 
3C10.7614 3 13 5.23858 13 8ZM7 7V4.5H9V7H11.5V9H9V11.5H7V9H4.5V7H7Z" />
+</svg>
diff --git a/etc/images/symbols/star_16.svg b/etc/images/symbols/star_16.svg
new file mode 100644
index 00000000000..7ccbd6f01a5
--- /dev/null
+++ b/etc/images/symbols/star_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M9.6458 5.73475L8 1L6.3542 
5.73475L1.34261 5.83688L5.33704 8.86525L3.8855 13.6631L8 10.8L12.1145 
13.6631L10.663 8.86525L14.6574 5.83688L9.6458 5.73475ZM8.70534 7.02918L8 
5L7.29466 7.02918L5.14683 7.07295L6.85873 8.37082L6.23664 10.4271L8 9.2L9.76336 
10.4271L9.14127 8.37082L10.8532 7.07295L8.70534 7.02918Z" />
+</svg>
diff --git a/etc/images/symbols/star_fill_16.svg 
b/etc/images/symbols/star_fill_16.svg
new file mode 100644
index 00000000000..0e03675edd5
--- /dev/null
+++ b/etc/images/symbols/star_fill_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path d="M8 1L9.6458 5.73475L14.6574 5.83688L10.663 8.86525L12.1145 13.6631L8 
10.8L3.8855 13.6631L5.33704 8.86525L1.3426 5.83688L6.3542 5.73475L8 1Z" />
+</svg>
diff --git a/etc/images/symbols/star_half_16.svg 
b/etc/images/symbols/star_half_16.svg
new file mode 100644
index 00000000000..6c735ad64ae
--- /dev/null
+++ b/etc/images/symbols/star_half_16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16"  
xmlns="http://www.w3.org/2000/svg";>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M9.72809 5.62149L8 1L6.27191 
5.62149L1.34261 5.83688L5.2039 8.90851L3.8855 13.6631L8 10.94L12.1145 
13.6631L10.7961 8.90851L14.6574 5.83688L9.72809 5.62149ZM10.3511 11.236L8 
9.67997V3.99997L8.98747 6.64082L11.8042 6.7639L9.59777 8.51912L10.3511 11.236Z" 
/>
+</svg>
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index d5237ee1f04..f0c6a146dfd 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -542,9 +542,10 @@ of its argument (i.e., use of a Lisp special form), it 
must be
 implemented via rewriting, rather than as a function."
   (if (and (equal (car terms) "for")
           (equal (nth 2 terms) "in"))
-      (let ((body (car (last terms))))
+      (let ((for-items (make-symbol "for-items"))
+            (body (car (last terms))))
        (setcdr (last terms 2) nil)
-        `(let ((for-items
+        `(let ((,for-items
                 (append
                  ,@(mapcar
                     (lambda (elem)
@@ -552,13 +553,13 @@ implemented via rewriting, rather than as a function."
                           elem
                         `(list ,elem)))
                     (nthcdr 3 terms)))))
-           (while for-items
-             (let ((,(intern (cadr terms)) (car for-items))
+           (while ,for-items
+             (let ((,(intern (cadr terms)) (car ,for-items))
                   (eshell--local-vars (cons ',(intern (cadr terms))
                                              eshell--local-vars)))
               (eshell-protect
                ,(eshell-invokify-arg body t)))
-             (setq for-items (cdr for-items)))
+             (setq ,for-items (cdr ,for-items)))
            (eshell-close-handles)))))
 
 (defun eshell-structure-basic-command (func names keyword test body
@@ -901,28 +902,33 @@ This is used on systems where async subprocesses are not 
supported."
                                       (symbol-value tailproc))))))
 
 (defmacro eshell-as-subcommand (command)
-  "Execute COMMAND using a temp buffer.
-This is used so that certain Lisp commands, such as `cd', when
-executed in a subshell, do not disturb the environment of the main
-Eshell buffer."
+  "Execute COMMAND as a subcommand.
+A subcommand creates a local environment so that any changes to
+the environment don't propagate outside of the subcommand's
+scope.  This lets you use commands like `cd' within a subcommand
+without changing the current directory of the main Eshell
+buffer."
   `(let ,eshell-subcommand-bindings
      ,command))
 
 (defmacro eshell-do-command-to-value (object)
   "Run a subcommand prepared by `eshell-command-to-value'.
 This avoids the need to use `let*'."
+  (declare (obsolete nil "30.1"))
   `(let ((eshell-current-handles
          (eshell-create-handles value 'overwrite)))
      (progn
        ,object
        (symbol-value value))))
 
-(defmacro eshell-command-to-value (object)
-  "Run OBJECT synchronously, returning its result as a string.
-Returns a string comprising the output from the command."
-  `(let ((value (make-symbol "eshell-temp"))
-         (eshell-in-pipeline-p nil))
-     (eshell-do-command-to-value ,object)))
+(defmacro eshell-command-to-value (command)
+  "Run an Eshell COMMAND synchronously, returning its output."
+  (let ((value (make-symbol "eshell-temp")))
+    `(let ((eshell-in-pipeline-p nil)
+           (eshell-current-handles
+           (eshell-create-handles ',value 'overwrite)))
+       ,command
+       ,value)))
 
 ;;;_* Iterative evaluation
 ;;
diff --git a/src/fns.c b/src/fns.c
index e28d684396a..46fc20f9a77 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -452,6 +452,9 @@ If string STR1 is greater, the value is a positive number N;
      || defined __s390__ || defined __s390x__)         \
   && defined __OPTIMIZE__
 #define HAVE_FAST_UNALIGNED_ACCESS 1
+#else
+#define HAVE_FAST_UNALIGNED_ACCESS 0
+#endif
 
 /* Load a word from a possibly unaligned address.  */
 static inline size_t
@@ -462,8 +465,6 @@ load_unaligned_size_t (const void *p)
   return x;
 }
 
-#endif
-
 DEFUN ("string-lessp", Fstring_lessp, Sstring_lessp, 2, 2, 0,
        doc: /* Return non-nil if STRING1 is less than STRING2 in lexicographic 
order.
 Case is significant.
@@ -504,18 +505,16 @@ Symbols are also allowed; their print names are used 
instead.  */)
       /* String data is normally allocated with word alignment, but
         there are exceptions (notably pure strings) so we restrict the
         wordwise skipping to safe architectures.  */
-#ifdef HAVE_FAST_UNALIGNED_ACCESS
+      if (HAVE_FAST_UNALIGNED_ACCESS)
        {
          /* First compare entire machine words.  */
          int ws = sizeof (size_t);
          const char *w1 = SSDATA (string1);
          const char *w2 = SSDATA (string2);
-         while (b < nb - ws + 1
-                && (load_unaligned_size_t (w1 + b)
-                    == load_unaligned_size_t (w2 + b)))
+         while (b < nb - ws + 1 &&    load_unaligned_size_t (w1 + b)
+                                   == load_unaligned_size_t (w2 + b))
            b += ws;
        }
-#endif
 
       /* Scan forward to the differing byte.  */
       while (b < nb && SREF (string1, b) == SREF (string2, b))
diff --git a/test/lisp/eshell/esh-cmd-tests.el 
b/test/lisp/eshell/esh-cmd-tests.el
index 94763954622..a7208eb3a0b 100644
--- a/test/lisp/eshell/esh-cmd-tests.el
+++ b/test/lisp/eshell/esh-cmd-tests.el
@@ -73,6 +73,13 @@ Test that trailing arguments outside the subcommand are 
ignored.
 e.g. \"{(+ 1 2)} 3\" => 3"
   (eshell-command-result-equal "{(+ 1 2)} 3" 3))
 
+(ert-deftest esh-cmd-test/subcommand-shadow-value ()
+  "Test that the variable `value' isn't shadowed inside subcommands."
+  (with-temp-eshell
+   (with-no-warnings (setq-local value "hello"))
+   (eshell-match-command-output "echo ${echo $value}"
+                                "hello\n")))
+
 (ert-deftest esh-cmd-test/let-rebinds-after-defer ()
   "Test that let-bound values are properly updated after `eshell-defer'.
 When inside a `let' block in an Eshell command form, we need to
@@ -151,13 +158,13 @@ bug#59469."
    (eshell-match-command-output "for i in 1 2 (list 3 4) { echo $i }"
                                 "1\n2\n3\n4\n")))
 
-(ert-deftest esh-cmd-test/for-name-loop () ; bug#15231
+(ert-deftest esh-cmd-test/for-loop-name () ; bug#15231
   "Test invocation of a for loop using `name'."
   (let ((process-environment (cons "name" process-environment)))
     (eshell-command-result-equal "for name in 3 { echo $name }"
                                  3)))
 
-(ert-deftest esh-cmd-test/for-name-shadow-loop () ; bug#15372
+(ert-deftest esh-cmd-test/for-loop-name-shadow () ; bug#15372
   "Test invocation of a for loop using an env-var."
   (let ((process-environment (cons "name=env-value" process-environment)))
     (with-temp-eshell
@@ -165,6 +172,13 @@ bug#59469."
       "echo $name; for name in 3 { echo $name }; echo $name"
       "env-value\n3\nenv-value\n"))))
 
+(ert-deftest esh-cmd-test/for-loop-for-items-shadow ()
+  "Test that the variable `for-items' isn't shadowed inside for loops."
+  (with-temp-eshell
+   (with-no-warnings (setq-local for-items "hello"))
+   (eshell-match-command-output "for i in 1 { echo $for-items }"
+                                "hello\n")))
+
 (ert-deftest esh-cmd-test/for-loop-pipe ()
   "Test invocation of a for loop piped to another command."
   (skip-unless (executable-find "rev"))



reply via email to

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