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. 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 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. 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} 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 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 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 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 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 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. 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. ** 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 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." (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) 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. */) 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. */ 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) } 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;