1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-11 08:30:45 -08:00
Commit graph

2430 commits

Author SHA1 Message Date
Eli Zaretskii
476933b235 ; * lisp/simple.el (shell-command-to-string): Fix quotation. 2023-09-23 09:09:03 +03:00
Stefan Kangas
94705f8300 ; Fix last change in shell-command-to-string
* lisp/simple.el (shell-command-to-string): Fix typo and improve
wording.  Problem reported by Eli Zaretskii <eliz@gnu.org>.
2023-09-17 20:43:37 +02:00
Stefan Kangas
94bef169e2 Document shell-command-to-string security considerations
* lisp/simple.el (shell-command-to-string): Document security
considerations in docstring.
2023-09-17 17:06:43 +02:00
Stephen Berman
33ff4fed03 Make move-end-of-line in minibuffer consistent (bug#65980)
* lisp/simple.el (move-end-of-line): Always move to eol when
invoking `C-e' from within the minibuffer's prompt string.
2023-09-16 14:00:24 +02:00
Eli Zaretskii
221ed70b90 ; Improve documentation of 'define-alternatives'
* doc/lispref/commands.texi (Generic Commands):
* lisp/simple.el (define-alternatives): Improve documentation of
'define-alternatives'.
2023-08-15 17:08:12 +03:00
Eli Zaretskii
16f3a09e8d ; * lisp/simple.el (kill-new): Fix a typo. (Bug#64423) 2023-07-15 22:08:52 +03:00
Spencer Baugh
d09de2f49d Ignore quit while getting interprogram paste in kill-new
On X, if the current selection owner is not responding to selection
requests, the user may want to take ownership of the selection.  The
obvious way to do this is to kill some text (which a user might also
be doing just as part of normal editing at the time the selection
owner becomes nonresponsive).  However, if
save-interprogram-paste-before-kill is non-nil, then killing text will
hang until the user quits, and this quit will abort the entire
kill-new, preventing the user from taking ownership of the selection.

Now instead if the user quits while we are attempting to retrieve the
selection from hanging owner, we will proceed to take ownership of the
selection as normal, resolving the problem.

(One example of a selction owner that might not be responding to
selection requests is another instance of Emacs itself; while Emacs is
blocked in call-process or Lisp execution, it currently does not
respond to selection requests.)

* lisp/simple.el (kill-new): Ignore quit while getting interprogram
paste (bug#64423)
2023-07-15 12:00:22 +03:00
Eli Zaretskii
70fc7c41ef Improve documentation of 'declare' forms
* lisp/simple.el (read-extended-command-predicate): Mention the
'(declare completion ...' form in the doc string.

* doc/lispref/functions.texi (Declare Form): Clarify
'completion-predicate' and 'modes'; add cross-references.
(Bug#64045)
2023-06-15 09:28:26 +03:00
Eli Zaretskii
dc7acb1aaf Avoid errors in 'delete-forward-char' deleting static compositions
* lisp/simple.el (delete-forward-char): Fix recognition of static
compositions.  (Bug#63837)
2023-06-02 15:42:42 +03:00
Eli Zaretskii
4daa6f7049 ; * lisp/simple.el (async-shell-command): Add commentary about 3rd arg. 2023-05-18 14:03:10 +03:00
Eli Zaretskii
5c8864fab4 ; * lisp/simple.el (async-shell-command): Doc fix. (Bug#63432) 2023-05-14 10:13:39 +03:00
Gabriel do Nascimento Ribeiro
b96dc472bc Ignore current-prefix-arg in async-shell-command
* lisp/simple.el (async-shell-command): Ignore current-prefix-arg and
always pass nil to second argument of `shell-command'.  (Bug#63432)
2023-05-14 09:24:16 +03:00
Eli Zaretskii
97b818a4fb Fix doc strings of 'mark-sexp' and 'mark-word'
* lisp/emacs-lisp/lisp.el (mark-sexp):
* lisp/simple.el (mark-word): Clarify the doc strings in various
usage cases.  (Bug#62892)
2023-05-06 11:47:31 +03:00
Eli Zaretskii
db21c84bc9 ; Improve doc string of 'C-q'
* lisp/simple.el (read-quoted-char-radix, quoted-insert): Doc fix.
2023-02-22 16:24:59 +02:00
Juri Linkov
683961cd73 * lisp/simple.el (choose-completion): Check for completion-in-region-mode.
Don't use base-affixes when completion-use-base-affixes is non-nil
in completion-in-region-mode (bug#61535).
2023-02-19 21:30:02 +02:00
Eli Zaretskii
4faebba2fe Fix invocation of File->Close from the menu bar
* lisp/simple.el (kill-buffer--possibly-save): Don't request
LONG-FORM from 'read-multiple-choice' if GUI dialog should be
used.
* lisp/emacs-lisp/rmc.el (read-multiple-choice): Doc fix.
(read-multiple-choice--short-answers): Don't append "?" to
CHOICES and don't display the prompt in the echo area if GUI
dialog is used.  Use 'use-dialog-box-p'.  (Bug#61553)
2023-02-19 11:29:32 +02:00
Eli Zaretskii
774051873d Fix documentation of 'just-one-space' and 'delete-horizontal-space'
* lisp/simple.el (just-one-space, delete-horizontal-space):
Mention the effect of prefix argument.  (Bug#61609)
2023-02-18 20:03:33 +02:00
Kévin Le Gouguec
c498884059 Avoid spurious pause in kill-ring-save (Bug#60841)
'indicate-copied-region' checks whether the region is "highlighted"
and if not, briefly moves point to mark to give a visual cue of the
extent of text that was saved to the kill ring.

The region is considered "highlighted" if (a) it is active and (b) its
face specifies a :background.  That latter condition does not account
for the multiple ways in which the face can make the region "visually
distinct" from the default face, so switch to the more extensive
predicate face-differs-from-default-p.

The patch also fixes a couple of issues with the predicate's
implementation, and introduces a new user option in case anyone
happened to enjoy unconditional blinking.

* lisp/faces.el (face-differs-from-default-p): Filter out :extend; add
rationale for the attributes we ignore.
* lisp/simple.el (copy-region-blink-predicate): Add option to let
users explicitly opt into or out of blinking point and mark.
(region-indistinguishable-p): New function to detect
"if there is currently no active region highlighting", leveraging
face-differs-from-default-p.
(indicate-copied-region): Use it.
* src/xfaces.c (merge_face_ref): Allow :stipple to be nil, since it is
a documented valid value for that attribute.
* etc/NEWS: Announce user option.
2023-02-02 19:39:39 +01:00
Eli Zaretskii
194bc97879 Improve documentation of 'shell-command-dont-erase-buffer'
* doc/emacs/misc.texi (Single Shell):
* lisp/simple.el (shell-command, shell-command-on-region):
Document that non-nil value of 'shell-command-dont-erase-buffer'
affects what is displayed in the echo area after the command.
(Bug#61100)
2023-01-27 19:01:49 +02:00
Po Lu
89cb3c3f15 Minor fixes for Haiku
* lisp/frame.el (display-symbol-keys-p):
* lisp/simple.el (normal-erase-is-backspace-setup-frame): Add
support for Haiku.
2023-01-22 08:37:06 +08:00
Stefan Kangas
920a7d38e9 ; Fix typos 2023-01-15 02:14:19 +01:00
Juri Linkov
a8eb9dd400 Fix the case in first-completion revealed by minibuffer-tests
* lisp/simple.el (first-completion): Add the text-property 'first-completion'
when the first completion is at the beginning of the buffer.

* test/lisp/minibuffer-tests.el (completions-header-format-test):
Revert the recent change.
2023-01-14 20:56:33 +02:00
Gregory Heytings
9ecebcdded * lisp/simple.el (next-completion): Handle first completion specially.
When completions-header-format is nil and completion-show-help is nil,
the first completion is at the beginning the buffer, so 'M-<down>'
missed it and moved to the second completion.  Handle this case by
setting/checking the special text-property 'first-completion' that
is nil at the first call (bug#60411).
2023-01-12 19:47:28 +02:00
Eli Zaretskii
53e64cfb85 Improve options and docs of M-x command completion
* lisp/simple.el (read-extended-command-predicate): Expand the
doc string.  Add 2 more selectable values.
(command-completion-using-modes-and-keymaps-p): New function.
(execute-extended-command): Mention
'read-extended-command-predicate' in the doc string.  (Bug#60645)
2023-01-08 12:23:26 +02:00
Eli Zaretskii
f12f72b0e0 ; * lisp/simple.el (primitive-undo): Clarify error message (bug#60467) 2023-01-01 17:49:10 +02:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Eli Zaretskii
6dda2106ec ; Improve documentation of "C-x @"
* doc/emacs/custom.texi (Modifier Keys): Document how to enter
Shift, Control, and Meta using "C-x @".

* lisp/simple.el (function-key-map): Add commentary to "C-x @"
bindings to make them easier to discover.
2022-12-23 14:37:04 +02:00
Eli Zaretskii
c26ab22cf4 ; Improve doc strings of minibuffer-history commands
* lisp/simple.el (goto-history-element, next-history-element)
(previous-history-element): Doc fixes.  (Bug#60103)
2022-12-16 17:32:05 +02:00
Eli Zaretskii
89f54e8157 A better fix for bug#60096
* lisp/startup.el (initial-scratch-message):
* lisp/simple.el (get-scratch-buffer-create): Revert last changes.

* src/window.c (Fset_window_configuration): Force recalculation of
Vwindow_list after restoring the windows.
* src/buffer.c (other_buffer_safely): Make sure we always return a
valid buffer, even if 'get-scratch-buffer-create' signals an
error.
2022-12-16 16:29:51 +02:00
Eli Zaretskii
3b618d0e3e Avoid segfaults due to invalid selected-window's buffer
* lisp/startup.el (initial-scratch-message): Don't use \\[...]
commands for substitute-command-keys.
* lisp/simple.el (get-scratch-buffer-create): Don't call
substitute-command-keys on initial-scratch-message, to avoid
signaling an error in rare cases.  (Bug#60096)
2022-12-15 23:39:58 +02:00
Juri Linkov
99aa00e6e3 Revert 21b387c39b with last-minute hasty changes (bug#60048).
* lisp/simple.el (completion-list-mode-map): Unbind [up] and [down].
(previous-line-completion, next-line-completion): Remove.
2022-12-15 21:27:36 +02:00
Tassilo Horn
005efce764 Fix face issues in show-paren context overlay (bug#59527)
* lisp/paren.el (show-paren--show-context-in-overlay): Use
show-paren-priority as overlay priority (fixes problem 2 of
bug#59527).
* lisp/simple.el (blink-paren-open-paren-line-string): Ensure the
context lines are font-locked before taking the
buffer-substring (fixes problem 1 of bug#59527).
2022-11-24 10:47:54 +01:00
Juri Linkov
21b387c39b New commands previous-line-completion and next-line-completion (bug#59486)
* lisp/simple.el (completion-list-mode-map): Bind [up] to
'previous-line-completion', and [down] to 'next-line-completion'.
(completion-auto-wrap): Mention `next-line-completion' and
`previous-line-completion' in the docstring.
(previous-line-completion, next-line-completion): New commands.
2022-11-23 20:44:37 +02:00
Stefan Kangas
9db6da5449 Add face to key bindings suggested by M-x
* lisp/simple.el (execute-extended-command--describe-binding-msg):
Use 'help-key-binding' face for keybinding.
2022-11-15 04:19:36 +01:00
Stefan Kangas
a5bf6fb526 Fix suggest-key-bindings displaying key as command
* lisp/simple.el (execute-extended-command--describe-binding-msg):
New function factored out from...
(execute-extended-command): ...here.  Fix bug where a key binding was
displayed as a command with 'suggest-key-bindings'.  (Bug#59247)
* test/lisp/simple-tests.el
(simple-execute-extended-command--describe-binding-msg): New test.
2022-11-13 19:46:02 +01:00
Stefan Kangas
ae1a6b5bdf ; * lisp/simple.el (execute-extended-command): Improve comments. 2022-11-13 16:53:31 +01:00
Stefan Monnier
616aa23d8a * lisp/simple.el (function-documentation): Fix bug#59014 2022-11-04 11:59:51 -04:00
Michael Heerdegen
93136169cb Try to speed up extended command shorthand computation
Discussed in Bug#51143.

* lisp/simple.el (execute-extended-command--shorter): Compute a
complete list of `commandp' symbols once.  This significantly speeds
up complicated cases while the slowdown of simple cases is still
accetable.
2022-10-09 20:42:44 +02:00
Stefan Monnier
d6831d1b0a subr.el (inhibit-point-motion-hooks): Mark it as obsolete
When Emacs-25 changed the default of `inhibit-point-motion-hooks` to t,
/etc/NEWS declared it as obsolete and so did its docstring, but
it was not marked as obsolete so as not to emit too many warnings
in code where it was impractical to remove the let-binding while
keeping backward compatibility with older Emacsen.
Those backward compatibility issues are not serious any more now that
Emacs-25 is itself considered old.

* lisp/subr.el (inhibit-point-motion-hooks): Mark it as obsolete.
* src/textprop.c (inhibit-point-motion-hooks): Don't mention it being
obsolete in the docstring any more.
* lisp/simple.el (line-move-1, line-move-finish): Silence warnings.
2022-10-07 14:15:40 -04:00
Stefan Monnier
3bf53ad05c (line-move-1): Obey inhibit-point-motion-hooks
`line-move-1` was written back before `inhibit-point-motion-hooks`
was made obsolete and it's written under the assumption that its
value is nil, whereas since Emacs-25 it's t.

To work around problems linked to a nil value of
`inhibit-point-motion-hooks`, the code temporarily binds that var to
t while it moves around trying to find the final destination and then
later in a few key spots it binds it "back" to nil so as to run the
point-motion hooks according to the final destination, as if the
overall motion had been made "normally".

Change the code so that the "bind back" indeed binds the var back to
the value it had originally, rather than always to nil.

* lisp/simple.el (line-move-1): Obey `inhibit-point-motion-hooks`
(line-move-finish): New optional arg `not-ipmh`.
2022-10-07 12:51:14 -04:00
Stefan Monnier
d28581101a Remove redundant let-bindings of inhibit-point-motion-hooks
`inhibit-point-motion-hooks` has defaulted to t (and been declared
obsolete) since Emacs-25, so remove left-over bindings to that
now default value.

* lisp/dabbrev.el (dabbrev--search):
* lisp/format.el (format-insert-file):
* lisp/forms.el (forms-next-field, forms-prev-field):
* lisp/minibuf-eldef.el (minibuf-eldef-setup-minibuffer):
* lisp/simple.el (primitive-undo):
* lisp/cedet/semantic/edit.el (semantic-change-function):
* lisp/cedet/srecode/fields.el (srecode-field-mod-hook):
* lisp/cedet/srecode/insert.el (srecode-insert-fcn):
* lisp/erc/erc-button.el (erc-button-add-buttons):
* lisp/erc/erc.el (erc-display-line):
* lisp/eshell/em-script.el (eshell-source-file):
* lisp/eshell/em-smart.el (eshell-smart-scroll-window):
* lisp/eshell/esh-arg.el (eshell-parse-arguments):
* lisp/eshell/esh-cmd.el (eshell-with-temp-command):
* lisp/eshell/esh-mode.el (eshell-send-input, eshell-output-filter):
* lisp/gnus/gnus-art.el (gnus-with-article-headers)
(article-hide-headers, article-hide-boring-headers)
(article-decode-mime-words, article-decode-charset)
(article-decode-encoded-words, article-decode-group-name)
(article-decode-idna-rhs, article-hide-list-identifiers)
(article-strip-banner, article-really-strip-banner)
(article-strip-leading-blank-lines)
(article-strip-multiple-blank-lines, article-strip-leading-space)
(article-strip-trailing-space, article-strip-all-blank-lines)
(gnus-article-narrow-to-signature, gnus-article-show-hidden-text)
(article-date-ut, article-verify-x-pgp-sig)
(gnus-article-only-boring-p, gnus-article-highlight-signature)
(gnus-article-add-buttons, gnus-signature-toggle, gnus-button-push):
* lisp/gnus/gnus-cite.el (gnus-article-highlight-citation)
(gnus-article-fill-cited-article, gnus-article-hide-citation)
(gnus-article-toggle-cited-text, gnus-article-hide-citation-maybe)
(gnus-cite-parse-wrapper, gnus-cite-add-face, gnus-cite-toggle):
* lisp/gnus/gnus-gravatar.el (gnus-gravatar-insert):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-sum.el (gnus-summary-toggle-header):
* lisp/gnus/gnus-util.el (gnus-fetch-field):
* lisp/gnus/message.el (message-fetch-field, message-reply)
(message-followup, message-hide-headers):
* lisp/net/goto-addr.el (goto-address-fontify):
* lisp/obsolete/linum.el (linum-update-window):
* lisp/play/zone.el (zone-shift-left, zone-shift-right)
(zone-fill-out-screen):
* lisp/progmodes/opascal.el (opascal-save-excursion):
* lisp/progmodes/vhdl-mode.el (vhdl-prepare-search-2):
* lisp/textmodes/enriched.el (enriched-encode):
* lisp/textmodes/flyspell.el (flyspell-word-search-backward)
(flyspell-word-search-forward):
* lisp/textmodes/table.el (table--point-entered/left-cell-function):
Remove let-binding of `inhibit-point-motion-hooks`.
2022-10-07 12:16:47 -04:00
Eli Zaretskii
1d3d87cd67 ; * lisp/simple.el (cursor-face-highlight-mode): Doc fix. 2022-10-04 22:25:20 +03:00
Stefan Monnier
c244d4af57 cconv.el: Fix interactive closure bug#51695
Make cconv.el detect when a closure's interactive form needs to
capture variables from the context and tweak the code accordingly
if so.

* lisp/emacs-lisp/cconv.el (cconv--interactive-form-funs): New var.
(cconv-convert): Handle the case where the interactive form captures
vars from the surrounding context.  Remove left over handling of
`declare` which was already removed from the cconv-analyze` phase.
(cconv-analyze-form): Adjust analysis of interactive forms accordingly.

* lisp/emacs-lisp/oclosure.el (cconv--interactive-helper): New type and
function.
* lisp/simple.el (function-documentation, oclosure-interactive-form):
Add methods for it.

* test/lisp/emacs-lisp/cconv-tests.el
(cconv-tests-interactive-closure-bug51695): New test.
2022-09-23 16:36:16 -04:00
Drew Adams
f372afef20 Tweak how use-region-p works with `use-empty-active-region'
* lisp/simple.el (use-region-p): Don't report non-nil if the user
has just clicked mouse-1 without extending the region (bug#51874).
2022-09-20 17:12:29 +02:00
Stefan Kangas
9035c20888 Revert "Allow nil value for filter-buffer-substring-function"
This reverts commit a7c65fc666.
2022-09-20 09:28:46 +02:00
Stefan Kangas
a7c65fc666 Allow nil value for filter-buffer-substring-function
* lisp/simple.el
(filter-buffer-substring): Support a nil value to be more resilient.
(filter-buffer-substring-function): Doc fix; improve and update for
above change.
2022-09-19 16:55:55 +02:00
Lars Ingebrigtsen
4209a4d3ae Remove the save-match-data from shell-command
* lisp/simple.el (shell-command): Remove save-match-data, since
we're (in many cases) altering the match data earlier in the
function anyway (bug#57795).
2022-09-14 15:26:30 +02:00
Lars Ingebrigtsen
07ee1be052 Move imagep in image.c from the debugging section
* lisp/simple.el (imagep): Remove.
* src/image.c (Fimagep): Always define.
2022-09-13 16:37:31 +02:00
Lars Ingebrigtsen
36993bb9c2 Add new function imagep
* lisp/simple.el (imagep): New function.
2022-09-13 15:53:42 +02:00
Juri Linkov
40cdbf6dc1 Use use-region-beginning/end in replacement commands (bug#45607)
* lisp/isearch.el (isearch-query-replace): Use use-region-beginning
and use-region-end.

* lisp/textmodes/paragraphs.el (repunctuate-sentences):
* lisp/replace.el (query-replace, query-replace-regexp)
(map-query-replace-regexp, replace-string, replace-regexp):
Add 'interactive-args' to 'declare' and use use-region-beginning,
use-region-end, use-region-noncontiguous-p.

* lisp/simple.el (use-region-noncontiguous-p): New function.
(region-noncontiguous-p): Return more meaningful value.
2022-09-04 19:55:59 +03:00