Merge remote-tracking branch 'savannah/master' into master-android-1

This commit is contained in:
Po Lu 2023-08-08 13:39:45 +08:00
commit 8cd1681c32
15 changed files with 85 additions and 46 deletions

View file

@ -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}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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))

View file

@ -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 "-")))

View file

@ -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."

View file

@ -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;

View file

@ -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 *);

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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"))))