emacs-diffs
[Top][All Lists]
Advanced

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

master 8cd1681c32d 3/3: Merge remote-tracking branch 'savannah/master' i


From: Po Lu
Subject: master 8cd1681c32d 3/3: Merge remote-tracking branch 'savannah/master' into master-android-1
Date: Tue, 8 Aug 2023 01:50:13 -0400 (EDT)

branch: master
commit 8cd1681c32dad9f0b674d2e6f55d61e1e025a7b1
Merge: d35ead5bd8a 52ad5dc479e
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge remote-tracking branch 'savannah/master' into master-android-1
---
 doc/lispref/loading.texi          |  4 +---
 doc/lispref/modes.texi            |  4 ----
 etc/NEWS                          |  4 ++++
 lisp/emacs-lisp/easy-mmode.el     | 10 ++++++----
 lisp/emacs-lisp/timer.el          |  9 +++++----
 lisp/eshell/em-dirs.el            | 10 +++++++---
 lisp/help-fns.el                  |  8 +++-----
 lisp/international/fontset.el     |  8 ++++----
 lisp/tooltip.el                   |  4 ++--
 src/comp.c                        |  4 ++--
 src/lisp.h                        |  6 ++++++
 src/sysdep.c                      | 12 +++++-------
 src/sysstdio.h                    |  2 --
 test/lisp/eshell/em-dirs-tests.el | 23 +++++++++++++++++++++++
 test/lisp/help-fns-tests.el       | 23 +++++++++++++++++------
 15 files changed, 85 insertions(+), 46 deletions(-)

diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index d6fc4e8d636..125011c780f 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -660,9 +660,7 @@ and @code{define-overloadable-function} (see the commentary 
in
 @item Definitions for major or minor modes:
 @code{define-minor-mode}, @code{define-globalized-minor-mode},
 @code{define-generic-mode}, @code{define-derived-mode},
-@code{easy-mmode-define-minor-mode},
-@code{easy-mmode-define-global-mode}, @code{define-compilation-mode},
-and @code{define-global-minor-mode}.
+@code{define-compilation-mode}, and @code{define-global-minor-mode}.
 
 @item Other definition types:
 @code{defcustom}, @code{defgroup}, @code{deftheme}, @code{defclass}
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index b4f69e79155..00148420893 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -1794,10 +1794,6 @@ and will always be loaded by that time, enabling it by 
default is
 harmless.  But these are unusual circumstances.  Normally, the
 initial value must be @code{nil}.
 
-@findex easy-mmode-define-minor-mode
-  The name @code{easy-mmode-define-minor-mode} is an alias
-for this macro.
-
   Here is an example of using @code{define-minor-mode}:
 
 @smallexample
diff --git a/etc/NEWS b/etc/NEWS
index ee1ce72db98..5c7cee3e63b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -736,6 +736,10 @@ provokes an error if used numerically.
 The compatibility aliases 'x-defined-colors', 'x-color-defined-p',
 'x-color-values', and 'x-display-color-p' are now obsolete.
 
++++
+** 'easy-mmode-define-{minor-mode,global-mode}' aliases are now obsolete.
+Use 'define-minor-mode' and 'define-globalized-minor-mode' instead.
+
 
 * Lisp Changes in Emacs 30.1
 
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 20681374ee3..529f6e90e88 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -142,8 +142,6 @@ it is disabled.")
           (insert (format "\\{%s}" keymap-sym)))
         (buffer-string)))))
 
-;;;###autoload
-(defalias 'easy-mmode-define-minor-mode #'define-minor-mode)
 ;;;###autoload
 (defmacro define-minor-mode (mode doc &rest body)
   "Define a new minor mode MODE.
@@ -442,8 +440,6 @@ No problems result if this variable is not bound.
 ;;; make global minor mode
 ;;;
 
-;;;###autoload
-(defalias 'easy-mmode-define-global-mode #'define-globalized-minor-mode)
 ;;;###autoload
 (defalias 'define-global-minor-mode #'define-globalized-minor-mode)
 ;;;###autoload
@@ -841,6 +837,12 @@ Interactively, COUNT is the prefix numeric argument, and 
defaults to 1."
            ,@body))
        (put ',prev-sym 'definition-name ',base))))
 
+;; When deleting these two, also delete them from loaddefs-gen.el.
+;;;###autoload
+(define-obsolete-function-alias 'easy-mmode-define-minor-mode 
#'define-minor-mode "30.1")
+;;;###autoload
+(define-obsolete-function-alias 'easy-mmode-define-global-mode 
#'define-globalized-minor-mode "30.1")
+
 (provide 'easy-mmode)
 
 ;;; easy-mmode.el ends here
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index 7544279d8aa..468c46519fd 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -1,6 +1,6 @@
 ;;; timer.el --- run a function with args at some time in future -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996, 2001-2023 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2023 Free Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Package: emacs
@@ -226,8 +226,6 @@ the time of the current timer.  That's because the activated
 timer will fire right away."
   (timer--activate timer (not dont-wait) reuse-cell 'idle))
 
-(defalias 'disable-timeout #'cancel-timer)
-
 (defun cancel-timer (timer)
   "Remove TIMER from the list of active timers."
   (timer--check timer)
@@ -348,7 +346,6 @@ This function is called, by name, directly by the C code."
                    (memq timer timer-list))
           (setf (timer--triggered timer) nil))))))
 
-;; This function is incompatible with the one in levents.el.
 (defun timeout-event-p (event)
   "Non-nil if EVENT is a timeout event."
   (and (listp event) (eq (car event) 'timer-event)))
@@ -448,6 +445,7 @@ If REPEAT is non-nil, repeat the timer every REPEAT seconds.
 
 This function returns a timer object which you can use in `cancel-timer'.
 This function is for compatibility; see also `run-with-timer'."
+  (declare (obsolete run-with-timer "30.1"))
   (run-with-timer secs repeat function object))
 
 (defun run-with-idle-timer (secs repeat function &rest args)
@@ -580,6 +578,9 @@ If the user does not answer after SECONDS seconds, return 
DEFAULT-VALUE."
   (dolist (timer timer-idle-list)
     (if (timerp timer) ;; FIXME: Why test?
         (setf (timer--triggered timer) nil))))
+
+(define-obsolete-function-alias 'disable-timeout #'cancel-timer "30.1")
+
 
 (provide 'timer)
 
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index 5284df9ab59..640d3676750 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -429,9 +429,13 @@ in the minibuffer:
          (and eshell-cd-shows-directory
               (eshell-printn result)))
        (run-hooks 'eshell-directory-change-hook)
-       (if eshell-list-files-after-cd
-           ;; Let-bind eshell-last-command around this?
-           (eshell-plain-command "ls" (cdr args)))
+        (when eshell-list-files-after-cd
+          ;; Call "ls", but don't update the last-command information.
+          (let ((eshell-last-command-name)
+                (eshell-last-command-status)
+                (eshell-last-arguments))
+            (eshell-protect
+             (eshell-plain-command "ls" (cdr args)))))
        nil))))
 
 (put 'eshell/cd 'eshell-no-numeric-conversions t)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 2d94182df33..fc8f431fd11 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -2071,11 +2071,9 @@ keymap value."
         (if (symbolp keymap)
             (error "Not a keymap variable: %S" keymap)
           (error "Not a keymap")))
-      (let ((sym nil))
-        (unless sym
-          (setq sym (cl-gentemp "KEYMAP OBJECT (no variable) "))
-          (setq used-gentemp t)
-          (set sym keymap))
+      (let ((sym (cl-gentemp "KEYMAP OBJECT (no variable) ")))
+        (setq used-gentemp t)
+        (set sym keymap)
         (setq keymap sym)))
     ;; Follow aliasing.
     (setq keymap (or (ignore-errors (indirect-variable keymap)) keymap))
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index bbb1993ba3c..d879920b1d0 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -1207,7 +1207,8 @@ Internal use only.  Should be called at startup time."
       (list (cons (purecopy "-cdac$")  1.3)))
 
 (defvar x-font-name-charset-alist nil
-  "This variable has no meaning now.  Just kept for backward compatibility.")
+  "This variable has no meaning starting with Emacs 22.1.")
+(make-obsolete-variable 'x-font-name-charset-alist nil "30.1")
 
 ;;; XLFD (X Logical Font Description) format handler.
 
@@ -1273,9 +1274,8 @@ Return nil if PATTERN doesn't conform to XLFD."
 (defun x-compose-font-name (fields &optional _reduce)
   "Compose X fontname from FIELDS.
 FIELDS is a vector of XLFD fields, of length 12.
-If a field is nil, wild-card letter `*' is embedded.
-Optional argument REDUCE exists just for backward compatibility,
-and is always ignored."
+If a field is nil, wild-card letter `*' is embedded."
+  (declare (advertised-calling-convention (fields) "30.1"))
   (concat "-" (mapconcat (lambda (x) (or x "*")) fields "-")))
 
 
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 8d92caed08e..0881a7c7bf9 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -194,13 +194,13 @@ This might return nil if the event did not occur over a 
buffer."
 (defun tooltip-cancel-delayed-tip ()
   "Disable the tooltip timeout."
   (when tooltip-timeout-id
-    (disable-timeout tooltip-timeout-id)
+    (cancel-timer tooltip-timeout-id)
     (setq tooltip-timeout-id nil)))
 
 (defun tooltip-start-delayed-tip ()
   "Add a one-shot timeout to call function `tooltip-timeout'."
   (setq tooltip-timeout-id
-       (add-timeout (tooltip-delay) 'tooltip-timeout nil)))
+        (run-with-timer (tooltip-delay) 'tooltip-timeout nil)))
 
 (defun tooltip-timeout (_object)
   "Function called when timer with id `tooltip-timeout-id' fires."
diff --git a/src/comp.c b/src/comp.c
index 1bde4ae5821..b81a80b00f8 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -776,7 +776,7 @@ comp_hash_source_file (Lisp_Object filename)
 #else
   int res = md5_stream (f, SSDATA (digest));
 #endif
-  fclose (f);
+  emacs_fclose (f);
 
   if (res)
     xsignal2 (Qfile_notify_error, build_string ("hashing failed"), filename);
@@ -4749,7 +4749,7 @@ DEFUN ("comp--release-ctxt", Fcomp__release_ctxt, 
Scomp__release_ctxt,
     gcc_jit_context_release (comp.ctxt);
 
   if (logfile)
-    fclose (logfile);
+    emacs_fclose (logfile);
   comp.ctxt = NULL;
 
   return Qt;
diff --git a/src/lisp.h b/src/lisp.h
index 85de57b0b2f..2f26e5eddce 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -5086,9 +5086,15 @@ extern int emacs_open (const char *, int, int);
 extern int emacs_open_noquit (const char *, int, int);
 extern int emacs_pipe (int[2]);
 extern int emacs_close (int);
+#if !(defined HAVE_ANDROID && !defined ANDROID_STUBIFY)
+# define emacs_fclose fclose
+#else
 extern int emacs_fclose (FILE *);
+#endif
 extern FILE *emacs_fdopen (int, const char *)
   ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (emacs_fclose, 1);
+extern FILE *emacs_fopen (char const *, char const *)
+  ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (emacs_fclose, 1);
 extern int emacs_unlink (const char *);
 extern int emacs_symlink (const char *, const char *);
 extern int emacs_rmdir (const char *);
diff --git a/src/sysdep.c b/src/sysdep.c
index a995bc66741..0f8b70c8248 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2644,15 +2644,13 @@ emacs_fdopen (int fd, const char *mode)
    clear information associated with the FILE's file descriptor if
    necessary.  */
 
+#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
 int
 emacs_fclose (FILE *stream)
 {
-#if !(defined HAVE_ANDROID && !defined ANDROID_STUBIFY)
-  return fclose (stream);
-#else
   return android_fclose (stream);
-#endif
 }
+#endif
 
 /* Wrappers around unlink, symlink, rename, renameat_noreplace, and
    rmdir.  These operations handle asset and content directories on
@@ -3492,7 +3490,7 @@ get_up_time (void)
          Lisp_Object subsec = Fcons (make_fixnum (upfrac), make_fixnum (hz));
          up = Ftime_add (sec, subsec);
        }
-      fclose (fup);
+      emacs_fclose (fup);
     }
   unblock_input ();
 
@@ -3540,7 +3538,7 @@ procfs_ttyname (int rdev)
                }
            }
        }
-      fclose (fdev);
+      emacs_fclose (fdev);
     }
   unblock_input ();
   return build_string (name);
@@ -3582,7 +3580,7 @@ procfs_get_total_memory (void)
          }
       while (!done);
 
-      fclose (fmem);
+      emacs_fclose (fmem);
     }
   unblock_input ();
   return retval;
diff --git a/src/sysstdio.h b/src/sysstdio.h
index 5a973c833cc..8e9e5bec86c 100644
--- a/src/sysstdio.h
+++ b/src/sysstdio.h
@@ -28,8 +28,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <attribute.h>
 #include <unlocked-io.h>
 
-extern FILE *emacs_fopen (char const *, char const *)
-  ATTRIBUTE_MALLOC ATTRIBUTE_DEALLOC (fclose, 1);
 extern void errputc (int);
 extern void errwrite (void const *, ptrdiff_t);
 extern void close_output_streams (void);
diff --git a/test/lisp/eshell/em-dirs-tests.el 
b/test/lisp/eshell/em-dirs-tests.el
index d30b3d7d73f..9864b72ba78 100644
--- a/test/lisp/eshell/em-dirs-tests.el
+++ b/test/lisp/eshell/em-dirs-tests.el
@@ -99,4 +99,27 @@
      (eshell-match-command-output "echo $-[1][/ 1 3]"
                                   "(\"some\" \"here\")\n"))))
 
+(ert-deftest em-dirs-test/cd ()
+  "Test that changing directories with `cd' works."
+  (ert-with-temp-directory tmpdir
+    (write-region "text" nil (expand-file-name "file.txt" tmpdir))
+    (with-temp-eshell
+     (eshell-match-command-output (format "cd '%s'" tmpdir)
+                                  "\\`\\'")
+     (should (equal default-directory tmpdir)))))
+
+(ert-deftest em-dirs-test/cd/list-files-after-cd ()
+  "Test that listing files after `cd' works."
+  (let ((eshell-list-files-after-cd t))
+    (ert-with-temp-directory tmpdir
+      (write-region "text" nil (expand-file-name "file.txt" tmpdir))
+      (with-temp-eshell
+       (eshell-match-command-output (format "cd '%s'" tmpdir)
+                                    "file.txt\n")
+       (should (equal default-directory tmpdir))
+       ;; Make sure we didn't update the last-command information when
+       ;; running "ls".
+       (should (equal eshell-last-command-name "#<function eshell/cd>"))
+       (should (equal eshell-last-arguments (list tmpdir)))))))
+
 ;; em-dirs-tests.el ends here
diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el
index 243a45ae6d2..56c521e765e 100644
--- a/test/lisp/help-fns-tests.el
+++ b/test/lisp/help-fns-tests.el
@@ -132,6 +132,12 @@ Return first line of the output of (describe-function-1 
FUNC)."
 
 
 ;;; Tests for describe-keymap
+
+(defvar-keymap help-fns-test-map
+  "a" 'test-cmd-a
+  "b" 'test-cmd-b
+  "c" 'test-cmd-c)
+
 (ert-deftest help-fns-test-find-keymap-name ()
   (should (equal (help-fns-find-keymap-name lisp-mode-map) 'lisp-mode-map))
   ;; Follow aliasing.
@@ -142,27 +148,32 @@ Return first line of the output of (describe-function-1 
FUNC)."
     (makunbound 'foo-test-map)))
 
 (ert-deftest help-fns-test-describe-keymap/symbol ()
-  (describe-keymap 'minibuffer-local-must-match-map)
+  (describe-keymap 'help-fns-test-map)
   (with-current-buffer "*Help*"
-    (should (looking-at "^minibuffer-local-must-match-map is"))))
+    (should (looking-at "^help-fns-test-map is"))
+    (should (re-search-forward (rx word-start "a" word-end
+                                   (+ blank)
+                                   word-start "test-cmd-a" word-end)
+                               nil t))))
 
 (ert-deftest help-fns-test-describe-keymap/value ()
-  (describe-keymap minibuffer-local-must-match-map)
+  (describe-keymap help-fns-test-map)
   (with-current-buffer "*Help*"
     (should (looking-at "\nKey"))))
 
 (ert-deftest help-fns-test-describe-keymap/not-keymap ()
   (should-error (describe-keymap nil))
-  (should-error (describe-keymap emacs-version)))
+  (should-error (describe-keymap emacs-version))
+  (should-error (describe-keymap 'some-undefined-variable-foobar)))
 
 (ert-deftest help-fns-test-describe-keymap/let-bound ()
-  (let ((foobar minibuffer-local-must-match-map))
+  (let ((foobar help-fns-test-map))
     (describe-keymap foobar)
     (with-current-buffer "*Help*"
       (should (looking-at "\nKey")))))
 
 (ert-deftest help-fns-test-describe-keymap/dynamically-bound-no-file ()
-  (setq help-fns-test--describe-keymap-foo minibuffer-local-must-match-map)
+  (setq help-fns-test--describe-keymap-foo help-fns-test-map)
   (describe-keymap 'help-fns-test--describe-keymap-foo)
   (with-current-buffer "*Help*"
     (should (looking-at "^help-fns-test--describe-keymap-foo is"))))



reply via email to

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