diff options
| author | Paul Eggert | 2019-07-09 13:10:27 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-07-09 13:11:45 -0700 |
| commit | 412139f1be7415791a0d964f95f319c86eded426 (patch) | |
| tree | f6f2326b39ea44a93004df25ba98ab210246860f /src/eval.c | |
| parent | ce59b41a28aba629dd126e7af3c6e45909de6a83 (diff) | |
| download | emacs-412139f1be7415791a0d964f95f319c86eded426.tar.gz emacs-412139f1be7415791a0d964f95f319c86eded426.zip | |
Do not alter match data in Fcapitalize etc.
Without this patch, (capitalize "x") can alter the match data,
which is not what users expect. Problem found by running
morse-tests-unnato-region in a stripped-down Emacs.
Perhaps ‘load’ should also save and restore the match data?
That would be a simpler fix, though arguably incompatible.
* src/lread.c (save_match_data_load): New function.
* src/chartab.c (uniprop_table):
* src/doc.c (reread_doc_file):
* src/eval.c (Fautoload_do_load):
* src/fns.c (Frequire): Use it.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/eval.c b/src/eval.c index 8f569949036..02a6c3555a9 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -2049,9 +2049,6 @@ it defines a macro. */) | |||
| 2049 | 2049 | ||
| 2050 | CHECK_SYMBOL (funname); | 2050 | CHECK_SYMBOL (funname); |
| 2051 | 2051 | ||
| 2052 | /* Preserve the match data. */ | ||
| 2053 | record_unwind_save_match_data (); | ||
| 2054 | |||
| 2055 | /* If autoloading gets an error (which includes the error of failing | 2052 | /* If autoloading gets an error (which includes the error of failing |
| 2056 | to define the function being called), we use Vautoload_queue | 2053 | to define the function being called), we use Vautoload_queue |
| 2057 | to undo function definitions and `provide' calls made by | 2054 | to undo function definitions and `provide' calls made by |
| @@ -2067,7 +2064,7 @@ it defines a macro. */) | |||
| 2067 | so don't signal an error if autoloading fails. */ | 2064 | so don't signal an error if autoloading fails. */ |
| 2068 | Lisp_Object ignore_errors | 2065 | Lisp_Object ignore_errors |
| 2069 | = (EQ (kind, Qt) || EQ (kind, Qmacro)) ? Qnil : macro_only; | 2066 | = (EQ (kind, Qt) || EQ (kind, Qmacro)) ? Qnil : macro_only; |
| 2070 | Fload (Fcar (Fcdr (fundef)), ignore_errors, Qt, Qnil, Qt); | 2067 | save_match_data_load (Fcar (Fcdr (fundef)), ignore_errors, Qt, Qnil, Qt); |
| 2071 | 2068 | ||
| 2072 | /* Once loading finishes, don't undo it. */ | 2069 | /* Once loading finishes, don't undo it. */ |
| 2073 | Vautoload_queue = Qt; | 2070 | Vautoload_queue = Qt; |