diff options
| author | Eli Zaretskii | 2021-11-03 20:26:28 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2021-11-03 20:26:29 +0200 |
| commit | f78c819d9569ad18cc048554ddeb331a27a58989 (patch) | |
| tree | bd9e61206672a71af7724a079305b07cc11e49fa | |
| parent | d8523060e5dcf285a5468377720bed6a34599df6 (diff) | |
| parent | 3e4eb54db49e23b593664e4a3de3d3d744de61b7 (diff) | |
| download | emacs-f78c819d9569ad18cc048554ddeb331a27a58989.tar.gz emacs-f78c819d9569ad18cc048554ddeb331a27a58989.zip | |
Merge from origin/emacs-28
3e4eb54 ; * etc/PROBLEMS: Minor copyedits of the last change. (Bug#5...
35bc211 Document a macOS error message when opening Emacs
4df9998 Fix header-line and tab-line when mode-line-compact is set
81915a9 Add manual section about how to avoid regexp problems
a16e66c Clarify build environment
6ab6b2f Clarify build directory structure
9d61620 * src/pdumper.c (dump_do_dump_relocation): Add sanity check.
| -rw-r--r-- | admin/nt/dist-build/README-scripts | 37 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/searching.texi | 77 | ||||
| -rw-r--r-- | etc/PROBLEMS | 29 | ||||
| -rw-r--r-- | src/pdumper.c | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 3 |
6 files changed, 115 insertions, 35 deletions
diff --git a/admin/nt/dist-build/README-scripts b/admin/nt/dist-build/README-scripts index f27bcd3bd66..6b1adbe03e1 100644 --- a/admin/nt/dist-build/README-scripts +++ b/admin/nt/dist-build/README-scripts | |||
| @@ -3,6 +3,15 @@ Distribution Build Scripts for Windows | |||
| 3 | 3 | ||
| 4 | The scripts are used to build the binary distribution zip files for windows. | 4 | The scripts are used to build the binary distribution zip files for windows. |
| 5 | 5 | ||
| 6 | Environment | ||
| 7 | ----------- | ||
| 8 | |||
| 9 | A full installation of msys2 is required along for the build. The | ||
| 10 | various dependencies of Emacs need to be installed also. These change | ||
| 11 | over time, but are listed in build-deps-zips.py. | ||
| 12 | |||
| 13 | |||
| 14 | |||
| 6 | File System Organization | 15 | File System Organization |
| 7 | ------------------------ | 16 | ------------------------ |
| 8 | 17 | ||
| @@ -15,15 +24,19 @@ The file system needs to be organized like so: | |||
| 15 | 24 | ||
| 16 | ~/emacs-build/git | 25 | ~/emacs-build/git |
| 17 | 26 | ||
| 18 | Contains a checkout of the Emacs git repository, organized according | 27 | Contains checkouts and worktrees of the Emacs git repository, |
| 19 | to branches, with git worktree | 28 | organized according to branches. |
| 20 | 29 | ||
| 21 | ~/emacs-build/git/emacs-$branch | 30 | ~/emacs-build/git/master |
| 22 | 31 | ||
| 23 | A branch of the git repository containing the current release | 32 | A checkout out of the master branch of the Emacs git repository. |
| 33 | |||
| 34 | ~/emacs-build/git/emacs-$major-version | ||
| 35 | |||
| 36 | A worktree of the git repository containing the current release | ||
| 24 | branch. This has to be created by hand. | 37 | branch. This has to be created by hand. |
| 25 | 38 | ||
| 26 | ~/emacs-build/git/emacs-$version | 39 | ~/emacs-build/git/emacs-$release-version |
| 27 | 40 | ||
| 28 | A branch of the git repository containing the last release. The | 41 | A branch of the git repository containing the last release. The |
| 29 | build-zips.sh file will create this for you. | 42 | build-zips.sh file will create this for you. |
| @@ -63,8 +76,8 @@ uploaded. | |||
| 63 | Build Process | 76 | Build Process |
| 64 | ------------- | 77 | ------------- |
| 65 | 78 | ||
| 66 | For each major version | 79 | |
| 67 | ---------------------- | 80 | ### For each major version |
| 68 | 81 | ||
| 69 | The dependencies files need to be created. This can be around the time | 82 | The dependencies files need to be created. This can be around the time |
| 70 | of the pre-tests, then used for all releases of that version, to | 83 | of the pre-tests, then used for all releases of that version, to |
| @@ -88,8 +101,7 @@ files will be created in ~/emacs-upload from where they can be signed | |||
| 88 | and uploaded with `gnupload`. | 101 | and uploaded with `gnupload`. |
| 89 | 102 | ||
| 90 | 103 | ||
| 91 | For snapshots from Master | 104 | ### For snapshots from Master |
| 92 | ------------------------- | ||
| 93 | 105 | ||
| 94 | Snapshots are generally created from master when there is a release | 106 | Snapshots are generally created from master when there is a release |
| 95 | branch on which a release has already been created. At this point, | 107 | branch on which a release has already been created. At this point, |
| @@ -110,8 +122,7 @@ used. | |||
| 110 | Now, run `build-zips.sh -s` to build a snapshot release. | 122 | Now, run `build-zips.sh -s` to build a snapshot release. |
| 111 | 123 | ||
| 112 | 124 | ||
| 113 | For snapshots from a Release Branch | 125 | ### For snapshots from a Release Branch |
| 114 | ----------------------------------- | ||
| 115 | 126 | ||
| 116 | Snapshots can be built from a release branch; this is really only | 127 | Snapshots can be built from a release branch; this is really only |
| 117 | useful before a pre-test has happened. | 128 | useful before a pre-test has happened. |
| @@ -123,8 +134,8 @@ version number must be added to the command line with `build-zips.sh | |||
| 123 | the version (e.g emacs-27-2019-12-26.zip) rather than than the Emacs | 134 | the version (e.g emacs-27-2019-12-26.zip) rather than than the Emacs |
| 124 | version (e.g emacs-27.0.50.zip). | 135 | version (e.g emacs-27.0.50.zip). |
| 125 | 136 | ||
| 126 | For snapshots from another branch | 137 | |
| 127 | --------------------------------- | 138 | ### For snapshots from another branch |
| 128 | 139 | ||
| 129 | Snapshots can be build from any other branch. There is rarely a need | 140 | Snapshots can be build from any other branch. There is rarely a need |
| 130 | to do this, except where some significant, wide-ranging feature is | 141 | to do this, except where some significant, wide-ranging feature is |
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index c4bd97bf815..6057691239f 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -1316,6 +1316,7 @@ Regular Expressions | |||
| 1316 | * Rx Notation:: An alternative, structured regexp notation. | 1316 | * Rx Notation:: An alternative, structured regexp notation. |
| 1317 | @end ifnottex | 1317 | @end ifnottex |
| 1318 | * Regexp Functions:: Functions for operating on regular expressions. | 1318 | * Regexp Functions:: Functions for operating on regular expressions. |
| 1319 | * Regexp Problems:: Some problems and how they may be avoided. | ||
| 1319 | 1320 | ||
| 1320 | Syntax of Regular Expressions | 1321 | Syntax of Regular Expressions |
| 1321 | 1322 | ||
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index f5a42406ae0..296ce20169c 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -263,6 +263,7 @@ case-sensitive. | |||
| 263 | * Rx Notation:: An alternative, structured regexp notation. | 263 | * Rx Notation:: An alternative, structured regexp notation. |
| 264 | @end ifnottex | 264 | @end ifnottex |
| 265 | * Regexp Functions:: Functions for operating on regular expressions. | 265 | * Regexp Functions:: Functions for operating on regular expressions. |
| 266 | * Regexp Problems:: Some problems and how they may be avoided. | ||
| 266 | @end menu | 267 | @end menu |
| 267 | 268 | ||
| 268 | @node Syntax of Regexps | 269 | @node Syntax of Regexps |
| @@ -343,15 +344,6 @@ first tries to match all three @samp{a}s; but the rest of the pattern is | |||
| 343 | The next alternative is for @samp{a*} to match only two @samp{a}s. With | 344 | The next alternative is for @samp{a*} to match only two @samp{a}s. With |
| 344 | this choice, the rest of the regexp matches successfully. | 345 | this choice, the rest of the regexp matches successfully. |
| 345 | 346 | ||
| 346 | @strong{Warning:} Nested repetition operators can run for a very | ||
| 347 | long time, if they lead to ambiguous matching. For | ||
| 348 | example, trying to match the regular expression @samp{\(x+y*\)*a} | ||
| 349 | against the string @samp{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz} could | ||
| 350 | take hours before it ultimately fails. Emacs may try each way of | ||
| 351 | grouping the @samp{x}s before concluding that none of them can work. | ||
| 352 | In general, avoid expressions that can match the same string in | ||
| 353 | multiple ways. | ||
| 354 | |||
| 355 | @item @samp{+} | 347 | @item @samp{+} |
| 356 | @cindex @samp{+} in regexp | 348 | @cindex @samp{+} in regexp |
| 357 | is a postfix operator, similar to @samp{*} except that it must match | 349 | is a postfix operator, similar to @samp{*} except that it must match |
| @@ -1884,6 +1876,73 @@ variables that may be set to a pattern that actually matches | |||
| 1884 | something. | 1876 | something. |
| 1885 | @end defvar | 1877 | @end defvar |
| 1886 | 1878 | ||
| 1879 | @node Regexp Problems | ||
| 1880 | @subsection Problems with Regular Expressions | ||
| 1881 | @cindex regular expression problems | ||
| 1882 | @cindex regexp stack overflow | ||
| 1883 | @cindex stack overflow in regexp | ||
| 1884 | |||
| 1885 | The Emacs regexp implementation, like many of its kind, is generally | ||
| 1886 | robust but occasionally causes trouble in either of two ways: matching | ||
| 1887 | may run out of internal stack space and signal an error, and it can | ||
| 1888 | take a long time to complete. The advice below will make these | ||
| 1889 | symptoms less likely and help alleviate problems that do arise. | ||
| 1890 | |||
| 1891 | @itemize | ||
| 1892 | @item | ||
| 1893 | Anchor regexps at the beginning of a line, string or buffer using | ||
| 1894 | zero-width assertions (@samp{^} and @code{\`}). This takes advantage | ||
| 1895 | of fast paths in the implementation and can avoid futile matching | ||
| 1896 | attempts. Other zero-width assertions may also bring benefits by | ||
| 1897 | causing a match to fail early. | ||
| 1898 | |||
| 1899 | @item | ||
| 1900 | Avoid or-patterns in favour of character alternatives: write | ||
| 1901 | @samp{[ab]} instead of @samp{a\|b}. Recall that @samp{\s-} and @samp{\sw} | ||
| 1902 | are equivalent to @samp{[[:space:]]} and @samp{[[:word:]]}, respectively. | ||
| 1903 | |||
| 1904 | @item | ||
| 1905 | Since the last branch of an or-pattern does not add a backtrack point | ||
| 1906 | on the stack, consider putting the most likely matched pattern last. | ||
| 1907 | For example, @samp{^\(?:a\|.b\)*c} will run out of stack if trying to | ||
| 1908 | match a very long string of @samp{a}s, but the equivalent | ||
| 1909 | @samp{^\(?:.b\|a\)*c} will not. | ||
| 1910 | |||
| 1911 | (It is a trade-off: successfully matched or-patterns run faster with | ||
| 1912 | the most frequently matched pattern first.) | ||
| 1913 | |||
| 1914 | @item | ||
| 1915 | Try to ensure that any part of the text can only match in a single | ||
| 1916 | way. For example, @samp{a*a*} will match the same set of strings as | ||
| 1917 | @samp{a*}, but the former can do so in many ways and will therefore | ||
| 1918 | cause slow backtracking if the match fails later on. Make or-pattern | ||
| 1919 | branches mutually exclusive if possible, so that matching will not go | ||
| 1920 | far into more than one branch before failing. | ||
| 1921 | |||
| 1922 | Be especially careful with nested repetitions: they can easily result | ||
| 1923 | in very slow matching in the presence of ambiguities. For example, | ||
| 1924 | @samp{\(?:a*b*\)+c} will take a long time attempting to match even a | ||
| 1925 | moderately long string of @samp{a}s before failing. The equivalent | ||
| 1926 | @samp{\(?:a\|b\)*c} is much faster, and @samp{[ab]*c} better still. | ||
| 1927 | |||
| 1928 | @item | ||
| 1929 | Don't use capturing groups unless they are really needed; that is, use | ||
| 1930 | @samp{\(?:@dots{}\)} instead of @samp{\(@dots{}\)} for bracketing | ||
| 1931 | purposes. | ||
| 1932 | |||
| 1933 | @ifnottex | ||
| 1934 | @item | ||
| 1935 | Consider using @code{rx} (@pxref{Rx Notation}); it can optimise some | ||
| 1936 | or-patterns automatically and will never introduce capturing groups | ||
| 1937 | unless explicitly requested. | ||
| 1938 | @end ifnottex | ||
| 1939 | @end itemize | ||
| 1940 | |||
| 1941 | If you run into regexp stack overflow despite following the above | ||
| 1942 | advice, don't be afraid of performing the matching in multiple | ||
| 1943 | function calls, each using a simpler regexp where backtracking can | ||
| 1944 | more easily be contained. | ||
| 1945 | |||
| 1887 | @node Regexp Search | 1946 | @node Regexp Search |
| 1888 | @section Regular Expression Searching | 1947 | @section Regular Expression Searching |
| 1889 | @cindex regular expression searching | 1948 | @cindex regular expression searching |
diff --git a/etc/PROBLEMS b/etc/PROBLEMS index e1bfc2b032b..825801db912 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS | |||
| @@ -742,18 +742,6 @@ completed" message that tls.el relies upon, causing affected Emacs | |||
| 742 | functions to hang. To work around the problem, use older or newer | 742 | functions to hang. To work around the problem, use older or newer |
| 743 | versions of gnutls-cli, or use Emacs's built-in gnutls support. | 743 | versions of gnutls-cli, or use Emacs's built-in gnutls support. |
| 744 | 744 | ||
| 745 | *** Stack overflow in regexp matcher. | ||
| 746 | Due to fundamental limitations in the way Emacs' regular expression | ||
| 747 | engine is designed, you might run into combinatorial explosions in | ||
| 748 | backtracking with certain regexps. | ||
| 749 | |||
| 750 | Avoid "\(...\(...\)*...\)*" and "\(...\)*\(...\)*". Look for a way to | ||
| 751 | anchor your regular expression, to avoid matching the null string in | ||
| 752 | infinite ways. The latter is what creates backtrack points, and | ||
| 753 | eventual overflow in practice. | ||
| 754 | |||
| 755 | (Also prefer "\(?:...\)" to "\(...\)" unless you need the latter.) | ||
| 756 | |||
| 757 | * Runtime problems related to font handling | 745 | * Runtime problems related to font handling |
| 758 | 746 | ||
| 759 | ** Characters are displayed as empty boxes or with wrong font under X. | 747 | ** Characters are displayed as empty boxes or with wrong font under X. |
| @@ -2706,6 +2694,23 @@ If you do, please send it to bug-gnu-emacs@gnu.org so we can list it here. | |||
| 2706 | 2694 | ||
| 2707 | * Runtime problems specific to macOS | 2695 | * Runtime problems specific to macOS |
| 2708 | 2696 | ||
| 2697 | ** Error message when opening Emacs on macOS | ||
| 2698 | |||
| 2699 | When opening Emacs, you may see an error message saying something like | ||
| 2700 | this: | ||
| 2701 | |||
| 2702 | "Emacs" can't be opened because Apple cannot check it for malicious | ||
| 2703 | software. This software needs to be updated. Contact the developer | ||
| 2704 | for more information. | ||
| 2705 | |||
| 2706 | The reason is that Apple incorrectly catalogs Emacs as potentially | ||
| 2707 | malicious software and thus shows this error message. | ||
| 2708 | |||
| 2709 | To avoid this alert, open Finder, go to Applications, control-click | ||
| 2710 | the Emacs app icon, and then choose Open. This adds a security | ||
| 2711 | exception for Emacs and from now on you should be able to open it by | ||
| 2712 | double-clicking on its icon, like any other app. | ||
| 2713 | |||
| 2709 | ** macOS doesn't come with libxpm, so only XPM3 is supported. | 2714 | ** macOS doesn't come with libxpm, so only XPM3 is supported. |
| 2710 | 2715 | ||
| 2711 | Libxpm is available for macOS as part of the XQuartz project. | 2716 | Libxpm is available for macOS as part of the XQuartz project. |
diff --git a/src/pdumper.c b/src/pdumper.c index 6cf7b847cb7..9eff5c48d09 100644 --- a/src/pdumper.c +++ b/src/pdumper.c | |||
| @@ -5296,6 +5296,9 @@ dump_do_dump_relocation (const uintptr_t dump_base, | |||
| 5296 | error ("Trying to load incoherent dumped eln file %s", | 5296 | error ("Trying to load incoherent dumped eln file %s", |
| 5297 | SSDATA (comp_u->file)); | 5297 | SSDATA (comp_u->file)); |
| 5298 | 5298 | ||
| 5299 | if (!CONSP (comp_u->file)) | ||
| 5300 | error ("Incoherent compilation unit for dump was dumped"); | ||
| 5301 | |||
| 5299 | /* emacs_execdir is always unibyte, but the file names in | 5302 | /* emacs_execdir is always unibyte, but the file names in |
| 5300 | comp_u->file could be multibyte, so we need to encode | 5303 | comp_u->file could be multibyte, so we need to encode |
| 5301 | them. */ | 5304 | them. */ |
diff --git a/src/xdisp.c b/src/xdisp.c index aa01db210b7..39ede3c0952 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -25626,7 +25626,8 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format) | |||
| 25626 | push_kboard (FRAME_KBOARD (it.f)); | 25626 | push_kboard (FRAME_KBOARD (it.f)); |
| 25627 | record_unwind_save_match_data (); | 25627 | record_unwind_save_match_data (); |
| 25628 | 25628 | ||
| 25629 | if (NILP (Vmode_line_compact)) | 25629 | if (NILP (Vmode_line_compact) |
| 25630 | || face_id == HEADER_LINE_FACE_ID || face_id == TAB_LINE_FACE_ID) | ||
| 25630 | { | 25631 | { |
| 25631 | mode_line_target = MODE_LINE_DISPLAY; | 25632 | mode_line_target = MODE_LINE_DISPLAY; |
| 25632 | display_mode_element (&it, 0, 0, 0, format, Qnil, false); | 25633 | display_mode_element (&it, 0, 0, 0, format, Qnil, false); |