]> git.eshelyaron.com Git - emacs.git/commitdiff
Merge from origin/emacs-29
authorEli Zaretskii <eliz@gnu.org>
Sat, 30 Sep 2023 17:50:07 +0000 (13:50 -0400)
committerEli Zaretskii <eliz@gnu.org>
Sat, 30 Sep 2023 17:50:07 +0000 (13:50 -0400)
4776d90c31b Add new Tramp test
ca5b48fd76d Fix tmm-mid-prompt :type (Bug#66179)
7447d3df94e Fix tree-sitter indentation conflict with multiple languages
bee18e52737 Fix bug#66093 in Tramp
7d5fee0feaa Support regeneration of ja-dic.el under '--with-small-ja-...

Conflicts:
make-dist

1  2 
.gitignore
java/org/gnu/emacs/EmacsDesktopNotification.java
lisp/international/ja-dic-cnv.el
lisp/net/tramp-sshfs.el
lisp/net/tramp.el
lisp/treesit.el
make-dist
test/lisp/net/tramp-tests.el

diff --cc .gitignore
Simple merge
index 56ed984d49759a7bc7e90d2a87aa59bd4e30cdff,0000000000000000000000000000000000000000..4a6bbf7a606c82a4514cf042f063fdd059d73813
mode 100644,000000..100644
--- /dev/null
@@@ -1,202 -1,0 +1,202 @@@
-       
 +/* Communication module for Android terminals.  -*- c-file-style: "GNU" -*-
 +
 +Copyright (C) 2023 Free Software Foundation, Inc.
 +
 +This file is part of GNU Emacs.
 +
 +GNU Emacs is free software: you can redistribute it and/or modify
 +it under the terms of the GNU General Public License as published by
 +the Free Software Foundation, either version 3 of the License, or (at
 +your option) any later version.
 +
 +GNU Emacs is distributed in the hope that it will be useful,
 +but WITHOUT ANY WARRANTY; without even the implied warranty of
 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +GNU General Public License for more details.
 +
 +You should have received a copy of the GNU General Public License
 +along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 +
 +package org.gnu.emacs;
 +
 +import android.app.Notification;
 +import android.app.NotificationManager;
 +import android.app.NotificationChannel;
 +import android.app.PendingIntent;
 +
 +import android.content.Context;
 +import android.content.Intent;
 +
 +import android.os.Build;
 +
 +import android.widget.RemoteViews;
 +
 +\f
 +
 +/* Structure designating a single desktop notification.
 +
 +   New versions of Android also organize notifications into individual
 +   ``channels'', which are used to implement groups.  Unlike on other
 +   systems, notification importance is set for each group, not for
 +   each individual notification.  */
 +
 +\f
 +
 +public final class EmacsDesktopNotification
 +{
 +  /* The content of this desktop notification.  */
 +  public final String content;
 +
 +  /* The title of this desktop notification.  */
 +  public final String title;
 +
 +  /* The notification group.  */
 +  public final String group;
 +
 +  /* String identifying this notification for future replacement.
 +     Typically a string resembling ``XXXX.NNNN.YYYY'', where XXXX is
 +     the system boot time, NNNN is the PID of this Emacs instance, and
 +     YYYY is the counter value returned by the notifications display
 +     function.  */
 +  public final String tag;
 +
 +  /* The identifier of this notification's icon.  */
 +  public final int icon;
 +
 +  /* The importance of this notification's group.  */
 +  public final int importance;
 +
 +  public
 +  EmacsDesktopNotification (String title, String content,
 +                          String group, String tag, int icon,
 +                          int importance)
 +  {
 +    this.content    = content;
 +    this.title            = title;
 +    this.group            = group;
 +    this.tag        = tag;
 +    this.icon       = icon;
 +    this.importance = importance;
 +  }
 +
 +\f
 +
 +  /* Functions for displaying desktop notifications.  */
 +
 +  /* Internal helper for `display' executed on the main thread.  */
 +
 +  @SuppressWarnings ("deprecation") /* Notification.Builder (Context).  */
 +  private void
 +  display1 (Context context)
 +  {
 +    NotificationManager manager;
 +    NotificationChannel channel;
 +    Notification notification;
 +    Object tem;
 +    RemoteViews contentView;
 +    Intent intent;
 +    PendingIntent pending;
 +    int priority;
 +
 +    tem = context.getSystemService (Context.NOTIFICATION_SERVICE);
 +    manager = (NotificationManager) tem;
 +
 +    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
 +      {
 +      /* Create the notification channel for this group.  If a group
 +         already exists with the same name, its linked attributes
 +         (such as its importance) will be overridden.  */
 +        channel = new NotificationChannel (group, group, importance);
 +      manager.createNotificationChannel (channel);
 +
 +      /* Create a notification object and display it.  */
 +      notification = (new Notification.Builder (context, group)
 +                      .setContentTitle (title)
 +                      .setContentText (content)
 +                      .setSmallIcon (icon)
 +                      .build ());
 +      }
 +    else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
 +      {
 +      /* Android 7.1 and earlier don't segregate notifications into
 +         distinct categories, but permit an importance to be
 +         assigned to each individual notification.  */
 +
 +      switch (importance)
 +        {
 +        case 2: /* IMPORTANCE_LOW */
 +        default:
 +          priority = Notification.PRIORITY_LOW;
 +          break;
 +
 +        case 3: /* IMPORTANCE_DEFAULT */
 +          priority = Notification.PRIORITY_DEFAULT;
 +          break;
 +
 +        case 4: /* IMPORTANCE_HIGH */
 +          priority = Notification.PRIORITY_HIGH;
 +          break;
 +        }
++
 +      notification = (new Notification.Builder (context)
 +                      .setContentTitle (title)
 +                      .setContentText (content)
 +                      .setSmallIcon (icon)
 +                      .setPriority (priority)
 +                      .build ());
 +
 +      if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN)
 +        notification.priority = priority;
 +      }
 +    else
 +      {
 +      notification = new Notification ();
 +      notification.icon = icon;
 +
 +      /* This remote widget tree is defined in
 +         java/res/layout/sdk8_notifications_view.xml.  */
 +      notification.contentView
 +        = contentView
 +        = new RemoteViews ("org.gnu.emacs",
 +                           R.layout.sdk8_notifications_view);
 +      contentView.setTextViewText (R.id.sdk8_notifications_title,
 +                                   title);
 +      contentView.setTextViewText (R.id.sdk8_notifications_content,
 +                                   content);
 +      }
 +
 +    /* Provide a content intent which starts Emacs when the
 +       notification is clicked.  */
 +
 +    intent = new Intent (context, EmacsActivity.class);
 +    intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK);
 +
 +    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
 +      pending = PendingIntent.getActivity (context, 0, intent,
 +                                         PendingIntent.FLAG_IMMUTABLE);
 +    else
 +      pending = PendingIntent.getActivity (context, 0, intent, 0);
 +
 +    notification.contentIntent = pending;
 +
 +    manager.notify (tag, 2, notification);
 +  }
 +
 +  /* Display this desktop notification.
 +
 +     Create a notification channel named GROUP or update its
 +     importance if such a channel is already defined.  */
 +
 +  public void
 +  display ()
 +  {
 +    EmacsService.SERVICE.runOnUiThread (new Runnable () {
 +      @Override
 +      public void
 +      run ()
 +      {
 +        display1 (EmacsService.SERVICE);
 +      }
 +      });
 +  }
 +};
Simple merge
Simple merge
Simple merge
diff --cc lisp/treesit.el
index fd8c8482fc8a3bb2e5b1080cadaeac9fa0b2ae7b,c24ea90bba0ebb57636837735f71379703b96324..402417c6ca9dc4de1ecd0c29ce735876b3c35bf3
@@@ -1685,15 -1482,12 +1685,15 @@@ Return (ANCHOR . OFFSET).  This functio
                  (forward-line 0)
                  (skip-chars-forward " \t")
                  (point)))
 +         (local-parsers (treesit-local-parsers-at bol))
           (smallest-node
            (cond ((null (treesit-parser-list)) nil)
 -                ((eq 1 (length (treesit-parser-list)))
 +                (local-parsers (treesit-node-at
 +                                bol (car local-parsers)))
 +                ((eq 1 (length (treesit-parser-list nil nil t)))
                   (treesit-node-at bol))
-                 ((treesit-language-at (point))
-                  (treesit-node-at bol (treesit-language-at (point))))
+                 ((treesit-language-at bol)
+                  (treesit-node-at bol (treesit-language-at bol)))
                  (t (treesit-node-at bol))))
           (root (treesit-parser-root-node
                  (treesit-node-parser smallest-node)))
diff --cc make-dist
index a3b7219af3a04e255e2a38e72512c3192b7804e3,57881d50f0d7168effb09c11057c8b9a1bacb688..2c4b6a795008aab2e0bdcef7b8e76c41caf559f0
+++ b/make-dist
@@@ -356,8 -356,8 +356,9 @@@ possibly_non_vc_files=
    $top_level_ChangeLog
    MANIFEST aclocal.m4 configure
    admin/charsets/jisx2131-filter
-   src/config.in exec/configure
-   exec/config.h.in
+   src/config.in
++  exec/configure exec/config.h.in
+   leim/small-ja-dic-option
  "$(
    find admin doc etc lisp \
     \( -name '*.el' -o -name '*.elc' -o -name '*.map' -o -name '*.stamp' \
index 69d31a5464484bdee6f763ad5d200aa3bd6dd267,3c2ec9275c68114bf62b18aef3f4c51b431fbdf9..e382d0442755eec99843a5142631d2ca121dfc52
@@@ -7933,8 -7890,67 +7933,67 @@@ process sentinels.  They shall not dist
          (let ((auth-sources `(,netrc-file)))
            (should (file-exists-p ert-remote-temporary-file-directory)))))))))
  
+ (ert-deftest tramp-test46-read-otp-password ()
+   "Check Tramp one-time password handling."
+   :tags '(:expensive-test)
+   (skip-unless (tramp--test-mock-p))
+   ;; Not all read commands understand argument "-s" or "-p".
+   (skip-unless
+    (string-empty-p
+     (let ((shell-file-name "sh"))
+       (shell-command-to-string "read -s -p Password: pass"))))
+   (let ((pass "secret")
+       (mock-entry (copy-tree (assoc "mock" tramp-methods)))
+       mocked-input tramp-methods)
+     ;; We must mock `read-string', in order to avoid interactive
+     ;; arguments.
+     (cl-letf* (((symbol-function #'read-string)
+               (lambda (&rest _args) (pop mocked-input))))
+       (setcdr
+        (assq 'tramp-login-args mock-entry)
+        `((("-c")
+         (,(tramp-shell-quote-argument
+            (concat
+             "read -s -p 'Verification code: ' pass; echo; "
+             "(test \"pass$pass\" != \"pass" pass "\" && "
+             "echo \"Login incorrect\" || sh -i)"))))))
+       (setq tramp-methods `(,mock-entry))
+       ;; Reading password from stdin works.
+       (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+       ;; We don't want to invalidate the password.
+       (setq mocked-input `(,(copy-sequence pass)))
+       (should (file-exists-p ert-remote-temporary-file-directory))
+       ;; Don't entering a password returns in error.
+       (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+       (setq mocked-input nil)
+       (should-error (file-exists-p ert-remote-temporary-file-directory))
+       ;; A wrong password doesn't work either.
+       (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+       (setq mocked-input `(,(concat pass pass)))
+       (should-error (file-exists-p ert-remote-temporary-file-directory))
+       ;; The password shouldn't be read from auth-source.
+       ;; Macro `ert-with-temp-file' was introduced in Emacs 29.1.
+       (with-no-warnings (when (symbol-plist 'ert-with-temp-file)
+       (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+       (setq mocked-input nil)
+       (auth-source-forget-all-cached)
+       (ert-with-temp-file netrc-file
+         :prefix "tramp-test" :suffix ""
+         :text (format
+                "machine %s port mock password %s"
+                (file-remote-p ert-remote-temporary-file-directory 'host)
+                pass)
+         (let ((auth-sources `(,netrc-file)))
+           (should-error
+            (file-exists-p ert-remote-temporary-file-directory)))))))))
  ;; This test is inspired by Bug#29163.
 -(ert-deftest tramp-test47-auto-load ()
 +(ert-deftest tramp-test48-auto-load ()
    "Check that Tramp autoloads properly."
    ;; If we use another syntax but `default', Tramp is already loaded
    ;; due to the `tramp-change-syntax' call.