Commit 4939beac authored by Glenn Morris's avatar Glenn Morris
Browse files

Merge from origin/emacs-27

bd7b681d (origin/emacs-27) Tiny texinfo markup fixes
d0dd0e06 ; Fix more @var/@code mixups in Elisp manual
313dc043 ; Fix another format-spec typo in the Elisp manual
9d7fd784 Make next-error behavior a bit more flexible
0691d252 * etc/NEWS.25: Belatedly announce upcase-dwim and downcase...
df91c94c Fix access to single-byte characters in buffer text
parents a1346914 bd7b681d
......@@ -663,7 +663,7 @@ definition in the future.
Toggle whether Edebug saves and restores the outside window
configuration (@code{edebug-toggle-save-windows}).
With a prefix argument, @code{W} only toggles saving and restoring of
With a prefix argument, @kbd{W} only toggles saving and restoring of
the selected window. To specify a window that is not displaying the
source code buffer, you must use @kbd{C-x X W} from the global keymap.
@end table
......
......@@ -3366,6 +3366,7 @@ each have handlers.
file---such as the ones that implement completion of host names for
remote file names---should have a non-@code{nil} @code{safe-magic}
property. For instance, Emacs normally protects directory names
@c FIXME I don't think this means the PATH environment variable?
it finds in @code{PATH} from becoming magic, if they look like magic
file names, by prefixing them with @samp{/:}. But if the handler that
would be used for them has a non-@code{nil} @code{safe-magic}
......
......@@ -338,7 +338,7 @@ If the environment variable @env{EMACSLOADPATH} is set, it modifies
the above initialization procedure. Emacs initializes
@code{load-path} based on the value of the environment variable.
The syntax of @env{EMACSLOADPATH} is the same as used for @code{PATH};
The syntax of @env{EMACSLOADPATH} is the same as used for @env{PATH};
directories are separated by @samp{:} (or @samp{;}, on some
operating systems).
@ignore
......
......@@ -1194,7 +1194,7 @@ This function returns the full name of the logged-in user---or the value
of the environment variable @env{NAME}, if that is set.
If the Emacs process's user-id does not correspond to any known user (and
provided @code{NAME} is not set), the result is @code{"unknown"}.
provided @env{NAME} is not set), the result is @code{"unknown"}.
If @var{uid} is non-@code{nil}, then it should be a number (a user-id)
or a string (a login name). Then @code{user-full-name} returns the full
......
......@@ -4511,33 +4511,33 @@ would destroy these properties. However, the latter combination is
typically faster (@xref{Deletion}, and @ref{Insertion}).
For its working, @code{replace-buffer-contents} needs to compare the
contents of the original buffer with that of @code{source} which is a
contents of the original buffer with that of @var{source} which is a
costly operation if the buffers are huge and there is a high number of
differences between them. In order to keep
@code{replace-buffer-contents}'s runtime in bounds, it has two
optional arguments.
@code{max-secs} defines a hard boundary in terms of seconds. If given
@var{max-secs} defines a hard boundary in terms of seconds. If given
and exceeded, it will fall back to @code{delete-region} and
@code{insert-buffer-substring}.
@code{max-costs} defines the quality of the difference computation.
If the actual costs exceed this limit, heuristics are used to provide
a faster but suboptimal solution. The default value is 1000000.
@var{max-costs} defines the quality of the difference computation. If
the actual costs exceed this limit, heuristics are used to provide a
faster but suboptimal solution. The default value is 1000000.
@code{replace-buffer-contents} returns t if a non-destructive
replacement could be performed. Otherwise, i.e., if @code{max-secs}
replacement could be performed. Otherwise, i.e., if @var{max-secs}
was exceeded, it returns nil.
@end deffn
@defun replace-region-contents beg end replace-fn &optional max-secs max-costs
This function replaces the region between @code{beg} and @code{end}
using the given @code{replace-fn}. The function @code{replace-fn} is
This function replaces the region between @var{beg} and @var{end}
using the given @var{replace-fn}. The function @var{replace-fn} is
run in the current buffer narrowed to the specified region and it
should return either a string or a buffer replacing the region.
The replacement is performed using @code{replace-buffer-contents} (see
above) which also describes the @code{max-secs} and @code{max-costs}
above) which also describes the @var{max-secs} and @var{max-costs}
arguments and the return value.
Note: If the replacement is a string, it will be placed in a temporary
......@@ -4678,7 +4678,7 @@ expanded when the header line is computed. To do this, the
above. @var{specification} is an alist that has elements where the
@code{car} is a character and the @code{cdr} is the substitution.
If @code{ONLY-PRESENT} is @code{nil}, errors will be signaled if a
If @var{only-present} is @code{nil}, errors will be signaled if a
format character has been used that's not present in
@var{specification}. If it's non-@code{nil}, that format
specification is left verbatim in the result.
......
......@@ -284,6 +284,8 @@ affected by the command.
** New command 'comment-line' bound to 'C-x C-;'.
** New commands 'upcase-dwim' and 'downcase-dwim'.
** New and improved facilities for inserting Unicode characters
*** Unicode names entered via 'C-x 8 RET' now use substring completion
......
......@@ -199,7 +199,7 @@ rejected, and the function returns nil."
(and extra-test-inclusive
(funcall extra-test-inclusive))))))
(defcustom next-error-find-buffer-function #'ignore
(defcustom next-error-find-buffer-function #'next-error-no-navigation-try-current
"Function called to find a `next-error' capable buffer.
This functions takes the same three arguments as the function
`next-error-find-buffer', and should return the buffer to be
......@@ -211,6 +211,8 @@ all other buffers."
:type '(choice (const :tag "No default" ignore)
(const :tag "Single next-error capable buffer on selected frame"
next-error-buffer-on-selected-frame)
(const :tag "Current buffer if next-error capable and outside navigation"
next-error-no-navigation-try-current)
(function :tag "Other function"))
:group 'next-error
:version "27.1")
......@@ -240,6 +242,22 @@ from which next-error navigated, and a target buffer TO-BUFFER."
(if (eq (length window-buffers) 1)
(car window-buffers))))
(defun next-error-no-navigation-try-current (&optional
avoid-current
extra-test-inclusive
extra-test-exclusive)
"Try the current buffer when outside navigation.
But return nil if we navigated to the current buffer by the means
of `next-error' command. Othewise, return it if it's next-error
capable."
;; Check that next-error-buffer has no buffer-local value
;; (i.e. we never navigated to the current buffer from another),
;; and the current buffer is a `next-error' capable buffer.
(if (and (not (local-variable-p 'next-error-buffer))
(next-error-buffer-p (current-buffer) avoid-current
extra-test-inclusive extra-test-exclusive))
(current-buffer)))
(defun next-error-find-buffer (&optional avoid-current
extra-test-inclusive
extra-test-exclusive)
......@@ -260,24 +278,16 @@ that buffer is rejected."
(funcall next-error-find-buffer-function avoid-current
extra-test-inclusive
extra-test-exclusive)
;; 2. If next-error-buffer has no buffer-local value
;; (i.e. never navigated to the current buffer from another),
;; and the current buffer is a `next-error' capable buffer,
;; use it unconditionally, so next-error will always use it.
(if (and (not (local-variable-p 'next-error-buffer))
(next-error-buffer-p (current-buffer) avoid-current
extra-test-inclusive extra-test-exclusive))
(current-buffer))
;; 3. If next-error-last-buffer is an acceptable buffer, use that.
;; 2. If next-error-last-buffer is an acceptable buffer, use that.
(if (and next-error-last-buffer
(next-error-buffer-p next-error-last-buffer avoid-current
extra-test-inclusive extra-test-exclusive))
next-error-last-buffer)
;; 4. If the current buffer is acceptable, choose it.
;; 3. If the current buffer is acceptable, choose it.
(if (next-error-buffer-p (current-buffer) avoid-current
extra-test-inclusive extra-test-exclusive)
(current-buffer))
;; 5. Look for any acceptable buffer.
;; 4. Look for any acceptable buffer.
(let ((buffers (buffer-list)))
(while (and buffers
(not (next-error-buffer-p
......@@ -285,7 +295,7 @@ that buffer is rejected."
extra-test-inclusive extra-test-exclusive)))
(setq buffers (cdr buffers)))
(car buffers))
;; 6. Use the current buffer as a last resort if it qualifies,
;; 5. Use the current buffer as a last resort if it qualifies,
;; even despite AVOID-CURRENT.
(and avoid-current
(next-error-buffer-p (current-buffer) nil
......@@ -293,7 +303,7 @@ that buffer is rejected."
(progn
(message "This is the only buffer with error message locations")
(current-buffer)))
;; 7. Give up.
;; 6. Give up.
(error "No buffers contain error message locations")))
(defun next-error (&optional arg reset)
......
......@@ -194,7 +194,7 @@ to t. */)
SET_PT (newpos);
if (PT > newpos
&& FETCH_CHAR (PT - 1) == '\n')
&& FETCH_BYTE (PT_BYTE - 1) == '\n')
{
/* If we skipped over a newline that follows
an invisible intangible run,
......@@ -205,7 +205,7 @@ to t. */)
break;
}
else if (PT > newpos && PT < ZV
&& FETCH_CHAR (PT) != '\n')
&& FETCH_BYTE (PT_BYTE) != '\n')
/* If we skipped something intangible
and now we're not really at eol,
keep going. */
......
......@@ -8290,8 +8290,8 @@ get_visually_first_element (struct it *it)
}
else if (it->bidi_it.charpos == bob
|| (!string_p
&& (FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n'
|| FETCH_CHAR (it->bidi_it.bytepos) == '\n')))
&& (FETCH_BYTE (it->bidi_it.bytepos - 1) == '\n'
|| FETCH_BYTE (it->bidi_it.bytepos) == '\n')))
{
/* If we are at the beginning of a line/string, we can produce
the next element right away. */
......@@ -24182,7 +24182,7 @@ the `bidi-class' property of a character. */)
itb.charpos = BEGV;
itb.bytepos = BEGV_BYTE;
}
else if (FETCH_CHAR (from_bpos - 1) == '\n')
else if (FETCH_BYTE (from_bpos - 1) == '\n')
{
itb.charpos = from_pos;
itb.bytepos = from_bpos;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment