diff options
| author | Glenn Morris | 2020-05-28 07:50:26 -0700 |
|---|---|---|
| committer | Glenn Morris | 2020-05-28 07:50:26 -0700 |
| commit | 4939beacb33ea91cd35e18fa7d43a4392d47f6f4 (patch) | |
| tree | 89abaf5e14f5baece710d57e32e3575cb2be514a | |
| parent | a134691435e107f348becb0b695a36e3e9c8fdac (diff) | |
| parent | bd7b681dc432ce77fbe3634c919fe49ca335f8e1 (diff) | |
| download | emacs-4939beacb33ea91cd35e18fa7d43a4392d47f6f4.tar.gz emacs-4939beacb33ea91cd35e18fa7d43a4392d47f6f4.zip | |
Merge from origin/emacs-27
bd7b681dc4 (origin/emacs-27) Tiny texinfo markup fixes
d0dd0e0612 ; Fix more @var/@code mixups in Elisp manual
313dc0439e ; Fix another format-spec typo in the Elisp manual
9d7fd78421 Make next-error behavior a bit more flexible
0691d25295 * etc/NEWS.25: Belatedly announce upcase-dwim and downcase...
df91c94ca8 Fix access to single-byte characters in buffer text
| -rw-r--r-- | doc/lispref/edebug.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/files.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/loading.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/os.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/text.texi | 20 | ||||
| -rw-r--r-- | etc/NEWS.25 | 2 | ||||
| -rw-r--r-- | lisp/simple.el | 38 | ||||
| -rw-r--r-- | src/cmds.c | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 6 |
9 files changed, 45 insertions, 32 deletions
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi index 5970e7cf801..d879f3dcadf 100644 --- a/doc/lispref/edebug.texi +++ b/doc/lispref/edebug.texi | |||
| @@ -663,7 +663,7 @@ definition in the future. | |||
| 663 | Toggle whether Edebug saves and restores the outside window | 663 | Toggle whether Edebug saves and restores the outside window |
| 664 | configuration (@code{edebug-toggle-save-windows}). | 664 | configuration (@code{edebug-toggle-save-windows}). |
| 665 | 665 | ||
| 666 | With a prefix argument, @code{W} only toggles saving and restoring of | 666 | With a prefix argument, @kbd{W} only toggles saving and restoring of |
| 667 | the selected window. To specify a window that is not displaying the | 667 | the selected window. To specify a window that is not displaying the |
| 668 | source code buffer, you must use @kbd{C-x X W} from the global keymap. | 668 | source code buffer, you must use @kbd{C-x X W} from the global keymap. |
| 669 | @end table | 669 | @end table |
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 686dbdb1caf..574c7e5aead 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi | |||
| @@ -3366,6 +3366,7 @@ each have handlers. | |||
| 3366 | file---such as the ones that implement completion of host names for | 3366 | file---such as the ones that implement completion of host names for |
| 3367 | remote file names---should have a non-@code{nil} @code{safe-magic} | 3367 | remote file names---should have a non-@code{nil} @code{safe-magic} |
| 3368 | property. For instance, Emacs normally protects directory names | 3368 | property. For instance, Emacs normally protects directory names |
| 3369 | @c FIXME I don't think this means the PATH environment variable? | ||
| 3369 | it finds in @code{PATH} from becoming magic, if they look like magic | 3370 | it finds in @code{PATH} from becoming magic, if they look like magic |
| 3370 | file names, by prefixing them with @samp{/:}. But if the handler that | 3371 | file names, by prefixing them with @samp{/:}. But if the handler that |
| 3371 | would be used for them has a non-@code{nil} @code{safe-magic} | 3372 | would be used for them has a non-@code{nil} @code{safe-magic} |
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index 28942820793..6833af9c262 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi | |||
| @@ -338,7 +338,7 @@ If the environment variable @env{EMACSLOADPATH} is set, it modifies | |||
| 338 | the above initialization procedure. Emacs initializes | 338 | the above initialization procedure. Emacs initializes |
| 339 | @code{load-path} based on the value of the environment variable. | 339 | @code{load-path} based on the value of the environment variable. |
| 340 | 340 | ||
| 341 | The syntax of @env{EMACSLOADPATH} is the same as used for @code{PATH}; | 341 | The syntax of @env{EMACSLOADPATH} is the same as used for @env{PATH}; |
| 342 | directories are separated by @samp{:} (or @samp{;}, on some | 342 | directories are separated by @samp{:} (or @samp{;}, on some |
| 343 | operating systems). | 343 | operating systems). |
| 344 | @ignore | 344 | @ignore |
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 8f2c7439d9f..67e44678299 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -1194,7 +1194,7 @@ This function returns the full name of the logged-in user---or the value | |||
| 1194 | of the environment variable @env{NAME}, if that is set. | 1194 | of the environment variable @env{NAME}, if that is set. |
| 1195 | 1195 | ||
| 1196 | If the Emacs process's user-id does not correspond to any known user (and | 1196 | If the Emacs process's user-id does not correspond to any known user (and |
| 1197 | provided @code{NAME} is not set), the result is @code{"unknown"}. | 1197 | provided @env{NAME} is not set), the result is @code{"unknown"}. |
| 1198 | 1198 | ||
| 1199 | If @var{uid} is non-@code{nil}, then it should be a number (a user-id) | 1199 | If @var{uid} is non-@code{nil}, then it should be a number (a user-id) |
| 1200 | or a string (a login name). Then @code{user-full-name} returns the full | 1200 | or a string (a login name). Then @code{user-full-name} returns the full |
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 70fb7141a1f..7c4bed04cb5 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -4511,33 +4511,33 @@ would destroy these properties. However, the latter combination is | |||
| 4511 | typically faster (@xref{Deletion}, and @ref{Insertion}). | 4511 | typically faster (@xref{Deletion}, and @ref{Insertion}). |
| 4512 | 4512 | ||
| 4513 | For its working, @code{replace-buffer-contents} needs to compare the | 4513 | For its working, @code{replace-buffer-contents} needs to compare the |
| 4514 | contents of the original buffer with that of @code{source} which is a | 4514 | contents of the original buffer with that of @var{source} which is a |
| 4515 | costly operation if the buffers are huge and there is a high number of | 4515 | costly operation if the buffers are huge and there is a high number of |
| 4516 | differences between them. In order to keep | 4516 | differences between them. In order to keep |
| 4517 | @code{replace-buffer-contents}'s runtime in bounds, it has two | 4517 | @code{replace-buffer-contents}'s runtime in bounds, it has two |
| 4518 | optional arguments. | 4518 | optional arguments. |
| 4519 | 4519 | ||
| 4520 | @code{max-secs} defines a hard boundary in terms of seconds. If given | 4520 | @var{max-secs} defines a hard boundary in terms of seconds. If given |
| 4521 | and exceeded, it will fall back to @code{delete-region} and | 4521 | and exceeded, it will fall back to @code{delete-region} and |
| 4522 | @code{insert-buffer-substring}. | 4522 | @code{insert-buffer-substring}. |
| 4523 | 4523 | ||
| 4524 | @code{max-costs} defines the quality of the difference computation. | 4524 | @var{max-costs} defines the quality of the difference computation. If |
| 4525 | If the actual costs exceed this limit, heuristics are used to provide | 4525 | the actual costs exceed this limit, heuristics are used to provide a |
| 4526 | a faster but suboptimal solution. The default value is 1000000. | 4526 | faster but suboptimal solution. The default value is 1000000. |
| 4527 | 4527 | ||
| 4528 | @code{replace-buffer-contents} returns t if a non-destructive | 4528 | @code{replace-buffer-contents} returns t if a non-destructive |
| 4529 | replacement could be performed. Otherwise, i.e., if @code{max-secs} | 4529 | replacement could be performed. Otherwise, i.e., if @var{max-secs} |
| 4530 | was exceeded, it returns nil. | 4530 | was exceeded, it returns nil. |
| 4531 | @end deffn | 4531 | @end deffn |
| 4532 | 4532 | ||
| 4533 | @defun replace-region-contents beg end replace-fn &optional max-secs max-costs | 4533 | @defun replace-region-contents beg end replace-fn &optional max-secs max-costs |
| 4534 | This function replaces the region between @code{beg} and @code{end} | 4534 | This function replaces the region between @var{beg} and @var{end} |
| 4535 | using the given @code{replace-fn}. The function @code{replace-fn} is | 4535 | using the given @var{replace-fn}. The function @var{replace-fn} is |
| 4536 | run in the current buffer narrowed to the specified region and it | 4536 | run in the current buffer narrowed to the specified region and it |
| 4537 | should return either a string or a buffer replacing the region. | 4537 | should return either a string or a buffer replacing the region. |
| 4538 | 4538 | ||
| 4539 | The replacement is performed using @code{replace-buffer-contents} (see | 4539 | The replacement is performed using @code{replace-buffer-contents} (see |
| 4540 | above) which also describes the @code{max-secs} and @code{max-costs} | 4540 | above) which also describes the @var{max-secs} and @var{max-costs} |
| 4541 | arguments and the return value. | 4541 | arguments and the return value. |
| 4542 | 4542 | ||
| 4543 | Note: If the replacement is a string, it will be placed in a temporary | 4543 | 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 | |||
| 4678 | above. @var{specification} is an alist that has elements where the | 4678 | above. @var{specification} is an alist that has elements where the |
| 4679 | @code{car} is a character and the @code{cdr} is the substitution. | 4679 | @code{car} is a character and the @code{cdr} is the substitution. |
| 4680 | 4680 | ||
| 4681 | If @code{ONLY-PRESENT} is @code{nil}, errors will be signaled if a | 4681 | If @var{only-present} is @code{nil}, errors will be signaled if a |
| 4682 | format character has been used that's not present in | 4682 | format character has been used that's not present in |
| 4683 | @var{specification}. If it's non-@code{nil}, that format | 4683 | @var{specification}. If it's non-@code{nil}, that format |
| 4684 | specification is left verbatim in the result. | 4684 | specification is left verbatim in the result. |
diff --git a/etc/NEWS.25 b/etc/NEWS.25 index bb09afce12a..8c04d940907 100644 --- a/etc/NEWS.25 +++ b/etc/NEWS.25 | |||
| @@ -284,6 +284,8 @@ affected by the command. | |||
| 284 | 284 | ||
| 285 | ** New command 'comment-line' bound to 'C-x C-;'. | 285 | ** New command 'comment-line' bound to 'C-x C-;'. |
| 286 | 286 | ||
| 287 | ** New commands 'upcase-dwim' and 'downcase-dwim'. | ||
| 288 | |||
| 287 | ** New and improved facilities for inserting Unicode characters | 289 | ** New and improved facilities for inserting Unicode characters |
| 288 | 290 | ||
| 289 | *** Unicode names entered via 'C-x 8 RET' now use substring completion | 291 | *** Unicode names entered via 'C-x 8 RET' now use substring completion |
diff --git a/lisp/simple.el b/lisp/simple.el index 111afa69d1a..a4b81719ced 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -199,7 +199,7 @@ rejected, and the function returns nil." | |||
| 199 | (and extra-test-inclusive | 199 | (and extra-test-inclusive |
| 200 | (funcall extra-test-inclusive)))))) | 200 | (funcall extra-test-inclusive)))))) |
| 201 | 201 | ||
| 202 | (defcustom next-error-find-buffer-function #'ignore | 202 | (defcustom next-error-find-buffer-function #'next-error-no-navigation-try-current |
| 203 | "Function called to find a `next-error' capable buffer. | 203 | "Function called to find a `next-error' capable buffer. |
| 204 | This functions takes the same three arguments as the function | 204 | This functions takes the same three arguments as the function |
| 205 | `next-error-find-buffer', and should return the buffer to be | 205 | `next-error-find-buffer', and should return the buffer to be |
| @@ -211,6 +211,8 @@ all other buffers." | |||
| 211 | :type '(choice (const :tag "No default" ignore) | 211 | :type '(choice (const :tag "No default" ignore) |
| 212 | (const :tag "Single next-error capable buffer on selected frame" | 212 | (const :tag "Single next-error capable buffer on selected frame" |
| 213 | next-error-buffer-on-selected-frame) | 213 | next-error-buffer-on-selected-frame) |
| 214 | (const :tag "Current buffer if next-error capable and outside navigation" | ||
| 215 | next-error-no-navigation-try-current) | ||
| 214 | (function :tag "Other function")) | 216 | (function :tag "Other function")) |
| 215 | :group 'next-error | 217 | :group 'next-error |
| 216 | :version "27.1") | 218 | :version "27.1") |
| @@ -240,6 +242,22 @@ from which next-error navigated, and a target buffer TO-BUFFER." | |||
| 240 | (if (eq (length window-buffers) 1) | 242 | (if (eq (length window-buffers) 1) |
| 241 | (car window-buffers)))) | 243 | (car window-buffers)))) |
| 242 | 244 | ||
| 245 | (defun next-error-no-navigation-try-current (&optional | ||
| 246 | avoid-current | ||
| 247 | extra-test-inclusive | ||
| 248 | extra-test-exclusive) | ||
| 249 | "Try the current buffer when outside navigation. | ||
| 250 | But return nil if we navigated to the current buffer by the means | ||
| 251 | of `next-error' command. Othewise, return it if it's next-error | ||
| 252 | capable." | ||
| 253 | ;; Check that next-error-buffer has no buffer-local value | ||
| 254 | ;; (i.e. we never navigated to the current buffer from another), | ||
| 255 | ;; and the current buffer is a `next-error' capable buffer. | ||
| 256 | (if (and (not (local-variable-p 'next-error-buffer)) | ||
| 257 | (next-error-buffer-p (current-buffer) avoid-current | ||
| 258 | extra-test-inclusive extra-test-exclusive)) | ||
| 259 | (current-buffer))) | ||
| 260 | |||
| 243 | (defun next-error-find-buffer (&optional avoid-current | 261 | (defun next-error-find-buffer (&optional avoid-current |
| 244 | extra-test-inclusive | 262 | extra-test-inclusive |
| 245 | extra-test-exclusive) | 263 | extra-test-exclusive) |
| @@ -260,24 +278,16 @@ that buffer is rejected." | |||
| 260 | (funcall next-error-find-buffer-function avoid-current | 278 | (funcall next-error-find-buffer-function avoid-current |
| 261 | extra-test-inclusive | 279 | extra-test-inclusive |
| 262 | extra-test-exclusive) | 280 | extra-test-exclusive) |
| 263 | ;; 2. If next-error-buffer has no buffer-local value | 281 | ;; 2. If next-error-last-buffer is an acceptable buffer, use that. |
| 264 | ;; (i.e. never navigated to the current buffer from another), | ||
| 265 | ;; and the current buffer is a `next-error' capable buffer, | ||
| 266 | ;; use it unconditionally, so next-error will always use it. | ||
| 267 | (if (and (not (local-variable-p 'next-error-buffer)) | ||
| 268 | (next-error-buffer-p (current-buffer) avoid-current | ||
| 269 | extra-test-inclusive extra-test-exclusive)) | ||
| 270 | (current-buffer)) | ||
| 271 | ;; 3. If next-error-last-buffer is an acceptable buffer, use that. | ||
| 272 | (if (and next-error-last-buffer | 282 | (if (and next-error-last-buffer |
| 273 | (next-error-buffer-p next-error-last-buffer avoid-current | 283 | (next-error-buffer-p next-error-last-buffer avoid-current |
| 274 | extra-test-inclusive extra-test-exclusive)) | 284 | extra-test-inclusive extra-test-exclusive)) |
| 275 | next-error-last-buffer) | 285 | next-error-last-buffer) |
| 276 | ;; 4. If the current buffer is acceptable, choose it. | 286 | ;; 3. If the current buffer is acceptable, choose it. |
| 277 | (if (next-error-buffer-p (current-buffer) avoid-current | 287 | (if (next-error-buffer-p (current-buffer) avoid-current |
| 278 | extra-test-inclusive extra-test-exclusive) | 288 | extra-test-inclusive extra-test-exclusive) |
| 279 | (current-buffer)) | 289 | (current-buffer)) |
| 280 | ;; 5. Look for any acceptable buffer. | 290 | ;; 4. Look for any acceptable buffer. |
| 281 | (let ((buffers (buffer-list))) | 291 | (let ((buffers (buffer-list))) |
| 282 | (while (and buffers | 292 | (while (and buffers |
| 283 | (not (next-error-buffer-p | 293 | (not (next-error-buffer-p |
| @@ -285,7 +295,7 @@ that buffer is rejected." | |||
| 285 | extra-test-inclusive extra-test-exclusive))) | 295 | extra-test-inclusive extra-test-exclusive))) |
| 286 | (setq buffers (cdr buffers))) | 296 | (setq buffers (cdr buffers))) |
| 287 | (car buffers)) | 297 | (car buffers)) |
| 288 | ;; 6. Use the current buffer as a last resort if it qualifies, | 298 | ;; 5. Use the current buffer as a last resort if it qualifies, |
| 289 | ;; even despite AVOID-CURRENT. | 299 | ;; even despite AVOID-CURRENT. |
| 290 | (and avoid-current | 300 | (and avoid-current |
| 291 | (next-error-buffer-p (current-buffer) nil | 301 | (next-error-buffer-p (current-buffer) nil |
| @@ -293,7 +303,7 @@ that buffer is rejected." | |||
| 293 | (progn | 303 | (progn |
| 294 | (message "This is the only buffer with error message locations") | 304 | (message "This is the only buffer with error message locations") |
| 295 | (current-buffer))) | 305 | (current-buffer))) |
| 296 | ;; 7. Give up. | 306 | ;; 6. Give up. |
| 297 | (error "No buffers contain error message locations"))) | 307 | (error "No buffers contain error message locations"))) |
| 298 | 308 | ||
| 299 | (defun next-error (&optional arg reset) | 309 | (defun next-error (&optional arg reset) |
diff --git a/src/cmds.c b/src/cmds.c index 9f96f210b9f..90526612b7a 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -194,7 +194,7 @@ to t. */) | |||
| 194 | SET_PT (newpos); | 194 | SET_PT (newpos); |
| 195 | 195 | ||
| 196 | if (PT > newpos | 196 | if (PT > newpos |
| 197 | && FETCH_CHAR (PT - 1) == '\n') | 197 | && FETCH_BYTE (PT_BYTE - 1) == '\n') |
| 198 | { | 198 | { |
| 199 | /* If we skipped over a newline that follows | 199 | /* If we skipped over a newline that follows |
| 200 | an invisible intangible run, | 200 | an invisible intangible run, |
| @@ -205,7 +205,7 @@ to t. */) | |||
| 205 | break; | 205 | break; |
| 206 | } | 206 | } |
| 207 | else if (PT > newpos && PT < ZV | 207 | else if (PT > newpos && PT < ZV |
| 208 | && FETCH_CHAR (PT) != '\n') | 208 | && FETCH_BYTE (PT_BYTE) != '\n') |
| 209 | /* If we skipped something intangible | 209 | /* If we skipped something intangible |
| 210 | and now we're not really at eol, | 210 | and now we're not really at eol, |
| 211 | keep going. */ | 211 | keep going. */ |
diff --git a/src/xdisp.c b/src/xdisp.c index cf15f579b58..f5a8f2eabf8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -8290,8 +8290,8 @@ get_visually_first_element (struct it *it) | |||
| 8290 | } | 8290 | } |
| 8291 | else if (it->bidi_it.charpos == bob | 8291 | else if (it->bidi_it.charpos == bob |
| 8292 | || (!string_p | 8292 | || (!string_p |
| 8293 | && (FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n' | 8293 | && (FETCH_BYTE (it->bidi_it.bytepos - 1) == '\n' |
| 8294 | || FETCH_CHAR (it->bidi_it.bytepos) == '\n'))) | 8294 | || FETCH_BYTE (it->bidi_it.bytepos) == '\n'))) |
| 8295 | { | 8295 | { |
| 8296 | /* If we are at the beginning of a line/string, we can produce | 8296 | /* If we are at the beginning of a line/string, we can produce |
| 8297 | the next element right away. */ | 8297 | the next element right away. */ |
| @@ -24182,7 +24182,7 @@ the `bidi-class' property of a character. */) | |||
| 24182 | itb.charpos = BEGV; | 24182 | itb.charpos = BEGV; |
| 24183 | itb.bytepos = BEGV_BYTE; | 24183 | itb.bytepos = BEGV_BYTE; |
| 24184 | } | 24184 | } |
| 24185 | else if (FETCH_CHAR (from_bpos - 1) == '\n') | 24185 | else if (FETCH_BYTE (from_bpos - 1) == '\n') |
| 24186 | { | 24186 | { |
| 24187 | itb.charpos = from_pos; | 24187 | itb.charpos = from_pos; |
| 24188 | itb.bytepos = from_bpos; | 24188 | itb.bytepos = from_bpos; |