emacs-diffs
[Top][All Lists]
Advanced

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

feature/android d31f557d4c7: Update Android port


From: Po Lu
Subject: feature/android d31f557d4c7: Update Android port
Date: Mon, 13 Mar 2023 08:39:43 -0400 (EDT)

branch: feature/android
commit d31f557d4c7725a9fb81c976701426baf5404786
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Update Android port
    
    * etc/NEWS: Announce new option.
    * lisp/menu-bar.el (menu-bar-close-window): New option.
    (kill-this-buffer):
    (kill-this-buffer-enabled-p): Adjust accordingly.
    * src/keyboard.c (lispy_function_keys): Add more silly
    keys.
---
 etc/NEWS         |  6 ++++++
 lisp/menu-bar.el | 23 ++++++++++++++++++++---
 src/keyboard.c   | 16 ++++++++++++++--
 3 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 2de8fb885a6..bd7d9522ad7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -47,6 +47,12 @@ compositing manager, Emacs will now redisplay such a frame 
even though
 'frame-visible-p' returns nil or 'icon' for it.  This can happen, for
 example, as part of preview for iconified frames.
 
+---
+** New user option 'menu-bar-close-window'.
+When non-nil, selecting Close from the File menu or clicking Close in
+the tool bar will result in the current window being closed, if
+possible.
+
 +++
 ** 'write-region-inhibit-fsync' now defaults to t in interactive mode,
 as it has in batch mode since Emacs 24.
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 2d907fb3827..949d805465d 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -79,6 +79,14 @@
                   :help "Print current buffer with page headings"))
     menu))
 
+(defcustom menu-bar-close-window nil
+  "Whether or not to close the current window from the menu bar.
+If non-nil, selecting Close from the File menu or clicking Close
+in the tool bar will close the current window where possible."
+  :type 'boolean
+  :group 'menu
+  :version "30.1")
+
 (defvar menu-bar-file-menu
   (let ((menu (make-sparse-keymap "File")))
 
@@ -2168,12 +2176,19 @@ otherwise it could decide to silently do nothing."
    ;; (Bug#8184).
    ((not (menu-bar-menu-frame-live-and-visible-p)))
    ((menu-bar-non-minibuffer-window-p)
-    (kill-buffer (current-buffer)))
+    (kill-buffer (current-buffer))
+    ;; Also close the current window if `menu-bar-close-windows' is
+    ;; set.
+    (when menu-bar-close-window
+      (ignore-errors (delete-window))))
    (t
     (abort-recursive-edit))))
 
 (defun kill-this-buffer-enabled-p ()
-  "Return non-nil if the `kill-this-buffer' menu item should be enabled."
+  "Return non-nil if the `kill-this-buffer' menu item should be enabled.
+It should be enabled there is at least one non-hidden buffer, or if
+`menu-bar-close-window' is non-nil and there is more than one window on
+this frame."
   (or (not (menu-bar-non-minibuffer-window-p))
       (let (found-1)
        ;; Instead of looping over entire buffer list, stop once we've
@@ -2183,7 +2198,9 @@ otherwise it could decide to silently do nothing."
            (unless (string-match-p "^ " (buffer-name buffer))
              (if (not found-1)
                  (setq found-1 t)
-               (throw 'found-2 t))))))))
+               (throw 'found-2 t))))))
+      (and menu-bar-close-window
+           (window-parent (selected-window)))))
 
 (put 'dired 'menu-enable '(menu-bar-non-minibuffer-window-p))
 
diff --git a/src/keyboard.c b/src/keyboard.c
index 0a74b435f0e..e376fa299dd 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4971,11 +4971,14 @@ const char *const lispy_function_keys[] =
        function keys that Emacs recognizes.  */
     [111] = "escape",
     [112] = "delete",
-    [121] = "break",
     [120] = "sysrq",
+    [121] = "break",
     [122] = "home",
     [123] = "end",
     [124] = "insert",
+    [126] = "media-play",
+    [127] = "media-pause",
+    [130] = "media-record",
     [131] = "f1",
     [132] = "f2",
     [133] = "f3",
@@ -4993,18 +4996,22 @@ const char *const lispy_function_keys[] =
     [19]  = "up",
     [20]  = "down",
     [213] = "muhenkan",
+    [213] = "muhenkan",
+    [214] = "henkan",
     [214] = "henkan",
     [215] = "hiragana-katakana",
     [218] = "kana",
     [21]  = "left",
     [22]  = "right",
     [24]  = "volume-up",
-    [25]  = "volume-down",
     [259] = "help",
+    [25]  = "volume-down",
     [268] = "kp-up-left",
     [269] = "kp-down-left",
     [270] = "kp-up-right",
     [271] = "kp-down-right",
+    [272] = "media-skip-forward",
+    [273] = "media-skip-backward",
     [277] = "cut",
     [278] = "copy",
     [279] = "paste",
@@ -5015,6 +5022,11 @@ const char *const lispy_function_keys[] =
     [67]  = "backspace",
     [82]  = "menu",
     [84]  = "find",
+    [85]  = "media-play-pause",
+    [86]  = "media-stop",
+    [87]  = "media-next",
+    [88]  = "media-previous",
+    [89]  = "media-rewind",
     [92]  = "prior",
     [93]  = "next",
   };



reply via email to

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