commit 1c84b187abc3ca60ae1a93522ddbad5af6cfd595 (HEAD, refs/remotes/origin/master) Author: Glenn Morris Date: Sun Sep 13 17:19:19 2020 -0700 Fix builds without modules * src/data.c (Finteractive_form): * src/eval.c (Fcommandp): Fix builds without modules. diff --git a/src/data.c b/src/data.c index dae8b10ef5..6558985668 100644 --- a/src/data.c +++ b/src/data.c @@ -906,6 +906,7 @@ Value, if non-nil, is a list (interactive SPEC). */) if (PVSIZE (fun) > COMPILED_INTERACTIVE) return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); } +#ifdef HAVE_MODULES else if (MODULE_FUNCTIONP (fun)) { Lisp_Object form @@ -913,6 +914,7 @@ Value, if non-nil, is a list (interactive SPEC). */) if (! NILP (form)) return form; } +#endif else if (AUTOLOADP (fun)) return Finteractive_form (Fautoload_do_load (fun, cmd, Qnil)); else if (CONSP (fun)) diff --git a/src/eval.c b/src/eval.c index fdc3cd1e9f..5d3c32326d 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1948,12 +1948,14 @@ then strings and vectors are not accepted. */) else if (COMPILEDP (fun)) return (PVSIZE (fun) > COMPILED_INTERACTIVE ? Qt : if_prop); +#ifdef HAVE_MODULES /* Module functions are interactive if their `interactive_form' field is non-nil. */ else if (MODULE_FUNCTIONP (fun)) return NILP (module_function_interactive_form (XMODULE_FUNCTION (fun))) ? if_prop : Qt; +#endif /* Strings and vectors are keyboard macros. */ if (STRINGP (fun) || VECTORP (fun)) commit 1749d32d027da2d3c52301bd84a4dcfb70694d51 Author: Lars Ingebrigtsen Date: Mon Sep 14 01:23:25 2020 +0200 Fix up report-emacs-bug action on invalid From headers * lisp/mail/emacsbug.el (report-emacs-bug-hook): Move point to the From header if the user has to edit the From header. diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index db85b64cc8..db374f15c2 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -416,67 +416,69 @@ usually do not have translators for other languages.\n\n"))) (defun report-emacs-bug-hook () "Do some checking before sending a bug report." - (save-excursion - (goto-char (point-max)) - (skip-chars-backward " \t\n") - (and (= (- (point) (point-min)) - (length report-emacs-bug-orig-text)) - (string-equal (buffer-substring-no-properties (point-min) (point)) - report-emacs-bug-orig-text) - (error "No text entered in bug report")) - ;; Warning for novice users. - (when (and (string-match "bug-gnu-emacs@gnu\\.org" (mail-fetch-field "to")) - (not report-emacs-bug-no-confirmation) - (not (yes-or-no-p - "Send this bug report to the Emacs maintainers? "))) - (with-output-to-temp-buffer "*Bug Help*" - (princ (substitute-command-keys - (format "\ + (goto-char (point-max)) + (skip-chars-backward " \t\n") + (and (= (- (point) (point-min)) + (length report-emacs-bug-orig-text)) + (string-equal (buffer-substring-no-properties (point-min) (point)) + report-emacs-bug-orig-text) + (error "No text entered in bug report")) + ;; Warning for novice users. + (when (and (string-match "bug-gnu-emacs@gnu\\.org" (mail-fetch-field "to")) + (not report-emacs-bug-no-confirmation) + (not (yes-or-no-p + "Send this bug report to the Emacs maintainers? "))) + (with-output-to-temp-buffer "*Bug Help*" + (princ (substitute-command-keys + (format "\ You invoked the command M-x report-emacs-bug, but you decided not to mail the bug report to the Emacs maintainers. If you want to mail it to someone else instead, please insert the proper e-mail address after \"To: \", and send the mail again%s." - (if report-emacs-bug-send-command - (format " using \\[%s]" - report-emacs-bug-send-command) - ""))))) - (error "M-x report-emacs-bug was canceled, please read *Bug Help* buffer")) - ;; Query the user for the SMTP method, so that we can skip - ;; questions about From header validity if the user is going to - ;; use mailclient, anyway. - (when (or (and (derived-mode-p 'message-mode) - (eq message-send-mail-function 'sendmail-query-once)) - (and (not (derived-mode-p 'message-mode)) - (eq send-mail-function 'sendmail-query-once))) - (sendmail-query-user-about-smtp) - (when (derived-mode-p 'message-mode) - (setq message-send-mail-function (message-default-send-mail-function)))) - (or report-emacs-bug-no-confirmation - ;; mailclient.el does not need a valid From - (if (derived-mode-p 'message-mode) - (eq message-send-mail-function 'message-send-mail-with-mailclient) - (eq send-mail-function 'mailclient-send-it)) - ;; Not narrowing to the headers, but that's OK. - (let ((from (mail-fetch-field "From"))) - (and (or (not from) - (message-bogus-recipient-p from) - ;; This is the default user-mail-address. On today's - ;; systems, it seems more likely to be wrong than right, - ;; since most people don't run their own mail server. - (string-match (format "\\<%s@%s\\>" - (regexp-quote (user-login-name)) - (regexp-quote (system-name))) - from)) - (not (yes-or-no-p - (format-message "Is `%s' really your email address? " - from))) - (error "Please edit the From address and try again")))) - ;; Bury the help buffer (if it's shown). - (when-let ((help (get-buffer "*Bug Help*"))) - (when (get-buffer-window help) - (quit-window nil (get-buffer-window help)))))) + (if report-emacs-bug-send-command + (format " using \\[%s]" + report-emacs-bug-send-command) + ""))))) + (error "M-x report-emacs-bug was canceled, please read *Bug Help* buffer")) + ;; Query the user for the SMTP method, so that we can skip + ;; questions about From header validity if the user is going to + ;; use mailclient, anyway. + (when (or (and (derived-mode-p 'message-mode) + (eq message-send-mail-function 'sendmail-query-once)) + (and (not (derived-mode-p 'message-mode)) + (eq send-mail-function 'sendmail-query-once))) + (sendmail-query-user-about-smtp) + (when (derived-mode-p 'message-mode) + (setq message-send-mail-function (message-default-send-mail-function)))) + (or report-emacs-bug-no-confirmation + ;; mailclient.el does not need a valid From + (if (derived-mode-p 'message-mode) + (eq message-send-mail-function 'message-send-mail-with-mailclient) + (eq send-mail-function 'mailclient-send-it)) + ;; Not narrowing to the headers, but that's OK. + (let ((from (mail-fetch-field "From"))) + (when (and (or (not from) + (message-bogus-recipient-p from) + ;; This is the default user-mail-address. On + ;; today's systems, it seems more likely to + ;; be wrong than right, since most people + ;; don't run their own mail server. + (string-match (format "\\<%s@%s\\>" + (regexp-quote (user-login-name)) + (regexp-quote (system-name))) + from)) + (not (yes-or-no-p + (format-message "Is `%s' really your email address? " + from)))) + (goto-char (point-min)) + (re-search-forward "^From: " nil t) + (error "Please edit the From address and try again")))) + ;; Bury the help buffer (if it's shown). + (when-let ((help (get-buffer "*Bug Help*"))) + (when (get-buffer-window help) + (quit-window nil (get-buffer-window help))))) ;;;###autoload (defun submit-emacs-patch (subject file) commit 9cc992e68ff7c37420f3d9dd5fa73bc9525e4c2a Author: akater Date: Mon Sep 14 01:08:26 2020 +0200 Fix compilation-mode-map doc string * lisp/progmodes/compile.el (compilation-mode-map): Remove mention of compilation-minor-mode-map (bug#43382). As the comment in the body says: ;; Don't inherit from compilation-minor-mode-map, ;; because that introduces a menu bar item we don't want. ;; That confuses C-down-mouse-3. and the map actually inherits from special-mode-map. Copyright-paperwork-exempt: yes diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 13b672bd53..7ac5405ab1 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -2090,8 +2090,7 @@ Returns the compilation buffer created." '(menu-item "Compile..." compile :help "Compile the program including the current buffer. Default: run `make'")) map) - "Keymap for compilation log buffers. -`compilation-minor-mode-map' is a parent of this.") + "Keymap for compilation log buffers.") (defvar compilation-mode-tool-bar-map ;; When bootstrapping, tool-bar-map is not properly initialized yet, commit da0e75e7410226d7fd6d760f0ebe8a04d815506d Author: Philipp Stephani Date: Sun Sep 13 20:21:41 2020 +0200 Add facility to make module functions interactive (Bug#23486). * src/module-env-28.h: Add field for 'make_interactive' function. * src/emacs-module.c (Lisp_Module_Function): Add new field holding the interactive form. (allocate_module_function): Adapt to structure layout change. (module_make_interactive, module_function_interactive_form): New functions. (initialize_environment): Use them. * src/eval.c (Fcommandp): * src/data.c (Finteractive_form): Also handle interactive module functions. * test/data/emacs-module/mod-test.c (Fmod_test_identity): New test function. (emacs_module_init): Create two interactive module test functions. * test/src/emacs-module-tests.el (module/interactive/return-t) (module/interactive/return-t-int, module/interactive/identity): New unit tests. * doc/lispref/internals.texi (Module Functions): Document new function. Rework paragraph about wrapping module functions, as the example no longer applies. * etc/NEWS: Document new facility. diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index d70c3543f2..cc18b85233 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -1425,28 +1425,46 @@ violations of the above requirements. @xref{Initial Options,,,emacs, The GNU Emacs Manual}. Using the module @acronym{API}, it is possible to define more complex -function and data types: interactive functions, inline functions, -macros, etc. However, the resulting C code will be cumbersome and -hard to read. Therefore, we recommend that you limit the module code -which creates functions and data structures to the absolute minimum, -and leave the rest for a Lisp package that will accompany your module, -because doing these additional tasks in Lisp is much easier, and will -produce a much more readable code. For example, given a module -function @code{module-func} defined as above, one way of making an -interactive command @code{module-cmd} based on it is with the -following simple Lisp wrapper: +function and data types: inline functions, macros, etc. However, the +resulting C code will be cumbersome and hard to read. Therefore, we +recommend that you limit the module code which creates functions and +data structures to the absolute minimum, and leave the rest for a Lisp +package that will accompany your module, because doing these +additional tasks in Lisp is much easier, and will produce a much more +readable code. For example, given a module function +@code{module-func} defined as above, one way of making a macro +@code{module-macro} based on it is with the following simple Lisp +wrapper: @lisp -(defun module-cmd (&rest args) - "Documentation string for the command." - (interactive @var{spec}) - (apply 'module-func args)) +(defmacro module-macro (&rest args) + "Documentation string for the macro." + (module-func args)) @end lisp The Lisp package which goes with your module could then load the module using the @code{load} primitive (@pxref{Dynamic Modules}) when the package is loaded into Emacs. +By default, module functions created by @code{make_function} are not +interactive. To make them interactive, you can use the following +function. + +@deftypefun void make_interactive (emacs_env *@var{env}, emacs_value @var{function}, emacs_value @var{spec}) +This function, which is available since Emacs 28, makes the function +@var{function} interactive using the interactive specification +@var{spec}. Emacs interprets @var{spec} like the argument to the +@code{interactive} form. @ref{Using Interactive}, and +@pxref{Interactive Codes}. @var{function} must be an Emacs module +function returned by @code{make_function}. +@end deftypefun + +Note that there is no native module support for retrieving the +interactive specification of a module function. Use the function +@code{interactive-form} for that. @ref{Using Interactive}. It is not +possible to make a module function non-interactive once you have made +it interactive using @code{make_interactive}. + @anchor{Module Function Finalizers} If you want to run some code when a module function object (i.e., an object returned by @code{make_function}) is garbage-collected, you can diff --git a/etc/NEWS b/etc/NEWS index db2adcec15..52092f2ef7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1347,6 +1347,10 @@ This removes the final remaining trace of old-style backquotes. 'emacs_function' and 'emacs_finalizer' for module functions and finalizers, respectively. +** Module functions can now be made interactive. Use +'make_interactive' to give a module function an interactive +specification. + ** Module functions can now install an optional finalizer that is called when the function object is garbage-collected. Use 'set_function_finalizer' to set the finalizer and diff --git a/src/data.c b/src/data.c index 59d148166f..dae8b10ef5 100644 --- a/src/data.c +++ b/src/data.c @@ -906,6 +906,13 @@ Value, if non-nil, is a list (interactive SPEC). */) if (PVSIZE (fun) > COMPILED_INTERACTIVE) return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); } + else if (MODULE_FUNCTIONP (fun)) + { + Lisp_Object form + = module_function_interactive_form (XMODULE_FUNCTION (fun)); + if (! NILP (form)) + return form; + } else if (AUTOLOADP (fun)) return Finteractive_form (Fautoload_do_load (fun, cmd, Qnil)); else if (CONSP (fun)) diff --git a/src/emacs-module.c b/src/emacs-module.c index a0bab11801..3581daad11 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -551,7 +551,7 @@ struct Lisp_Module_Function union vectorlike_header header; /* Fields traced by GC; these must come first. */ - Lisp_Object documentation; + Lisp_Object documentation, interactive_form; /* Fields ignored by GC. */ ptrdiff_t min_arity, max_arity; @@ -564,7 +564,7 @@ static struct Lisp_Module_Function * allocate_module_function (void) { return ALLOCATE_PSEUDOVECTOR (struct Lisp_Module_Function, - documentation, PVEC_MODULE_FUNCTION); + interactive_form, PVEC_MODULE_FUNCTION); } #define XSET_MODULE_FUNCTION(var, ptr) \ @@ -630,6 +630,24 @@ module_finalize_function (const struct Lisp_Module_Function *func) func->finalizer (func->data); } +static void +module_make_interactive (emacs_env *env, emacs_value function, emacs_value spec) +{ + MODULE_FUNCTION_BEGIN (); + Lisp_Object lisp_fun = value_to_lisp (function); + CHECK_MODULE_FUNCTION (lisp_fun); + Lisp_Object lisp_spec = value_to_lisp (spec); + /* Normalize (interactive nil) to (interactive). */ + XMODULE_FUNCTION (lisp_fun)->interactive_form + = NILP (lisp_spec) ? list1 (Qinteractive) : list2 (Qinteractive, lisp_spec); +} + +Lisp_Object +module_function_interactive_form (const struct Lisp_Module_Function *fun) +{ + return fun->interactive_form; +} + static emacs_value module_funcall (emacs_env *env, emacs_value func, ptrdiff_t nargs, emacs_value *args) @@ -1463,6 +1481,7 @@ initialize_environment (emacs_env *env, struct emacs_env_private *priv) env->get_function_finalizer = module_get_function_finalizer; env->set_function_finalizer = module_set_function_finalizer; env->open_channel = module_open_channel; + env->make_interactive = module_make_interactive; Vmodule_environments = Fcons (make_mint_ptr (env), Vmodule_environments); return env; } diff --git a/src/eval.c b/src/eval.c index 126ee2e955..fdc3cd1e9f 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1948,6 +1948,13 @@ then strings and vectors are not accepted. */) else if (COMPILEDP (fun)) return (PVSIZE (fun) > COMPILED_INTERACTIVE ? Qt : if_prop); + /* Module functions are interactive if their `interactive_form' + field is non-nil. */ + else if (MODULE_FUNCTIONP (fun)) + return NILP (module_function_interactive_form (XMODULE_FUNCTION (fun))) + ? if_prop + : Qt; + /* Strings and vectors are keyboard macros. */ if (STRINGP (fun) || VECTORP (fun)) return (NILP (for_call_interactively) ? Qt : Qnil); diff --git a/src/lisp.h b/src/lisp.h index 88e69b9061..a24898004d 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4210,6 +4210,8 @@ extern Lisp_Object funcall_module (Lisp_Object, ptrdiff_t, Lisp_Object *); extern Lisp_Object module_function_arity (const struct Lisp_Module_Function *); extern Lisp_Object module_function_documentation (struct Lisp_Module_Function const *); +extern Lisp_Object module_function_interactive_form + (const struct Lisp_Module_Function *); extern module_funcptr module_function_address (struct Lisp_Module_Function const *); extern void *module_function_data (const struct Lisp_Module_Function *); diff --git a/src/module-env-28.h b/src/module-env-28.h index 5d884c148c..40b03b92b5 100644 --- a/src/module-env-28.h +++ b/src/module-env-28.h @@ -12,3 +12,7 @@ int (*open_channel) (emacs_env *env, emacs_value pipe_process) EMACS_ATTRIBUTE_NONNULL (1); + + void (*make_interactive) (emacs_env *env, emacs_value function, + emacs_value spec) + EMACS_ATTRIBUTE_NONNULL (1); diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c index 37186fcc4d..da298d4e39 100644 --- a/test/data/emacs-module/mod-test.c +++ b/test/data/emacs-module/mod-test.c @@ -673,6 +673,14 @@ Fmod_test_async_pipe (emacs_env *env, ptrdiff_t nargs, emacs_value *args, return env->intern (env, "nil"); } +static emacs_value +Fmod_test_identity (emacs_env *env, ptrdiff_t nargs, emacs_value *args, + void *data) +{ + assert (nargs == 1); + return args[0]; +} + /* Lisp utilities for easier readability (simple wrappers). */ /* Provide FEATURE to Emacs. */ @@ -764,6 +772,19 @@ emacs_module_init (struct emacs_runtime *ert) #undef DEFUN + emacs_value constant_fn + = env->make_function (env, 0, 0, Fmod_test_return_t, NULL, NULL); + env->make_interactive (env, constant_fn, env->intern (env, "nil")); + bind_function (env, "mod-test-return-t-int", constant_fn); + + emacs_value identity_fn + = env->make_function (env, 1, 1, Fmod_test_identity, NULL, NULL); + const char *interactive_spec = "i"; + env->make_interactive (env, identity_fn, + env->make_string (env, interactive_spec, + strlen (interactive_spec))); + bind_function (env, "mod-test-identity", identity_fn); + provide (env, "mod-test"); return 0; } diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 096c6b3057..1eebb418cf 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -468,4 +468,36 @@ See Bug#36226." (should (equal (buffer-string) "data from thread"))) (delete-process process))))) +(ert-deftest module/interactive/return-t () + (should (functionp (symbol-function #'mod-test-return-t))) + (should (module-function-p (symbol-function #'mod-test-return-t))) + (should-not (commandp #'mod-test-return-t)) + (should-not (commandp (symbol-function #'mod-test-return-t))) + (should-not (interactive-form #'mod-test-return-t)) + (should-not (interactive-form (symbol-function #'mod-test-return-t))) + (should-error (call-interactively #'mod-test-return-t) + :type 'wrong-type-argument)) + +(ert-deftest module/interactive/return-t-int () + (should (functionp (symbol-function #'mod-test-return-t-int))) + (should (module-function-p (symbol-function #'mod-test-return-t-int))) + (should (commandp #'mod-test-return-t-int)) + (should (commandp (symbol-function #'mod-test-return-t-int))) + (should (equal (interactive-form #'mod-test-return-t-int) '(interactive))) + (should (equal (interactive-form (symbol-function #'mod-test-return-t-int)) + '(interactive))) + (should (eq (mod-test-return-t-int) t)) + (should (eq (call-interactively #'mod-test-return-t-int) t))) + +(ert-deftest module/interactive/identity () + (should (functionp (symbol-function #'mod-test-identity))) + (should (module-function-p (symbol-function #'mod-test-identity))) + (should (commandp #'mod-test-identity)) + (should (commandp (symbol-function #'mod-test-identity))) + (should (equal (interactive-form #'mod-test-identity) '(interactive "i"))) + (should (equal (interactive-form (symbol-function #'mod-test-identity)) + '(interactive "i"))) + (should (eq (mod-test-identity 123) 123)) + (should-not (call-interactively #'mod-test-identity))) + ;;; emacs-module-tests.el ends here commit 3eb4e0db5ce247f8396daac3156087fbb7aefbd4 Author: Reuben Thomas Date: Sun Sep 13 18:05:47 2020 +0100 Escape ampersand in table.el LaTeX output * lisp/textmodes/table.el (table--generate-source-scan-lines): Add ampersand '&' to the list of characters to escape in LaTeX output. diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el index cfe6ce5ce6..c7bf687a9e 100644 --- a/lisp/textmodes/table.el +++ b/lisp/textmodes/table.el @@ -3279,7 +3279,7 @@ Currently this method is for LaTeX only." (with-temp-buffer (insert line) (goto-char (point-min)) - (while (re-search-forward "\\([#$~_^%{}]\\)\\|\\(\\\\\\)\\|\\([<>|]\\)" nil t) + (while (re-search-forward "\\([#$~_^%{}&]\\)\\|\\(\\\\\\)\\|\\([<>|]\\)" nil t) (if (match-beginning 1) (save-excursion (goto-char (match-beginning 1)) commit f9aa499afa2f65952b5ec7905bf836f6a2ccbfd4 Author: Lars Ingebrigtsen Date: Sun Sep 13 18:51:44 2020 +0200 Further fixups of the variable-pitch eww header line change * lisp/net/eww.el (eww-update-header-line-format): Protect against :url not being set. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 69dc2d47d6..2717dfbe79 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -730,8 +730,7 @@ Currently this means either text/html or application/xhtml+xml." (setq header-line-format (and eww-header-line-format (let ((peer (plist-get eww-data :peer)) - (url (propertize (plist-get eww-data :url) - 'face 'variable-pitch)) + (url (plist-get eww-data :url)) (title (propertize (if (zerop (length (plist-get eww-data :title))) "[untitled]" @@ -747,10 +746,13 @@ Currently this means either text/html or application/xhtml+xml." ;; Limit the length of the title so that the host name ;; of the URL is always visible. (when url + (setq url (propertize url 'face 'variable-pitch)) (let* ((parsed (url-generic-parse-url url)) (host-length (shr-string-pixel-width - (format "%s://%s" (url-type parsed) - (url-host parsed)))) + (propertize + (format "%s://%s" (url-type parsed) + (url-host parsed)) + 'face 'variable-pitch))) (width (window-width nil t))) (cond ;; The host bit is wider than the window, so nix commit 2c62e9b20dcf615a283e8fce2b7b74981b15ae67 Author: Stefan Kangas Date: Sun Sep 13 18:30:45 2020 +0200 Improve wording of cua-mode menu entry * lisp/menu-bar.el (menu-bar-options-menu): Improve wording of the cua-mode menu entry. (Bug#43323) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 9a93fa60d7..ef04689f4c 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1521,7 +1521,7 @@ mail status in mode line")) (bindings--define-key menu [cua-mode] (menu-bar-make-mm-toggle cua-mode - "Use CUA Keys (Cut/Paste with C-x/C-c/C-v)" + "Cut/Paste with C-x/C-c/C-v (CUA Mode)" "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste" (:visible (or (not (boundp 'cua-enable-cua-keys)) cua-enable-cua-keys)))) commit 817dd546497aadefbe9acc8762e3f7190799c5e6 Author: Stefan Kangas Date: Sun Sep 13 18:24:31 2020 +0200 Improve frame-title-format and icon-title-format * src/xdisp.c (syms_of_xdisp): Replace 'invocation-name' with the text "%b - GNU Emacs" and replace "@" with " at ". (Bug#41147) * etc/NEWS: Announce the above change. diff --git a/etc/NEWS b/etc/NEWS index 8f10a6213d..db2adcec15 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -127,6 +127,17 @@ the mouse cursor is on the scroll bars, fringes, margins, header line, and mode line. ('mwheel-mode' is enabled by default on most graphical displays.) +--- +** The default value of 'frame-title-format' and icon-title-format' has changed. +These variables are used to display the title bar of visible frames +and the title bar of an iconified frame. They now show the name of +the current buffer and the text "GNU Emacs" instead of the value of +'invocation-name'. To get the old behavior back, add the following to +your Init file: + + (setq frame-title-format '(multiple-frames "%b" + ("" invocation-name "@" system-name))) + * Editing Changes in Emacs 28.1 diff --git a/src/xdisp.c b/src/xdisp.c index 69e5a9e1cf..10ddb53dba 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -34831,8 +34831,7 @@ and is used only on frames for which no explicit name has been set Oracle Developer Studio 12.6. */ Lisp_Object icon_title_name_format = pure_list (empty_unibyte_string, - intern_c_string ("invocation-name"), - build_pure_c_string ("@"), + build_pure_c_string ("%b - GNU Emacs at "), intern_c_string ("system-name")); Vicon_title_format = Vframe_title_format commit 99af480d00905b54bb2f739d134c149930d91ce8 Author: Eli Zaretskii Date: Sun Sep 13 18:35:54 2020 +0300 Fix punctuation in EWW manual * doc/misc/eww.texi (Advanced): Fix punctuation of a recent change. diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index a9513e446a..4ae2c86e3f 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -214,10 +214,11 @@ in an external browser by customizing @findex eww-retrieve-command EWW normally uses @code{url-retrieve} to fetch the @acronym{HTML} -before rendering it. It can sometimes be convenient to use an external -program to do this, and @code{eww-retrieve-command} should then be a -list that specifies a command and the parameters. For instance, to -use the Chromium browser, you could say something like this: +before rendering it. It can sometimes be convenient to use an +external program to do this, and @code{eww-retrieve-command} should +then be a list that specifies a command and the parameters. For +instance, to use the Chromium browser, you could say something like +this: @lisp (setq eww-retrieve-command commit 762817003f5c38d0b8c79ca3ab0eaafb6495fd38 Author: Eli Zaretskii Date: Sun Sep 13 18:32:31 2020 +0300 ; * etc/NEWS: Document a recent change. diff --git a/etc/NEWS b/etc/NEWS index 2fe66be15f..8f10a6213d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -170,6 +170,11 @@ setting the variable 'auto-save-visited-mode' buffer-locally to nil. description of the properties. Likewise 'button-describe' does the same for a button. +** Obsolete commands are no longer hidden from command completion. +Completion of command names now considers obsolete aliases as +candidates. Invoking a command via an obsolete alias now mentions the +obsolescence fact and shows the new name of the command. + * Changes in Specialized Modes and Packages in Emacs 28.1 commit cc24931b2f7cc01274e98258799d36f264ae0f34 Author: Eli Zaretskii Date: Sun Sep 13 18:27:44 2020 +0300 ; * lisp/tab-line.el (tab-line-switch-cycling): Fix last change. diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 61a0201b29..8da554a326 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -647,7 +647,7 @@ using the `previous-buffer' command." If non-nil, `tab-line-switch-to-prev-tab' in the first tab switches to the last tab and `tab-line-switch-to-next-tab' in the last tab switches to the first tab. This variable is not consulted -when `tab-line-tabs-function' is `tab-line-tabs-window-buffers'" +when `tab-line-tabs-function' is `tab-line-tabs-window-buffers'." :type 'boolean :group 'tab-line :version "28.1") commit 54c2a8df3bfaec2141bdf9a11fca59f6d3a58558 Author: Lars Ingebrigtsen Date: Sun Sep 13 17:25:08 2020 +0200 Make diff--refine-hunk bug out less on broken patches * lisp/vc/diff-mode.el (diff--refine-hunk): Don't bug out on broken patches where we can't find the middle. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 1a80d13abd..f223ae48f3 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2173,9 +2173,10 @@ Return new point, if it was moved." (smerge-refine-regions beg-del beg-add beg-add end-add nil #'diff-refine-preproc props-r props-a))))) ('context - (let* ((middle (save-excursion (re-search-forward "^---" end))) + (let* ((middle (save-excursion (re-search-forward "^---" end t))) (other middle)) - (while (re-search-forward "^\\(?:!.*\n\\)+" middle t) + (while (and middle + (re-search-forward "^\\(?:!.*\n\\)+" middle t)) (smerge-refine-regions (match-beginning 0) (match-end 0) (save-excursion (goto-char other) commit dc01b992e27e91631e67bb94f32c23275f1eacfd Author: Lars Ingebrigtsen Date: Sun Sep 13 17:06:35 2020 +0200 Make the eww header work again even if the title is nil * lisp/net/eww.el (eww-update-header-line-format): Don't bug out if the title isn't set at all. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 5fd4490193..69dc2d47d6 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -729,14 +729,15 @@ Currently this means either text/html or application/xhtml+xml." (defun eww-update-header-line-format () (setq header-line-format (and eww-header-line-format - (let ((title (propertize (plist-get eww-data :title) - 'face 'variable-pitch)) - (peer (plist-get eww-data :peer)) + (let ((peer (plist-get eww-data :peer)) (url (propertize (plist-get eww-data :url) - 'face 'variable-pitch))) - (when (zerop (length title)) - (setq title (propertize "[untitled]" 'face 'variable-pitch))) - ;; This connection has is https. + 'face 'variable-pitch)) + (title (propertize + (if (zerop (length (plist-get eww-data :title))) + "[untitled]" + (plist-get eww-data :title)) + 'face 'variable-pitch))) + ;; This connection is https. (when peer (add-face-text-property 0 (length title) (if (plist-get peer :warnings) commit 2bd41321a6d9f6b478dd73aa9a2ea32709e57b32 Author: Dario Gjorgjevski Date: Sun Sep 13 16:49:00 2020 +0200 Make ERC desktop notifications lenient to invalid XML characters * lisp/xml.el (xml-invalid-characters-re): New constant. * lisp/erc/erc-desktop-notifications.el (erc-notifications-notify): Strip IRC control codes and invalid XML characters before notifying (bug#43328). diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el index 1e65f8f427..3a9a4a4bac 100644 --- a/lisp/erc/erc-desktop-notifications.el +++ b/lisp/erc/erc-desktop-notifications.el @@ -31,6 +31,7 @@ (require 'erc) (require 'xml) (require 'notifications) +(require 'erc-goodies) (require 'erc-match) (require 'dbus) @@ -62,12 +63,12 @@ This will replace the last notification sent with this function." ;; setting the current buffer to the existing query buffer) (dbus-ignore-errors (setq erc-notifications-last-notification - (let ((channel (if privp (erc-get-buffer nick) (current-buffer)))) + (let* ((channel (if privp (erc-get-buffer nick) (current-buffer))) + (title (format "%s in %s" (xml-escape-string nick t) channel)) + (body (xml-escape-string (erc-controls-strip msg) t))) (notifications-notify :bus erc-notifications-bus - :title (format "%s in %s" - (xml-escape-string nick) - channel) - :body (xml-escape-string msg) + :title title + :body body :replaces-id erc-notifications-last-notification :app-icon erc-notifications-icon :actions '("default" "Switch to buffer") diff --git a/lisp/xml.el b/lisp/xml.el index 10ef8e2087..236d9cbe6c 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -1015,7 +1015,10 @@ The first line is indented with the optional INDENT-STRING." (defalias 'xml-print 'xml-debug-print) -(defun xml-escape-string (string) +(defconst xml-invalid-characters-re + "[^\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD\U00010000-\U0010FFFF]") + +(defun xml-escape-string (string &optional noerror) "Convert STRING into a string containing valid XML character data. Replace occurrences of &<>\\='\" in STRING with their default XML entity references (e.g., replace each & with &). @@ -1026,15 +1029,17 @@ restriction on \" or \\=', but we just substitute for these too \(as is permitted by the spec). If STRING contains characters that are invalid in XML (as defined -by https://www.w3.org/TR/xml/#charsets), signal an error of type -`xml-invalid-character'." +by https://www.w3.org/TR/xml/#charsets), operate depending on the +value of NOERROR: if it is non-nil, remove them; else, signal an +error of type `xml-invalid-character'." (with-temp-buffer (insert string) (goto-char (point-min)) - (when (re-search-forward - "[^\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD\U00010000-\U0010FFFF]" - nil t) - (signal 'xml-invalid-character (list (char-before) (match-beginning 0)))) + (while (re-search-forward xml-invalid-characters-re nil t) + (if noerror + (replace-match "") + (signal 'xml-invalid-character + (list (char-before) (match-beginning 0))))) (dolist (substitution '(("&" . "&") ("<" . "<") (">" . ">") commit def34a20766ea5179afd5e5ed090a2b86fcccb5e Author: Lars Ingebrigtsen Date: Sun Sep 13 16:46:11 2020 +0200 Don't eagerly store articles in the Agent by default * lisp/gnus/gnus-agent.el (gnus-agent-store-article): Made obsolete. * lisp/gnus/gnus-art.el (gnus-request-article-this-buffer): Don't call it. * lisp/gnus/gnus-async.el (gnus-async-article-callback): Ditto (bug#43356). This partially reverts f3b146e943cd733fb716c75048f24b73826e5f30, which in was response to what appears to be an erroneous feature-request - bug#8502. Instead this should be done instead: “If I read an article while plugged, do they get entered into the Agent?” *No*. If you want this behavior, add ‘gnus-agent-fetch-selected-article’ to ‘gnus-select-article-hook’. diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 03e447e072..d7388d480c 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -3812,6 +3812,7 @@ has been fetched." t)))) (defun gnus-agent-store-article (article group) + (declare (obsolete nil "28.1")) (let* ((gnus-command-method (gnus-find-method-for-group group)) (file (gnus-agent-article-name (number-to-string article) group)) (file-name-coding-system nnmail-pathname-coding-system) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index e0339cc1f3..13a8537997 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -7084,10 +7084,7 @@ If given a prefix, show the hidden text instead." gnus-summary-buffer) (when gnus-keep-backlog (gnus-backlog-enter-article - group article (current-buffer))) - (when (and gnus-agent - (gnus-agent-group-covered-p group)) - (gnus-agent-store-article article group))) + group article (current-buffer)))) (setq result 'article)) (methods (setq gnus-override-method (pop methods))) diff --git a/lisp/gnus/gnus-async.el b/lisp/gnus/gnus-async.el index e3e81c8bbc..9bcb6c33a6 100644 --- a/lisp/gnus/gnus-async.el +++ b/lisp/gnus/gnus-async.el @@ -225,12 +225,6 @@ that was fetched." (save-excursion (save-restriction (narrow-to-region mark (point-max)) - ;; Put the articles into the agent, if they aren't already. - (when (and gnus-agent - (gnus-agent-group-covered-p group)) - (save-restriction - (narrow-to-region mark (point-max)) - (gnus-agent-store-article article group))) ;; Prefetch images for the groups that want that. (when (fboundp 'gnus-html-prefetch-images) (gnus-html-prefetch-images summary)) commit c2dea983e8016dab6e76a10d8b02ffbf894e2760 Author: Lars Ingebrigtsen Date: Sun Sep 13 16:05:19 2020 +0200 Kill gpg-agents started by mml-sec-tests (bug#43358) diff --git a/test/lisp/gnus/mml-sec-tests.el b/test/lisp/gnus/mml-sec-tests.el index b715383c77..ba0783ba8c 100644 --- a/test/lisp/gnus/mml-sec-tests.el +++ b/test/lisp/gnus/mml-sec-tests.el @@ -82,7 +82,9 @@ instead of gpg-agent." ;; not look in the proper places otherwise, see: ;; https://bugs.gnupg.org/gnupg/issue2126 (setenv "GNUPGHOME" epg-gpg-home-directory) - (funcall body)) + (unwind-protect + (funcall body) + (mml-sec-test--kill-gpg-agent))) (error (setenv "GPG_AGENT_INFO" agent-info) (setenv "GNUPGHOME" gpghome) @@ -903,4 +905,16 @@ So the second decryption fails." (let ((with-smime nil)) (ert-run-tests-batch))) +(defun mml-sec-test--kill-gpg-agent () + (dolist (pid (list-system-processes)) + (let ((atts (process-attributes pid))) + (when (and (equal (cdr (assq 'user atts)) (user-login-name)) + (equal (cdr (assq 'comm atts)) "gpg-agent") + (string-match + (concat "homedir.*" + (regexp-quote (expand-file-name "test/data/mml-sec" + source-directory))) + (cdr (assq 'args atts)))) + (call-process "kill" nil nil nil (format "%d" pid)))))) + ;;; mml-sec-tests.el ends here commit 467200dd6edc084b2c8569fe7d11e1b4055718d2 Author: Brian Leung Date: Sun Sep 13 15:48:06 2020 +0200 Update .gitignore with ccls files * .gitignore: Ignore files used by ccls, a language server for C (bug#43365). Copyright-paperwork-exempt: yes diff --git a/.gitignore b/.gitignore index d69a40af8c..94c0009aa2 100644 --- a/.gitignore +++ b/.gitignore @@ -164,6 +164,12 @@ GSYMS GRTAGS GTAGS +# auto-generated compilation database +compile_commands.json + +# ccls, a LSP-compliant server for C +/.ccls-cache + # GNU idutils. ID commit e0f304413c5a70a1aabbfc0236505e22f60fba80 Author: Lars Ingebrigtsen Date: Sun Sep 13 15:33:58 2020 +0200 Doc string clarification in file-directory-p * src/fileio.c (Ffile_directory_p): Mention that "" is a special case (bug#43375). diff --git a/src/fileio.c b/src/fileio.c index 1e4ca82e5f..6d0bafa8cf 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2919,6 +2919,11 @@ DEFUN ("file-directory-p", Ffile_directory_p, Sfile_directory_p, 1, 1, 0, doc: /* Return t if FILENAME names an existing directory. Return nil if FILENAME does not name a directory, or if there was trouble determining whether FILENAME is a directory. + +As a special case, this function will also return t if FILENAME is the +empty string (\"\"). This quirk is due to Emacs interpreting the +empty string (in some cases) as the current directory. + Symbolic links to directories count as directories. See `file-symlink-p' to distinguish symlinks. */) (Lisp_Object filename) commit 2605eb9d0ef7e819126e78684bd105c8cd27aff8 Author: Kiso Katsuyuki Date: Sun Sep 13 15:23:25 2020 +0200 Clarify when tab-line-switch-cycling is used * lisp/tab-line.el (tab-line-switch-cycling): Clarify when the variable is used. Copyright-paperwork-exempt: yes diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 108f9f7d99..61a0201b29 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -646,7 +646,8 @@ using the `previous-buffer' command." "Enable cycling tab switch. If non-nil, `tab-line-switch-to-prev-tab' in the first tab switches to the last tab and `tab-line-switch-to-next-tab' in the -last tab switches to the first tab." +last tab switches to the first tab. This variable is not consulted +when `tab-line-tabs-function' is `tab-line-tabs-window-buffers'" :type 'boolean :group 'tab-line :version "28.1") commit 1a4d8feb17ee926d3703a7da0e22f50dbbededd5 Author: Stefan Kangas Date: Sun Sep 13 15:09:20 2020 +0200 * lisp/time.el (display-time-world): Make obsolete. diff --git a/lisp/time.el b/lisp/time.el index 534f128342..e2fab4a141 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -551,9 +551,9 @@ See `world-clock'." (delete-char -1)) (goto-char (point-min))) -;; Old name -- preserved for backwards compatibility. ;;;###autoload -(defalias 'display-time-world #'world-clock) +(define-obsolete-function-alias 'display-time-world + #'world-clock "28.1") ;;;###autoload (defun world-clock () commit 06d86b954d2cdb40c77fdce2264f660c26955171 Author: Stefan Kangas Date: Thu Sep 10 01:42:53 2020 +0200 Make M-x show what aliases point to (Bug#43300) * lisp/simple.el (read-extended-command--annotation): Show an annotation for aliases saying what it points to. diff --git a/lisp/simple.el b/lisp/simple.el index 16ff8637b9..b00f6bba06 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1887,8 +1887,11 @@ to get different commands to edit and resubmit." (defun read-extended-command--annotation (command-name) (let* ((fun (and (stringp command-name) (intern-soft command-name))) (binding (where-is-internal fun overriding-local-map t)) - (obsolete (get fun 'byte-obsolete-info))) - (cond (obsolete + (obsolete (get fun 'byte-obsolete-info)) + (alias (symbol-function fun))) + (cond ((symbolp alias) + (format " (%s)" alias)) + (obsolete (format " (%s)" (car obsolete))) ((and binding (not (stringp binding))) (format " (%s)" (key-description binding)))))) commit 1b0a922a19bf7b380abe89a4e92176c779c26c2d Author: Stefan Kangas Date: Thu Sep 10 01:32:24 2020 +0200 Make M-x show obsolete commands (Bug#43300) * lisp/simple.el (read-extended-command): Don't hide obsolete commands. (read-extended-command--annotation): Show an annotation for obsolete commands that says what their new name is. diff --git a/lisp/simple.el b/lisp/simple.el index b5002dd189..16ff8637b9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1881,22 +1881,17 @@ to get different commands to edit and resubmit." '(metadata (annotation-function . read-extended-command--annotation) (category . command)) - (let ((pred - (if (memq action '(nil t)) - ;; Exclude obsolete commands from completions. - (lambda (sym) - (and (funcall pred sym) - (or (equal string (symbol-name sym)) - (not (get sym 'byte-obsolete-info))))) - pred))) - (complete-with-action action obarray string pred)))) + (complete-with-action action obarray string pred))) #'commandp t nil 'extended-command-history))) (defun read-extended-command--annotation (command-name) - (let* ((function (and (stringp command-name) (intern-soft command-name))) - (binding (where-is-internal function overriding-local-map t))) - (when (and binding (not (stringp binding))) - (format " (%s)" (key-description binding))))) + (let* ((fun (and (stringp command-name) (intern-soft command-name))) + (binding (where-is-internal fun overriding-local-map t)) + (obsolete (get fun 'byte-obsolete-info))) + (cond (obsolete + (format " (%s)" (car obsolete))) + ((and binding (not (stringp binding))) + (format " (%s)" (key-description binding)))))) (defcustom suggest-key-bindings t "Non-nil means show the equivalent key-binding when M-x command has one. commit 9ca83cdd79747fb09f714593243060b17b34e039 Author: Lars Ingebrigtsen Date: Sun Sep 13 14:58:24 2020 +0200 Revert "Use format-prompt in read-file-name calls that have a default" This reverts commit de4f347901adffd07bc9bff028dc073fb3c6df33. read-file-name already displays a long path when given a default (like INITIAL in many other prompting functions), so using format-prompt here is superfluous. diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 50d0011e81..be6f9ee343 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -233,7 +233,7 @@ If VERBOSE is non-nil, display a message indicating where abbrevs have been saved." (interactive (list - (read-file-name (format-prompt "Write abbrev file" abbrev-file-name) + (read-file-name "Write abbrev file: " (file-name-directory (expand-file-name abbrev-file-name)) abbrev-file-name))) (or (and file (> (length file) 0)) @@ -262,7 +262,7 @@ have been saved." (defun abbrev-edit-save-to-file (file) "Save all user-level abbrev definitions in current buffer to FILE." (interactive - (list (read-file-name (format-prompt "Save abbrevs to file" abbrev-file-name) + (list (read-file-name "Save abbrevs to file: " (file-name-directory (expand-file-name abbrev-file-name)) abbrev-file-name))) diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 206c87223c..dcb03adadd 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -1425,8 +1425,8 @@ for a file, defaulting to the file defined by variable bookmark-default-file))) (if parg ;; This should be part of the `interactive' spec. - (read-file-name (format-prompt "File to save bookmarks in" - default) + (read-file-name (format "File to save bookmarks in: (%s) " + default) (file-name-directory default) default) default)))) (bookmark-write-file file) @@ -1538,7 +1538,7 @@ unique numeric suffixes \"<2>\", \"<3>\", etc." (or (car bookmark-bookmarks-timestamp) (expand-file-name bookmark-default-file)))) (prefix current-prefix-arg)) - (list (read-file-name (format-prompt "Load bookmarks from" default) + (list (read-file-name (format "Load bookmarks from: (%s) " default) (file-name-directory default) default 'confirm) prefix nil prefix))) (let* ((file (expand-file-name file)) diff --git a/lisp/dired.el b/lisp/dired.el index 6e7b88f019..15592ceb08 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -896,9 +896,8 @@ ERROR can be a string with the error message." (if (next-read-file-uses-dialog-p) (read-directory-name (format "Dired %s(directory): " str) nil default-directory nil) - (read-file-name (format-prompt "Dired %s(directory)" - default-directory str) - nil default-directory))))) + (read-file-name (format "Dired %s(directory): " str) + nil default-directory nil))))) ;; We want to switch to a more sophisticated version of ;; dired-read-dir-and-switches like the following, if there is a way diff --git a/lisp/files.el b/lisp/files.el index 71951dd349..e6629d2a21 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4527,12 +4527,13 @@ Interactively, confirmation is required unless you supply a prefix argument." ;; (interactive "FWrite file: ") (interactive (list (if buffer-file-name - (read-file-name "Write file: ") - (read-file-name - (format-prompt "Write file" (file-name-nondirectory (buffer-name))) - default-directory - (expand-file-name (file-name-nondirectory (buffer-name)) - default-directory))) + (read-file-name "Write file: " + nil nil nil nil) + (read-file-name "Write file: " default-directory + (expand-file-name + (file-name-nondirectory (buffer-name)) + default-directory) + nil nil)) (not current-prefix-arg))) (or (null filename) (string-equal filename "") (progn @@ -5270,13 +5271,10 @@ Before and after saving the buffer, this function runs (unless (run-hook-with-args-until-success 'write-contents-functions) ;; If buffer has no file name, ask user for one. (or buffer-file-name - (let* ((default (expand-file-name (buffer-name))) - (filename - (expand-file-name - (read-file-name - (format-prompt "File to save in" - (file-name-nondirectory default)) - nil default)))) + (let ((filename + (expand-file-name + (read-file-name "File to save in: " + nil (expand-file-name (buffer-name)))))) (if (file-exists-p filename) (if (file-directory-p filename) ;; Signal an error if the user specified the name of an diff --git a/lisp/gnus/gnus-bookmark.el b/lisp/gnus/gnus-bookmark.el index 7e9684394a..1b00bbbc69 100644 --- a/lisp/gnus/gnus-bookmark.el +++ b/lisp/gnus/gnus-bookmark.el @@ -315,7 +315,8 @@ affect point." "Load Gnus bookmarks from FILE (which must be in bookmark format)." (interactive (list (read-file-name - (format-prompt "Load Gnus bookmarks from" gnus-bookmark-default-file) + (format "Load Gnus bookmarks from: (%s) " + gnus-bookmark-default-file) "~/" gnus-bookmark-default-file 'confirm))) (setq file (expand-file-name file)) (if (file-readable-p file) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 0e20d0f353..a9943ccd7f 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1813,9 +1813,8 @@ one of them returns non-nil." ;;;###autoload (defun doc-file-to-man (file) "Produce an nroff buffer containing the doc-strings from the DOC file." - (interactive (list (read-file-name (format-prompt "Name of DOC file" - internal-doc-file-name) - doc-directory internal-doc-file-name t))) + (interactive (list (read-file-name "Name of DOC file: " doc-directory + internal-doc-file-name t))) (or (file-readable-p file) (error "Cannot read file `%s'" file)) (pop-to-buffer (generate-new-buffer "*man-doc*")) @@ -1844,9 +1843,8 @@ one of them returns non-nil." ;;;###autoload (defun doc-file-to-info (file) "Produce a texinfo buffer with sorted doc-strings from the DOC file." - (interactive (list (read-file-name (format-prompt "Name of DOC file" - internal-doc-file-name) - doc-directory internal-doc-file-name t))) + (interactive (list (read-file-name "Name of DOC file: " doc-directory + internal-doc-file-name t))) (or (file-readable-p file) (error "Cannot read file `%s'" file)) (let ((i 0) type name doc alist) diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index 0b9af8292b..29c6dcf40e 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -269,7 +269,7 @@ TRUNCATED is non-nil if the text of this entity was truncated." (unless (y-or-n-p "This entity is truncated; save anyway? ") (error "Aborted"))) (setq filename (expand-file-name - (read-file-name (format-prompt "Save as" filename) + (read-file-name (format "Save as (default: %s): " filename) directory (expand-file-name filename directory)) directory)) diff --git a/lisp/misearch.el b/lisp/misearch.el index 36a7afe518..958c10a1bf 100644 --- a/lisp/misearch.el +++ b/lisp/misearch.el @@ -316,10 +316,9 @@ Every next/previous file in the defined sequence is visited by (defun multi-isearch-read-files () "Return a list of files specified interactively, one by one." ;; Most code from `multi-occur'. - (let* ((files (list (read-file-name - (format-prompt "First file to search" - (file-name-nondirectory buffer-file-name)) - default-directory buffer-file-name))) + (let* ((files (list (read-file-name "First file to search: " + default-directory + buffer-file-name))) (file nil)) (while (not (string-equal (setq file (read-file-name diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 81cb2b7cd7..2c5c36504a 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -292,7 +292,7 @@ file the tag was in." (or (locate-dominating-file default-directory "TAGS") default-directory))) (list (read-file-name - (format-prompt "Visit tags table" "TAGS") + "Visit tags table (default TAGS): " ;; default to TAGS from default-directory up to root. default-tag-dir (expand-file-name "TAGS" default-tag-dir) @@ -625,7 +625,7 @@ Returns t if it visits a tags table, or nil if there are no more in the list." (car list)) ;; Finally, prompt the user for a file name. (expand-file-name - (read-file-name (format-prompt "Visit tags table" "TAGS") + (read-file-name "Visit tags table (default TAGS): " default-directory "TAGS" t)))))) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index f272db1f7d..1a80d13abd 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -911,11 +911,10 @@ like \(diff-merge-strings \"b/foo\" \"b/bar\" \"/a/c/foo\")." If the OLD prefix arg is passed, tell the file NAME of the old file." (interactive (let* ((old current-prefix-arg) - (fs (diff-hunk-file-names current-prefix-arg)) - (default (diff-find-file-name old 'noprompt))) + (fs (diff-hunk-file-names current-prefix-arg))) (unless fs (error "No file name to look for")) - (list old (read-file-name (format-prompt "File for %s" default (car fs)) - nil default t)))) + (list old (read-file-name (format "File for %s: " (car fs)) + nil (diff-find-file-name old 'noprompt) t)))) (let ((fs (diff-hunk-file-names old))) (unless fs (error "No file name to look for")) (push (cons fs name) diff-remembered-files-alist))) diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el index 8b122093c1..f6af5a4555 100644 --- a/lisp/vc/ediff-ptch.el +++ b/lisp/vc/ediff-ptch.el @@ -499,11 +499,15 @@ are two possible targets for this %spatch. However, these files do not exist." patch-file-name) (setq patch-file-name (read-file-name - (format-prompt "Patch is in file" - (and buffer-file-name + (format "Patch is in file%s: " + (cond ((and buffer-file-name (equal (expand-file-name dir) - (file-name-directory buffer-file-name)) - (file-name-nondirectory buffer-file-name))) + (file-name-directory buffer-file-name))) + (concat + " (default " + (file-name-nondirectory buffer-file-name) + ")")) + (t ""))) dir buffer-file-name 'must-match)) (if (file-directory-p patch-file-name) (error "Patch file cannot be a directory: %s" patch-file-name) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 983fb598f7..4cbd2658f8 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -953,9 +953,10 @@ use." ;; repository, make sure it's a parent of ;; file. (read-file-name - (format-prompt "create %s repository in" def-dir bk) + (format "create %s repository in: " bk) default-directory def-dir t nil (lambda (arg) + (message "arg %s" arg) (and (file-directory-p arg) (string-prefix-p (expand-file-name arg) def-dir))))))) (let ((default-directory repo-dir)) @@ -2899,10 +2900,10 @@ backend to NEW-BACKEND, and unregister FILE from the current backend. "Delete file and mark it as such in the version control system. If called interactively, read FILE, defaulting to the current buffer's file name if it's under version control." - (interactive (list (let ((default (when (vc-backend buffer-file-name) - buffer-file-name))) - (read-file-name "VC delete file" default) - nil default t))) + (interactive (list (read-file-name "VC delete file: " nil + (when (vc-backend buffer-file-name) + buffer-file-name) + t))) (setq file (expand-file-name file)) (let ((buf (get-file-buffer file)) (backend (vc-backend file))) @@ -2943,10 +2944,9 @@ buffer's file name if it's under version control." "Rename file OLD to NEW in both work area and repository. If called interactively, read OLD and NEW, defaulting OLD to the current buffer's file name if it's under version control." - (interactive (list (let ((default (when (vc-backend buffer-file-name) - buffer-file-name))) - (read-file-name (format-prompt "VC rename file" default) - nil default t)) + (interactive (list (read-file-name "VC rename file: " nil + (when (vc-backend buffer-file-name) + buffer-file-name) t) (read-file-name "Rename to: "))) ;; in CL I would have said (setq new (merge-pathnames new old)) (let ((old-base (file-name-nondirectory old))) diff --git a/lisp/xwidget.el b/lisp/xwidget.el index d6ca300f3a..074320855c 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el @@ -326,15 +326,14 @@ If non-nil, plugins are enabled. Otherwise, disabled.")) FILE-NAME combined with `xwidget-webkit-download-dir' is the default file name of the prompt when reading. When the file name the user specified is a directory, URL is saved at the specified directory as FILE-NAME." - (let* ((default (when file-name - (expand-file-name - file-name - xwidget-webkit-download-dir))) - (save-name - (read-file-name - (format-prompt "Save URL `%s' of type `%s' in file/directory" - default url mime-type) - xwidget-webkit-download-dir default))) + (let ((save-name (read-file-name + (format "Save URL `%s' of type `%s' in file/directory: " + url mime-type) + xwidget-webkit-download-dir + (when file-name + (expand-file-name + file-name + xwidget-webkit-download-dir))))) (if (file-directory-p save-name) (setq save-name (expand-file-name (file-name-nondirectory file-name) save-name))) commit e1e93da9a9b668d19806161a29b393140324b4d2 Author: Lars Ingebrigtsen Date: Sun Sep 13 14:37:54 2020 +0200 Make `ascii' a coding system alias for `us-ascii' * lisp/international/mule-conf.el (ascii): Define `ascii' as a coding system alias to `us-ascii' (bug#43351). diff --git a/etc/NEWS b/etc/NEWS index ddc2fb9d60..2fe66be15f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1295,6 +1295,9 @@ ledit.el, lmenu.el, lucid.el and old-whitespace.el. * Lisp Changes in Emacs 28.1 +--- +*** 'ascii' is now a coding system alias for 'us-ascii'. + +++ *** New function 'file-backup-file-names'. This function returns the list of file names of all the backup files diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el index edda79ba4e..c84f0a4990 100644 --- a/lisp/international/mule-conf.el +++ b/lisp/international/mule-conf.el @@ -1508,6 +1508,7 @@ for decoding and encoding files, process I/O, etc." :mime-charset 'us-ascii) (define-coding-system-alias 'iso-safe 'us-ascii) +(define-coding-system-alias 'ascii 'us-ascii) (define-coding-system 'utf-7 "UTF-7 encoding of Unicode (RFC 2152)." commit a6321fd7990f4e8e46e850bf60cc49925592ec2a Author: Michael Albinus Date: Sun Sep 13 13:25:52 2020 +0200 Fix a conversion failure in tramp-archive-tests (Bug#43353) * test/lisp/net/tramp-archive-tests.el (tramp-archive-test-file-archive-hexlified): New defun. (tramp-archive-test02-file-name-dissect): Use it. (Bug#43353) diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el index 8c75d91bb5..9a2319126a 100644 --- a/test/lisp/net/tramp-archive-tests.el +++ b/test/lisp/net/tramp-archive-tests.el @@ -48,6 +48,12 @@ (expand-file-name "foo.tar.gz" tramp-archive-test-resource-directory)) "The test file archive.") +(defun tramp-archive-test-file-archive-hexlified () + "Return hexlified `tramp-archive-test-file-archive'. +Do not hexlify \"/\". This hexlified string is used in `file:///' URLs." + (let* ((url-unreserved-chars (cons ?/ url-unreserved-chars))) + (url-hexify-string tramp-archive-test-file-archive))) + (defconst tramp-archive-test-archive (file-name-as-directory tramp-archive-test-file-archive) "The test archive.") @@ -174,7 +180,8 @@ variables, so we check the Emacs version directly." (should (string-equal host - (url-hexify-string (concat "file://" tramp-archive-test-file-archive)))) + (url-hexify-string + (concat "file://" (tramp-archive-test-file-archive-hexlified))))) (should-not port) (should (string-equal localname "/")) (should (string-equal archive tramp-archive-test-file-archive))) @@ -193,7 +200,8 @@ variables, so we check the Emacs version directly." (should (string-equal host - (url-hexify-string (concat "file://" tramp-archive-test-file-archive)))) + (url-hexify-string + (concat "file://" (tramp-archive-test-file-archive-hexlified))))) (should-not port) (should (string-equal localname "/foo")) (should (string-equal archive tramp-archive-test-file-archive))) @@ -237,7 +245,8 @@ variables, so we check the Emacs version directly." ;; archive boundaries. So we must cut the ;; trailing slash ourselves. (substring - (file-name-directory tramp-archive-test-file-archive) + (file-name-directory + (tramp-archive-test-file-archive-hexlified)) 0 -1))) nil "/")) (file-name-nondirectory tramp-archive-test-file-archive)))))