From 184a4977c7f83c1ba5d4a693713355e104a7cb3e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 12 Sep 2020 09:51:32 -0700 Subject: [PATCH 1/7] Make vc-bzr tests work with brz 3.1 (bug#43314) * test/lisp/vc/vc-bzr-tests.el (vc-bzr-test-bug9726) (vc-bzr-test-bug9781, vc-bzr-test-faulty-bzr-autoloads): Make them work with brz 3.1. --- test/lisp/vc/vc-bzr-tests.el | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/test/lisp/vc/vc-bzr-tests.el b/test/lisp/vc/vc-bzr-tests.el index f738da7f41f..b68a6945129 100644 --- a/test/lisp/vc/vc-bzr-tests.el +++ b/test/lisp/vc/vc-bzr-tests.el @@ -38,13 +38,26 @@ ;; abort if they cannot. I could not figure out how to stop bzr ;; doing that, so just give it a temporary homedir for the duration. ;; http://bugs.launchpad.net/bzr/+bug/137407 ? + ;; + ;; Note that with bzr 2.x, this works: + ;; mkdir /tmp/bzr + ;; HOME=/nonexistent BZR_HOME=/tmp/bzr bzr status + ;; but with brz 3.1, it complains: + ;; "failed to open trace file: [Errno 13] Permission denied: '/nonexistent'" + ;; which confuses vc-dir. + ;; We can quieten brz by adding either BRZ_LOG=/dev/null, or + ;; XDG_CACHE_HOME=/tmp/bzr (log defaults to XDG_CACHE_HOME/breezy/brz.log), + ;; but it seems simpler to just set HOME to a newly created + ;; temporary directory. + ;; TODO does this means tests should be setting XDG_ variables (not + ;; just HOME) to temporary values too? (let* ((homedir (make-temp-file "vc-bzr-test" t)) (bzrdir (expand-file-name "bzr" homedir)) (ignored-dir (progn (make-directory bzrdir) (expand-file-name "ignored-dir" bzrdir))) (default-directory (file-name-as-directory bzrdir)) - (process-environment (cons (format "BZR_HOME=%s" homedir) + (process-environment (cons (format "HOME=%s" homedir) process-environment))) (unwind-protect (progn @@ -81,7 +94,7 @@ (expand-file-name "subdir" bzrdir))) (file (expand-file-name "file" bzrdir)) (default-directory (file-name-as-directory bzrdir)) - (process-environment (cons (format "BZR_HOME=%s" homedir) + (process-environment (cons (format "HOME=%s" homedir) process-environment))) (unwind-protect (progn @@ -119,7 +132,7 @@ (expand-file-name "foo.el" bzrdir))) (default-directory (file-name-as-directory bzrdir)) (generated-autoload-file (expand-file-name "loaddefs.el" bzrdir)) - (process-environment (cons (format "BZR_HOME=%s" homedir) + (process-environment (cons (format "HOME=%s" homedir) process-environment))) (unwind-protect (progn From 985703d3800fb48feec44e3fd7880e9561bcbdc7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 16 Sep 2020 19:16:25 +0300 Subject: [PATCH 2/7] Fix doc string of 'toggle-menu-bar-mode-from-frame' * lisp/menu-bar.el (toggle-menu-bar-mode-from-frame): Improve the wording of the doc string. (Bug#43383) --- lisp/menu-bar.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index cc12a17c794..37e046ffddf 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -2426,7 +2426,7 @@ created in the future." (put 'menu-bar-mode 'standard-value '(t)) (defun toggle-menu-bar-mode-from-frame (&optional arg) - "Toggle menu bar on or off, based on the status of the current frame. + "Toggle display of the menu bar of the current frame. See `menu-bar-mode' for more information." (interactive (list (or current-prefix-arg 'toggle))) (if (eq arg 'toggle) From 3223302aa2294d0e2a68216e84e3ee2d4ebcbee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Fri, 18 Sep 2020 13:36:47 +0200 Subject: [PATCH 3/7] Use modern constant names for the NS pasteboard Use the same pasteboard constant names defined in ns_drag_types. (Bug#43470). * src/nsterm.m: Rename NSURLPboardType to NSPasteboardTypeURL, NSStringPboardType to NSPasteboardTypeString, and NSTabularTextPboardType to NSPasteboardTypeTabularText --- src/nsterm.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index ac467840a25..3dd915e3703 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -8363,7 +8363,7 @@ not_in_argv (NSString *arg) while ( (file = [fenum nextObject]) ) strings = Fcons (build_string ([file UTF8String]), strings); } - else if ([type isEqualToString: NSURLPboardType]) + else if ([type isEqualToString: NSPasteboardTypeURL]) { NSURL *url = [NSURL URLFromPasteboard: pb]; if (url == nil) return NO; @@ -8372,8 +8372,8 @@ not_in_argv (NSString *arg) strings = list1 (build_string ([[url absoluteString] UTF8String])); } - else if ([type isEqualToString: NSStringPboardType] - || [type isEqualToString: NSTabularTextPboardType]) + else if ([type isEqualToString: NSPasteboardTypeString] + || [type isEqualToString: NSPasteboardTypeTabularText]) { NSString *data; From 759399cdb1d74d282e02725f4e6769566b145e1f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 18 Sep 2020 22:50:36 +0300 Subject: [PATCH 4/7] Improve documentation of 'max-mini-window-height' * src/xdisp.c (syms_of_xdisp): * doc/lispref/minibuf.texi (Minibuffer Windows): More accurate wording in the documentation of 'max-mini-window-height', to clarify the meaning of an integer value. --- doc/lispref/minibuf.texi | 7 ++++--- src/xdisp.c | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index c1615993f5e..ecab882fed7 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2418,9 +2418,10 @@ changes size automatically. In that case the window resizing commands @defopt max-mini-window-height This option provides a maximum height for resizing minibuffer windows -automatically. A floating-point number specifies a fraction of the -frame's height; an integer specifies the maximum number of lines. The -default value is 0.25. +automatically. A floating-point number specifies the maximum height +as a fraction of the frame's height; an integer specifies the maximum +height in units of the frame's canonical character height +(@pxref{Frame Font}). The default value is 0.25. @end defopt Note that the values of the above two variables take effect at display diff --git a/src/xdisp.c b/src/xdisp.c index ad0ab9987d8..d191ef51700 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -34830,8 +34830,10 @@ but does not change the fact they are interpreted as raw bytes. */); DEFVAR_LISP ("max-mini-window-height", Vmax_mini_window_height, doc: /* Maximum height for resizing mini-windows (the minibuffer and the echo area). -If a float, it specifies a fraction of the mini-window frame's height. -If an integer, it specifies a number of lines. */); +If a float, it specifies the maximum height in units of the +mini-window frame's height. +If an integer, it specifies the maximum height in units of the +mini-window frame's default font's height. */); Vmax_mini_window_height = make_float (0.25); DEFVAR_LISP ("resize-mini-windows", Vresize_mini_windows, From fcd599bbeaac84113379dedbff4e59910e10e171 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 19 Sep 2020 11:30:57 +0300 Subject: [PATCH 5/7] Minor copyedits of doc of 'with-silent-modifications' * doc/lispref/text.texi (Changing Properties): * doc/lispref/buffers.texi (Buffer Modification): Improve documentation and indexing of 'with-silent-modifications'. --- doc/lispref/buffers.texi | 4 ++-- doc/lispref/text.texi | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi index 33528fc7fec..28603436284 100644 --- a/doc/lispref/buffers.texi +++ b/doc/lispref/buffers.texi @@ -596,8 +596,8 @@ and features that react to buffer modifications, use the Execute @var{body} pretending it does not modify the buffer. This includes checking whether the buffer's file is locked (@pxref{File Locks}), running buffer modification hooks (@pxref{Change Hooks}), -etc. Note that if @var{body} actually modifies the buffer text, its -undo data may become corrupted. +etc. Note that if @var{body} actually modifies the buffer text (as +opposed to its text properties), its undo data may become corrupted. @end defmac @node Modification Time diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 5d83e7bd6cc..c4e92bdcedb 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -3069,7 +3069,7 @@ construct each part with @code{propertize} and then combine them with @code{buffer-substring-no-properties}, which copies text from the buffer but does not copy its properties. -@findex with-silent-modifications +@findex with-silent-modifications, and changes in text properties If you wish to add text properties to a buffer or remove them without marking the buffer as modified, you can wrap the calls above in the @code{with-silent-modifications} macro. @xref{Buffer From fd1fe1e1ecb6c68bbdea4bf071166779388174d0 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sat, 19 Sep 2020 16:50:27 +0000 Subject: [PATCH 6/7] Add doc to syntax-propertize-function saying it must do a 100% job and cannot be combined with other ways of applying syntax-table text properties. * lisp/emacs-lisp/syntax.el (syntax-propertize-function): Amend doc string. * doc/lispref/syntax.texi (Syntax Properties): Amend the description of the variable. --- doc/lispref/syntax.texi | 9 +++++++++ lisp/emacs-lisp/syntax.el | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index 9eb99a0ac92..b3c77665bae 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi @@ -575,6 +575,15 @@ position before @var{end}. However, it should not call @code{syntax-ppss-flush-cache}; so, it is not allowed to call @code{syntax-ppss} on some position and later modify the buffer at an earlier position. + +@strong{Caution:} When this variable is non-@code{nil}, Emacs removes +@code{syntax-table} text properties arbitrarily and relies on +@code{syntax-propertize-function} to reapply them. Thus if this +facility is used at all, the function must apply @strong{all} +@code{syntax-table} text properties used by the major mode. In +particular, Modes derived from a CC Mode mode must not use this +variable, since CC Mode uses other means to apply and remove these +text properties. @end defvar @defvar syntax-propertize-extend-region-functions diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 11cc1988b1f..f4f077264be 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -65,7 +65,12 @@ cannot be handled just by the buffer's syntax-table. The specified function may call `syntax-ppss' on any position before END, but it should not call `syntax-ppss-flush-cache', which means that it should not call `syntax-ppss' on some -position and later modify the buffer on some earlier position.") +position and later modify the buffer on some earlier position. + +Note: When this variable is a function, it must apply _all_ the +`syntax-table' properties needed in the given text interval. +Using both this function and other means to apply these +properties won't work properly.") (defvar syntax-propertize-chunk-size 500) From df04f3e755f3001ebb9cc428faa7fa46059e636b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 19 Sep 2020 19:54:01 +0300 Subject: [PATCH 7/7] Fix a rare segfault in syntax.c * src/syntax.c (Fforward_comment): Prevent the loop for COUNT < 0 from going outside the valid range of character/byte positions. (Bug#43499) * doc/lispref/syntax.texi (Syntax Class Table): Mention the "comment-fence" and "string-fence" as alternative names of 2 syntax classes. --- doc/lispref/syntax.texi | 18 ++++++++++-------- src/syntax.c | 25 ++++++++++++++----------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index b3c77665bae..b99b5de0b31 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi @@ -256,10 +256,11 @@ look in the standard syntax table to find the syntax of this character. @item Generic comment delimiters: @samp{!} -Characters that start or end a special kind of comment. @emph{Any} -generic comment delimiter matches @emph{any} generic comment -delimiter, but they cannot match a comment starter or comment ender; -generic comment delimiters can only match each other. +(This syntax class is also known as ``comment-fence''.) Characters +that start or end a special kind of comment. @emph{Any} generic +comment delimiter matches @emph{any} generic comment delimiter, but +they cannot match a comment starter or comment ender; generic comment +delimiters can only match each other. This syntax class is primarily meant for use with the @code{syntax-table} text property (@pxref{Syntax Properties}). You @@ -268,10 +269,11 @@ first and last characters of the range @code{syntax-table} properties identifying them as generic comment delimiters. @item Generic string delimiters: @samp{|} -Characters that start or end a string. This class differs from the -string quote class in that @emph{any} generic string delimiter can -match any other generic string delimiter; but they do not match -ordinary string quote characters. +(This syntax class is also known as ``string-fence''.) Characters +that start or end a string. This class differs from the string quote +class in that @emph{any} generic string delimiter can match any other +generic string delimiter; but they do not match ordinary string quote +characters. This syntax class is primarily meant for use with the @code{syntax-table} text property (@pxref{Syntax Properties}). You diff --git a/src/syntax.c b/src/syntax.c index a79ab863367..e8b32f5a445 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -2545,20 +2545,23 @@ between them, return t; otherwise return nil. */) bool fence_found = 0; ptrdiff_t ini = from, ini_byte = from_byte; - while (1) + if (from > stop) { - DEC_BOTH (from, from_byte); - UPDATE_SYNTAX_TABLE_BACKWARD (from); - c = FETCH_CHAR_AS_MULTIBYTE (from_byte); - if (SYNTAX (c) == Scomment_fence - && !char_quoted (from, from_byte)) + while (1) { - fence_found = 1; - break; + DEC_BOTH (from, from_byte); + UPDATE_SYNTAX_TABLE_BACKWARD (from); + c = FETCH_CHAR_AS_MULTIBYTE (from_byte); + if (SYNTAX (c) == Scomment_fence + && !char_quoted (from, from_byte)) + { + fence_found = 1; + break; + } + else if (from == stop) + break; + rarely_quit (++quit_count); } - else if (from == stop) - break; - rarely_quit (++quit_count); } if (fence_found == 0) {