aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-09-16 10:38:46 +0800
committerPo Lu2023-09-16 10:38:46 +0800
commitee4b6a4a2d6b2779cdcf662938b5c81dc2fd2bef (patch)
tree2a76448b0abe5f75afb9dc72fd8ef91916bf9689
parentbc25d76650ab6b534b4016c607c36f8b67267dc0 (diff)
downloademacs-ee4b6a4a2d6b2779cdcf662938b5c81dc2fd2bef.tar.gz
emacs-ee4b6a4a2d6b2779cdcf662938b5c81dc2fd2bef.zip
Update Android port
* java/org/gnu/emacs/EmacsContextMenu.java (display): Return false if the list of menu buttons is empty, lest Android cease displaying menus on the assumption that Emacs is defective. * java/org/gnu/emacs/EmacsView.java (popupMenu): Likewise. * src/fns.c (sort_list): Render sentence motion commands functional within commentary * src/sfntfont.c (sfntfont_list_family): Sort and deduplicate the returned family list and make it a list of symbols. (syms_of_sfntfont) <Qstring_lessp>: New defsym.
-rw-r--r--java/org/gnu/emacs/EmacsContextMenu.java7
-rw-r--r--java/org/gnu/emacs/EmacsView.java7
-rw-r--r--src/fns.c6
-rw-r--r--src/sfntfont.c32
4 files changed, 46 insertions, 6 deletions
diff --git a/java/org/gnu/emacs/EmacsContextMenu.java b/java/org/gnu/emacs/EmacsContextMenu.java
index c5b87aa804a..c415ba59c79 100644
--- a/java/org/gnu/emacs/EmacsContextMenu.java
+++ b/java/org/gnu/emacs/EmacsContextMenu.java
@@ -347,6 +347,13 @@ public final class EmacsContextMenu
347 Runnable runnable; 347 Runnable runnable;
348 final EmacsHolder<Boolean> rc; 348 final EmacsHolder<Boolean> rc;
349 349
350 /* Android will permanently cease to display any popup menus at
351 all if the list of menu items is empty. Prevent this by
352 promptly returning if there are no menu items. */
353
354 if (menuItems.isEmpty ())
355 return false;
356
350 rc = new EmacsHolder<Boolean> (); 357 rc = new EmacsHolder<Boolean> ();
351 rc.thing = false; 358 rc.thing = false;
352 359
diff --git a/java/org/gnu/emacs/EmacsView.java b/java/org/gnu/emacs/EmacsView.java
index 04c3d824027..0f83af882ae 100644
--- a/java/org/gnu/emacs/EmacsView.java
+++ b/java/org/gnu/emacs/EmacsView.java
@@ -622,6 +622,13 @@ public final class EmacsView extends ViewGroup
622 if (popupActive && !force) 622 if (popupActive && !force)
623 return false; 623 return false;
624 624
625 /* Android will permanently cease to display any popup menus at
626 all if the list of menu items is empty. Prevent this by
627 promptly returning if there are no menu items. */
628
629 if (menu.menuItems.isEmpty ())
630 return false;
631
625 contextMenu = menu; 632 contextMenu = menu;
626 popupActive = true; 633 popupActive = true;
627 634
diff --git a/src/fns.c b/src/fns.c
index bd1d63a58c4..4731e416125 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2334,9 +2334,9 @@ See also the function `nreverse', which is used more often. */)
2334 2334
2335 2335
2336/* Stably sort LIST ordered by PREDICATE using the TIMSORT 2336/* Stably sort LIST ordered by PREDICATE using the TIMSORT
2337 algorithm. This converts the list to a vector, sorts the vector, 2337 algorithm. This converts the list to a vector, sorts the vector,
2338 and returns the result converted back to a list. The input list is 2338 and returns the result converted back to a list. The input list
2339 destructively reused to hold the sorted result. */ 2339 is destructively reused to hold the sorted result. */
2340 2340
2341static Lisp_Object 2341static Lisp_Object
2342sort_list (Lisp_Object list, Lisp_Object predicate) 2342sort_list (Lisp_Object list, Lisp_Object predicate)
diff --git a/src/sfntfont.c b/src/sfntfont.c
index d6dfa8b6f0d..0696b66d244 100644
--- a/src/sfntfont.c
+++ b/src/sfntfont.c
@@ -3646,8 +3646,9 @@ sfntfont_draw (struct glyph_string *s, int from, int to,
3646Lisp_Object 3646Lisp_Object
3647sfntfont_list_family (struct frame *f) 3647sfntfont_list_family (struct frame *f)
3648{ 3648{
3649 Lisp_Object families; 3649 Lisp_Object families, tem, next;
3650 struct sfnt_font_desc *desc; 3650 struct sfnt_font_desc *desc;
3651 unsigned short count;
3651 3652
3652 families = Qnil; 3653 families = Qnil;
3653 3654
@@ -3655,8 +3656,30 @@ sfntfont_list_family (struct frame *f)
3655 /* Add desc->family to the list. */ 3656 /* Add desc->family to the list. */
3656 families = Fcons (desc->family, families); 3657 families = Fcons (desc->family, families);
3657 3658
3658 /* Not sure if deleting duplicates is worth it. Is this ever 3659 /* Sort families in preparation for removing duplicates. */
3659 called? */ 3660 families = Fsort (families, Qstring_lessp);
3661
3662 /* Remove each duplicate within families. */
3663
3664 tem = families;
3665 while (!NILP (tem) && !NILP ((next = XCDR (tem))))
3666 {
3667 /* If the two strings are equal. */
3668 if (!NILP (Fstring_equal (XCAR (tem), XCAR (next))))
3669 /* Set tem's cdr to the cons after the next item. */
3670 XSETCDR (tem, XCDR (next));
3671 else
3672 /* Otherwise, start considering the next item. */
3673 tem = next;
3674 }
3675
3676 /* Intern each font family. */
3677
3678 tem = families;
3679
3680 FOR_EACH_TAIL (tem)
3681 XSETCAR (tem, Fintern (XCAR (tem), Qnil));
3682
3660 return families; 3683 return families;
3661} 3684}
3662 3685
@@ -3962,6 +3985,9 @@ syms_of_sfntfont (void)
3962 /* Default foundry name. */ 3985 /* Default foundry name. */
3963 DEFSYM (Qmisc, "misc"); 3986 DEFSYM (Qmisc, "misc");
3964 3987
3988 /* Predicated employed for sorting font family lists. */
3989 DEFSYM (Qstring_lessp, "string-lessp");
3990
3965 /* Set up staticpros. */ 3991 /* Set up staticpros. */
3966 sfnt_vendor_name = Qnil; 3992 sfnt_vendor_name = Qnil;
3967 staticpro (&sfnt_vendor_name); 3993 staticpro (&sfnt_vendor_name);