branch: externals/debbugs
commit a79cfc08e8c3fa683e2782a7373acb6ef45e50b6
Author: Michael Albinus <michael.albi...@gmx.de>
Commit: Michael Albinus <michael.albi...@gmx.de>

    Don't advice in Emacs 31+
    
    * debbugs-compat.el (debbugs-compat-add-debbugs-advice)
    (debbugs-compat-remove-debbugs-advice): Check for Emacs version.
    
    * debbugs-gnu.el (current-thread, make-thread): Declare.
    (debbugs-gnu, debbugs-gnu-show-reports): Don't use `funcall'.
    
    * debbugs-org.el (current-thread): Declare.
    (debbugs-org-show-reports): Don't use `funcall'.
---
 debbugs-compat.el | 7 ++++---
 debbugs-gnu.el    | 6 ++++--
 debbugs-org.el    | 4 +++-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/debbugs-compat.el b/debbugs-compat.el
index 0e95d8605b..60ffece0db 100644
--- a/debbugs-compat.el
+++ b/debbugs-compat.el
@@ -39,7 +39,8 @@
 
 ;; This is needed for Bug#73199.
 ;; `soap-invoke-internal' let-binds `url-http-attempt-keepalives' to
-;; t, which is not thread-safe.  We override this setting.
+;; t, which is not thread-safe.  We override this setting.  It is
+;; fixed in Emacs 31.1.
 (defvar url-http-attempt-keepalives)
 (defvar debbugs-gnu-use-threads)
 (defvar debbugs-compat-url-http-attempt-keepalives nil
@@ -51,7 +52,7 @@
 
 (defun debbugs-compat-add-debbugs-advice ()
   "Activate advice for Bug#73199."
-  (when debbugs-gnu-use-threads
+  (when (and debbugs-gnu-use-threads (< emacs-major-version 31))
     (setq debbugs-compat-url-http-attempt-keepalives
           url-http-attempt-keepalives)
     (advice-add
@@ -59,7 +60,7 @@
 
 (defun debbugs-compat-remove-debbugs-advice ()
   "Deactivate advice for Bug#73199."
-  (when debbugs-gnu-use-threads
+  (when (and debbugs-gnu-use-threads (< emacs-major-version 31))
     (setq url-http-attempt-keepalives
           debbugs-compat-url-http-attempt-keepalives)
     (advice-remove 'url-http-create-request  #'debbugs-compat-debbugs-advice)))
diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index be744d924f..b5f07ad3cd 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -221,6 +221,8 @@
 (declare-function log-view-current-tag "log-view" (&optional pos))
 (declare-function magit-status-setup-buffer "magit" (&optional directory))
 (declare-function magit-refresh "magit" ())
+(declare-function current-thread "thread.c" ())
+(declare-function make-thread "thread.c" (function &optional NAME))
 
 (defvar compilation-in-progress)
 (defvar diff-file-header-re)
@@ -892,7 +894,7 @@ value, like in `debbugs-gnu-get-bugs' or 
`debbubgs-gnu-tagged'."
                (> (length debbugs-gnu-local-tags)
                   (1- debbugs-gnu-use-threads-lower-limit))
              t))
-      (funcall 'make-thread
+      (make-thread
        (lambda ()
          (let (debbugs-show-progress)
            (unwind-protect
@@ -1038,7 +1040,7 @@ are taken from the cache instead."
   ;; When we are retrieving the bugs asynchronously (we're not in the
   ;; main thread), the buffer shall not be shown to the user yet.
   (funcall
-   (if (or (not main-thread) (eq main-thread (funcall 'current-thread)))
+   (if (or (not main-thread) (eq main-thread (current-thread)))
        #'pop-to-buffer-same-window #'set-buffer)
    (get-buffer-create debbugs-gnu-current-buffer))
   (let ((inhibit-read-only t))
diff --git a/debbugs-org.el b/debbugs-org.el
index 17fa8a39b5..e7a7b2892c 100644
--- a/debbugs-org.el
+++ b/debbugs-org.el
@@ -132,6 +132,8 @@
 (require 'org)
 (eval-when-compile (require 'cl-lib))
 
+(declare-function current-thread "thread.c" ())
+
 ;; Buffer-local variables.
 (defvar debbugs-gnu-local-query)
 (defvar debbugs-gnu-local-filter)
@@ -204,7 +206,7 @@ marked as \"client-side filter\"."
     ;; the main thread), the buffer shall not be shown to the user
     ;; yet.
     (funcall
-     (if  (or (not main-thread) (eq main-thread (funcall 'current-thread)))
+     (if  (or (not main-thread) (eq main-thread (current-thread)))
          #'pop-to-buffer-same-window #'set-buffer)
      (get-buffer-create debbugs-org-buffer-name))
     (org-mode)

Reply via email to