Merge from origin/emacs-27
f3b62b6c62
(origin/emacs-27) Avoid crashes in regex-emacs.c due to GC175c61c18b
Fix "C-u M-!" when 'shell-command-dont-erase-buffer' is no...6b297519b5
Fix cl-most-positive-float doc typoc36c5a3ded
; lisp/ldefs-boot.el: Update.3876a60569
Fix a typo in calculator.el9e832ba91b
* lisp/erc/erc.el: Add URL to the new ERC page on the Emac... # Conflicts: # etc/NEWS
This commit is contained in:
commit
4819bea690
9 changed files with 80 additions and 42 deletions
|
@ -740,10 +740,11 @@ creates the file @file{foo} and produces no terminal output.
|
|||
|
||||
A numeric argument to @code{shell-command}, e.g., @kbd{M-1 M-!},
|
||||
causes it to insert terminal output into the current buffer instead of
|
||||
a separate buffer. It puts point before the output, and sets the mark
|
||||
after the output. For instance, @kbd{M-1 M-! gunzip < foo.gz
|
||||
@key{RET}} would insert the uncompressed form of the file
|
||||
@file{foo.gz} into the current buffer.
|
||||
a separate buffer. By default, it puts point before the output, and
|
||||
sets the mark after the output (but a non-default value of
|
||||
@code{shell-command-dont-erase-buffer} can change that, see below).
|
||||
For instance, @kbd{M-1 M-! gunzip < foo.gz @key{RET}} would insert the
|
||||
uncompressed form of the file @file{foo.gz} into the current buffer.
|
||||
|
||||
Provided the specified shell command does not end with @samp{&}, it
|
||||
runs @dfn{synchronously}, and you must wait for it to exit before
|
||||
|
@ -829,11 +830,21 @@ inserted into a buffer of that name.
|
|||
By default, the output buffer is erased between shell commands, except
|
||||
when the output goes to the current buffer. If you change the value
|
||||
of the option @code{shell-command-dont-erase-buffer} to @code{erase},
|
||||
then the output buffer is always erased. Any other non-@code{nil}
|
||||
value prevents to erase the output buffer.
|
||||
then the output buffer is always erased. Other non-@code{nil} values
|
||||
prevent erasing of the output buffer, and---if the output buffer is
|
||||
not the current buffer---also control where to put point after
|
||||
inserting the output of the shell command:
|
||||
|
||||
This option also controls where to set the point in the output buffer
|
||||
after the command completes; see the documentation of the option for details.
|
||||
@table @code
|
||||
@item beg-last-out
|
||||
Puts point at the beginning of the last shell-command output.
|
||||
@item end-last-out
|
||||
Puts point at the end of the last shell-command output, i.e.@: at the
|
||||
end of the output buffer.
|
||||
@item save-point
|
||||
Restores the position of point as it was before inserting the
|
||||
shell-command output.
|
||||
@end table
|
||||
|
||||
@node Interactive Shell
|
||||
@subsection Interactive Subshell
|
||||
|
|
|
@ -3128,7 +3128,7 @@ floating-point number, namely the IEEE binary64 floating-point format.
|
|||
|
||||
@defvar cl-most-positive-float
|
||||
This constant equals the largest finite value a Lisp float can hold.
|
||||
For IEEE binary64 format, this equals @code{(- (expt 2 1024) (- 2
|
||||
For IEEE binary64 format, this equals @code{(- (expt 2 1024) (expt 2
|
||||
971))}, which equals @code{1.7976931348623157e+308}.
|
||||
@end defvar
|
||||
|
||||
|
|
11
etc/NEWS.27
11
etc/NEWS.27
|
@ -2084,12 +2084,17 @@ variable for remote shells. It still defaults to "/bin/sh".
|
|||
** Single shell commands
|
||||
|
||||
+++
|
||||
*** 'shell-command-dont-erase-buffer' accepts the value 'erase' to
|
||||
force to erase the output buffer before execution of the command.
|
||||
*** New values of 'shell-command-dont-erase-buffer'.
|
||||
This option can now have the value 'erase' to force to erase the
|
||||
output buffer before execution of the command, even if the output goes
|
||||
to the current buffer. Additional values 'beg-last-out',
|
||||
'end-last-out', and 'save-point' control where to put point in the
|
||||
output buffer after inserting the shell-command output.
|
||||
|
||||
---
|
||||
*** The new functions 'shell-command-save-pos-or-erase' and
|
||||
'shell-command-set-point-after-cmd' control how point is handled
|
||||
between two consecutive shell commands in the same buffer.
|
||||
between two consecutive shell commands in the same output buffer.
|
||||
|
||||
+++
|
||||
*** 'async-shell-command-width' defines the number of display columns
|
||||
|
|
|
@ -1622,7 +1622,7 @@ To use this, apply a binary operator (evaluate it), then call this."
|
|||
(overflow-error
|
||||
;; X and Y must be integers, as expt silently returns floating-point
|
||||
;; infinity on floating-point overflow.
|
||||
(if (or (natnump x) (zerop (logand x 1)))
|
||||
(if (or (natnump x) (zerop (logand y 1)))
|
||||
1.0e+INF
|
||||
-1.0e+INF))))
|
||||
|
||||
|
|
|
@ -33,17 +33,8 @@
|
|||
;;; Commentary:
|
||||
|
||||
;; ERC is a powerful, modular, and extensible IRC client for Emacs.
|
||||
|
||||
;; For more information, see the following URLs:
|
||||
;; * https://sv.gnu.org/projects/erc/
|
||||
;; * https://www.emacswiki.org/emacs/ERC
|
||||
|
||||
|
||||
|
||||
;; As of 2006-06-13, ERC development is now hosted on Savannah
|
||||
;; (https://sv.gnu.org/projects/erc). I invite everyone who wants to
|
||||
;; hack on it to contact me <mwolson@gnu.org> in order to get write
|
||||
;; access to the shared Arch archive.
|
||||
;; For more information, visit the ERC page at
|
||||
;; <https://www.gnu.org/software/emacs/erc.html>.
|
||||
|
||||
;; Configuration:
|
||||
|
||||
|
@ -75,12 +66,12 @@
|
|||
(eval-when-compile (require 'subr-x))
|
||||
|
||||
(defvar erc-official-location
|
||||
"https://www.emacswiki.org/emacs/ERC (mailing list: emacs-erc@gnu.org)"
|
||||
"https://www.gnu.org/software/emacs/erc.html (mailing list: emacs-erc@gnu.org)"
|
||||
"Location of the ERC client on the Internet.")
|
||||
|
||||
(defgroup erc nil
|
||||
"Emacs Internet Relay Chat client."
|
||||
:link '(url-link "https://www.emacswiki.org/emacs/ERC")
|
||||
:link '(url-link "https://www.gnu.org/software/emacs/erc.html")
|
||||
:link '(custom-manual "(erc) Top")
|
||||
:prefix "erc-"
|
||||
:group 'applications)
|
||||
|
|
|
@ -27873,7 +27873,7 @@ Directory for additional secondary Rmail files.")
|
|||
|
||||
(custom-autoload 'rmail-secondary-file-directory "rmail" t)
|
||||
|
||||
(defvar rmail-secondary-file-regexp (purecopy "\\.xmail$") "\
|
||||
(defvar rmail-secondary-file-regexp (purecopy "\\.xmail\\'") "\
|
||||
Regexp for which files are secondary Rmail files.")
|
||||
|
||||
(custom-autoload 'rmail-secondary-file-regexp "rmail" t)
|
||||
|
|
|
@ -3474,20 +3474,22 @@ This affects `shell-command' and `async-shell-command'."
|
|||
:version "27.1")
|
||||
|
||||
(defcustom shell-command-dont-erase-buffer nil
|
||||
"Control if the output buffer is erased before the command.
|
||||
"Whether to erase the output buffer before executing shell command.
|
||||
|
||||
A nil value erases the output buffer before execution of the
|
||||
shell command, except when the output buffer is the current one.
|
||||
|
||||
The value `erase' ensures the output buffer is erased before
|
||||
execution of the shell command.
|
||||
execution of the shell command even if it is the current buffer.
|
||||
|
||||
Other non-nil values prevent the output buffer from being erased and
|
||||
set the point after execution of the shell command.
|
||||
Other non-nil values prevent the output buffer from being erased; they
|
||||
also reposition point in the shell output buffer after execution of the
|
||||
shell command, except when the output buffer is the current buffer.
|
||||
|
||||
The value `beg-last-out' sets point at the beginning of the output,
|
||||
`end-last-out' sets point at the end of the buffer, `save-point'
|
||||
restores the buffer position before the command."
|
||||
The value `beg-last-out' sets point at the beginning of the last
|
||||
output, `end-last-out' sets point at the end of the last output,
|
||||
and `save-point' restores the buffer position as it was before the
|
||||
shell command."
|
||||
:type '(choice
|
||||
(const :tag "Erase output buffer if not the current one" nil)
|
||||
(const :tag "Always erase output buffer" erase)
|
||||
|
@ -3517,9 +3519,12 @@ See `shell-command-dont-erase-buffer'."
|
|||
;; if some text has a non-nil read-only property,
|
||||
;; which comint sometimes adds for prompts.
|
||||
(setq pos
|
||||
(cond ((eq sym 'save-point) (point))
|
||||
((eq sym 'beg-last-out) (point-max))
|
||||
;;((not sym)
|
||||
(cond ((eq sym 'save-point)
|
||||
(if (not output-to-current-buffer)
|
||||
(point)))
|
||||
((eq sym 'beg-last-out)
|
||||
(if (not output-to-current-buffer)
|
||||
(point-max)))
|
||||
((or (eq sym 'erase)
|
||||
(and (null sym) (not output-to-current-buffer)))
|
||||
(let ((inhibit-read-only t))
|
||||
|
@ -3634,10 +3639,15 @@ says to put the output in some other buffer.
|
|||
If OUTPUT-BUFFER is a buffer or buffer name, erase that buffer
|
||||
and insert the output there; a non-nil value of
|
||||
`shell-command-dont-erase-buffer' prevents the buffer from being
|
||||
erased. If OUTPUT-BUFFER is not a buffer and not nil, insert the
|
||||
erased. If OUTPUT-BUFFER is not a buffer and not nil (which happens
|
||||
interactively when the prefix argument is given), insert the
|
||||
output in current buffer after point leaving mark after it. This
|
||||
cannot be done asynchronously.
|
||||
|
||||
The user option `shell-command-dont-erase-buffer', which see, controls
|
||||
whether the output buffer is erased and where to put point after
|
||||
the shell command.
|
||||
|
||||
If the command terminates without error, but generates output,
|
||||
and you did not specify \"insert it in the current buffer\",
|
||||
the output can be displayed in the echo area or in its buffer.
|
||||
|
@ -3725,8 +3735,7 @@ impose the use of a shell (with its need to quote arguments)."
|
|||
;; because we inserted text.
|
||||
(goto-char (prog1 (mark t)
|
||||
(set-marker (mark-marker) (point)
|
||||
(current-buffer))))
|
||||
(shell-command-set-point-after-cmd))
|
||||
(current-buffer)))))
|
||||
;; Output goes in a separate buffer.
|
||||
;; Preserve the match data in case called from a program.
|
||||
;; FIXME: It'd be ridiculous for an Elisp function to call
|
||||
|
|
|
@ -3848,6 +3848,12 @@ re_match_2 (struct re_pattern_buffer *bufp,
|
|||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
unwind_re_match (void *ptr)
|
||||
{
|
||||
struct buffer *b = (struct buffer *) ptr;
|
||||
b->text->inhibit_shrinking = 0;
|
||||
}
|
||||
|
||||
/* This is a separate function so that we can force an alloca cleanup
|
||||
afterwards. */
|
||||
|
@ -3944,6 +3950,19 @@ re_match_2_internal (struct re_pattern_buffer *bufp,
|
|||
|
||||
INIT_FAIL_STACK ();
|
||||
|
||||
ptrdiff_t count = SPECPDL_INDEX ();
|
||||
|
||||
/* Prevent shrinking and relocation of buffer text if GC happens
|
||||
while we are inside this function. The calls to
|
||||
UPDATE_SYNTAX_TABLE_* macros can trigger GC if they call Lisp,
|
||||
and we have C pointers to buffer text that must not become
|
||||
invalid as result of GC. */
|
||||
if (!current_buffer->text->inhibit_shrinking)
|
||||
{
|
||||
record_unwind_protect_ptr (unwind_re_match, current_buffer);
|
||||
current_buffer->text->inhibit_shrinking = 1;
|
||||
}
|
||||
|
||||
/* Do not bother to initialize all the register variables if there are
|
||||
no groups in the pattern, as it takes a fair amount of time. If
|
||||
there are groups, we include space for register 0 (the whole
|
||||
|
@ -3960,6 +3979,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp,
|
|||
/* The starting position is bogus. */
|
||||
if (pos < 0 || pos > size1 + size2)
|
||||
{
|
||||
unbind_to (count, Qnil);
|
||||
SAFE_FREE ();
|
||||
return -1;
|
||||
}
|
||||
|
@ -4174,6 +4194,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp,
|
|||
|
||||
DEBUG_PRINT ("Returning %td from re_match_2.\n", dcnt);
|
||||
|
||||
unbind_to (count, Qnil);
|
||||
SAFE_FREE ();
|
||||
return dcnt;
|
||||
}
|
||||
|
@ -5020,6 +5041,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp,
|
|||
if (best_regs_set)
|
||||
goto restore_best_regs;
|
||||
|
||||
unbind_to (count, Qnil);
|
||||
SAFE_FREE ();
|
||||
|
||||
return -1; /* Failure to match. */
|
||||
|
|
|
@ -766,7 +766,7 @@ See Bug#21722."
|
|||
(,output-buf (if ,output-buffer-is-current ,caller-buf
|
||||
(generate-new-buffer "output-buf")))
|
||||
(emacs (expand-file-name invocation-name invocation-directory))
|
||||
(,command (format "%s -Q --batch --eval '(princ \"%s\")'"
|
||||
(,command (format "%s -Q --batch --eval \"(princ \\\"%s\\\")\""
|
||||
emacs ,str))
|
||||
(inhibit-message t))
|
||||
(unwind-protect
|
||||
|
@ -803,7 +803,7 @@ See Bug#21722."
|
|||
(expected-point `((beg-last-out . ,(1+ (length str)))
|
||||
(end-last-out . ,(1+ (* 2 (length str))))
|
||||
(save-point . 1))))
|
||||
(dolist (output-buffer-is-current '(t ni))
|
||||
(dolist (output-buffer-is-current '(nil))
|
||||
(with-shell-command-dont-erase-buffer str output-buffer-is-current
|
||||
(when (memq shell-command-dont-erase-buffer '(beg-last-out end-last-out save-point))
|
||||
(should (= (point) (alist-get shell-command-dont-erase-buffer expected-point))))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue