Commit graph

2314 commits

Author SHA1 Message Date
Stefan Monnier
bffc4cb39d New generic function oclosure-interactive-form
It's used by `interactive-form` when it encounters an OClosure.
This lets one compute the `interactive-form` of OClosures
dynamically by adding appropriate methods.
This does not include support for `command-modes` for Oclosures.

* lisp/simple.el (oclosure-interactive-form): New generic function.

* src/data.c (Finteractive_form): Delegate to
`oclosure-interactive-form` if the arg is an OClosure.
(syms_of_data): New symbol `Qoclosure_interactive_form`.
* src/eval.c (Fcommandp): Delegate to `interactive-form` if the arg is
an OClosure.

* src/lisp.h (VALID_DOCSTRING_P): New function, extracted from
`store_function_docstring`.
* src/doc.c (store_function_docstring): Use it.

* lisp/kmacro.el (kmacro): Don't carry any interactive form.
(oclosure-interactive-form) <kmacro>: New method, instead.

* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-interactive-form)
<oclosure-test>: New method.
(oclosure-test-interactive-form): New test.

* doc/lispref/commands.texi (Using Interactive):
Document `oclosure-interactive-form`.
2022-04-26 10:36:52 -04:00
Lars Ingebrigtsen
ae3e3900a2 Provide help when doing (shell-command "... &") on buffer collisions
* lisp/simple.el (shell-command--same-buffer-confirm): New
function (bug#13649).
(shell-command): Use it to provide fuller help.
2022-04-24 15:48:29 +02:00
Lars Ingebrigtsen
2d71fd3b04 Further doc string quoting fixes
* test/lisp/progmodes/cperl-mode-tests.el (cperl--run-test-cases):
* lisp/simple.el (undo-equiv-table):
* lisp/shell.el (shell-mode):
(shell-mode):
* lisp/recentf.el (recentf-mode):
* lisp/org/ob-table.el (org-sbe):
* lisp/net/eudc.el (eudc-rfc5322-cctext-token):
* lisp/mail/ietf-drums-date.el (ietf-drums-date--slot-ranges):
* lisp/faces.el (color-luminance-dark-limit):
* lisp/erc/erc.el (erc-tls):
* lisp/emacs-lisp/pcase.el (pcase-setq): Further quoting fixes in
doc strings.
2022-04-22 17:16:42 +02:00
Lars Ingebrigtsen
11f66e16ac Fix indentation in copy-region-as-kill
* lisp/simple.el (copy-region-as-kill): Fix indendation.
2022-04-21 16:23:02 +02:00
Eli Zaretskii
8804dfdb1a Merge from origin/emacs-28
5e47d6284b * lisp/gnus/mm-encode.el (mm-default-file-encoding): Fix "...
e71c7a7c60 Fix default-directory of buffers visiting files in renamed...
cccaa9c31d Fix a kill-append regression
33828e4818 * doc/misc/eww.texi (Advanced): Correct outdated info (bug...
e8d2f40f41 Clean up the MSDOS port
338eda09d8 Fix typo in next-error-find-buffer-function

# Conflicts:
#	doc/misc/eww.texi
2022-04-16 13:45:50 -04:00
Lars Ingebrigtsen
db1bfcd909 Mention completion-wrap-movement in relevant commands
* lisp/simple.el (previous-completion, next-completion): Mention
`completion-wrap-movement'.
2022-04-16 17:17:05 +02:00
Juri Linkov
67505e0355 * lisp/minibuffer.el (minibuffer-completion-auto-choose): New defcustom.
(minibuffer-choose-previous-completion)
(minibuffer-choose-next-completion): Remove commands.
(minibuffer-local-completion-map): Remove keybindings of
minibuffer-choose-next-completion and minibuffer-choose-previous-completion.
Use them for minibuffer-next-completion and minibuffer-previous-completion.
* lisp/simple.el (minibuffer-local-shell-command-map): Idem.
2022-04-11 19:52:47 +03:00
Lars Ingebrigtsen
cccaa9c31d Fix a kill-append regression
* lisp/simple.el (kill-append): Fix a regression when
kill-ring-max is zero (bug#54842).
2022-04-11 12:40:56 +02:00
Daniel Martín
338eda09d8 Fix typo in next-error-find-buffer-function
* lisp/simple.el (next-error-find-buffer-function): Fix typo
(bug#54830).
2022-04-10 14:31:36 +02:00
Stefan Monnier
3c57867df4 lisp/simple.el: Use #' in new code
* lisp/simple.el (minibuffer-local-shell-command-map): Use #' to quote
function names.
2022-04-07 19:20:54 -04:00
Stefan Monnier
39e8fd357d OClosure: New function function-documentation
As mentioned in the original OClosure commit, OClosures (ab)use the
bytecode's docstring slot to hold the OClosure's type.  This currently
prevents OClosures from having their own docstring.

Introduce a new generic function `function-documentation` to fetch the
docstring of a function, which can then be implemented in various
different ways depending on the OClosure's type.

* lisp/simple.el (function-documentation): New generic function.
(bad-package-check): Strength-reduce `eval` to `symbol-value`.
* src/doc.c (Fdocumentation): Use it.

* lisp/emacs-lisp/oclosure.el (oclosure--accessor-docstring): New function.
* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-test):
Add test for accessor's docstrings.
2022-04-07 15:59:09 -04:00
Juri Linkov
4e2c70272f New commands for navigating completions from the minibuffer.
* lisp/simple.el (minibuffer-local-shell-command-map):
* lisp/minibuffer.el (minibuffer-local-completion-map):
Bind "M-<up>" to minibuffer-choose-previous-completion,
"M-<down>" to minibuffer-choose-next-completion,
"M-S-<up>" to minibuffer-previous-completion,
"M-S-<down>" to minibuffer-next-completion,
"M-RET" to minibuffer-choose-completion.
(with-minibuffer-completions-window): New macro.
(minibuffer-previous-completion, minibuffer-next-completion)
(minibuffer-choose-previous-completion)
(minibuffer-choose-next-completion)
(minibuffer-choose-completion): New commands.

https://lists.gnu.org/archive/html/emacs-devel/2022-03/msg00335.html
2022-04-05 22:20:16 +03:00
Juri Linkov
7aaffe25eb Use base prefix and suffix instead of completion-base-position (bug#49931)
* lisp/minibuffer.el (minibuffer-completion-help):
Set completion-base-affixes from base-prefix and base-suffix.
In completion-list-insert-choice-function handle
string values of start/end as prefix/suffix.

* lisp/simple.el (completion-base-affixes)
(completion-use-base-affixes): New variables.
(choose-completion): Let-bind base-affixes to completion-base-affixes.
Use base-affixes when completion-use-base-affixes is non-nil.
(completion-setup-function): Sync values of base-affixes and
completion-base-affixes.
2022-04-05 21:54:11 +03:00
Juri Linkov
6a50ff10f7 Choosing a completion with a prefix argument doesn't exit the minibuffer
* lisp/simple.el (choose-completion): New optional args NO-EXIT and NO-QUIT.
(bug#47417)
2022-04-05 21:21:42 +03:00
Jimmy Aguilar Mena
91ca41e292 Fix some details in completions
* lisp/minibuffer.el (completion--insert-one-column) : Remove the extra
new-line at the end.
* lisp/simple.el (next-completion) : Fix behavior when
completion-wrap-movement and remove bobp and eobp. This removes the
extra tab ad the end of the list before wrapping or going to the
minibuffer and apparently also fixes bug#54374
(switch-to-completions) : Simplify condition code and remove comment not
applicable anymore.
2022-04-05 13:52:53 +02:00
Eli Zaretskii
ab414c5661 Improve documentation of 'completion-auto-select'
* lisp/simple.el (completion-auto-select):
* doc/emacs/mini.texi (Completion Options): Improve documentation
and description of customization options of 'completion-auto-select'.
2022-03-25 15:39:44 +03:00
Philip Kaludercic
392d66f6f5 Fix wrapping of 'previous-completion' at the beginning of buffer
* lisp/simple.el (next-completion): Prevent an error of
'previous-completion' at the beginning of completions buffer.
Also fix 'previous-completion' to wrap to the last completion.
(bug#54374)
2022-03-24 20:11:01 +02:00
Juri Linkov
71aec1d044 Small fixes for the new feature 'second-tab' of 'completion-auto-select'
* lisp/simple.el (completion-auto-select): Extend the docstring.
2022-03-24 19:54:14 +02:00
Jimmy Aguilar Mena
3a349ff648 Add completion-auto-select second-tab value.
* lisp/minibuffer.el (completion--in-region-1) : Change if with cond and
check if completion-auto-select.
* lisp/simple.el (completion-auto-select) : Move before first use.
(completion-setup-function) : Make a more precise check for when
completion-auto-select is t.
2022-03-24 11:18:05 +01:00
Jimmy Aguilar Mena
da3af500ad Revert "Set cursor-face-highlight-nonselected-window in completions."
This reverts commit 1641b5c04c.

This fixes incorrect highlight in Completions.
2022-03-22 18:31:13 +01:00
Juri Linkov
15ac51e0fd Merge branch 'feature/completions-customs' 2022-03-22 10:22:46 +02:00
Juri Linkov
eba9c473a8 Small fixes for new completions features
* lisp/minibuffer.el (completions-header-format):
Rename from completion-header-format.
(completions-highlight, completions-highlight-face):
Move up before first use.
2022-03-21 21:27:41 +02:00
Jimmy Aguilar Mena
1641b5c04c Set cursor-face-highlight-nonselected-window in completions.
* lisp/simple.el (completion-setup-function) : Sets
cursor-face-highlight-nonselected-window to t in Completions.
2022-03-21 07:55:03 +01:00
Augusto Stoffel
3d204afe3c New hook, lazy-count-update-hook
* lisp/isearch.el (lazy-count-update-hook): New hook allowing to
display the lazy count in special ways.
(isearch-lazy-highlight-new-loop,
isearch-lazy-highlight-buffer-update): Run `lazy-count-update-hook' at
appropriate times.
* lisp/comint.el (comint-history-isearch-setup,
comint-history-isearch-end): Make sure no lazy count is displayed.
* lisp/simple.el (minibuffer-history-isearch-setup): Make sure no lazy
count is displayed.
2022-03-20 22:25:12 +02:00
Jimmy Aguilar Mena
9bcf58d27c cursor-face-highlight-nonselected-window default to nil
* lisp/simple.el (redisplay--update-cursor-face-highlight) : Use if-let*
and not check facep.
(cursor-face-highlight-nonselected-window) : default to nil
2022-03-18 22:57:45 +01:00
Stefan Monnier
06ea82e4e3 Remove some early-bootstrap dependencies for advice
The dependencies between `advice`, cl-generic`, `bytecomp`, `cl-lib`,
`simple`, `help`, ... were becoming unmanageable.
Break the reliance on `advice` (which includes making sure the
compiler is not needed during the early bootstrap).

* lisp/simple.el (pre-redisplay-function): Set without using `add-function`.

* lisp/loadup.el (advice, simple): Move to after `cl-generic`.

* lisp/help.el (command-error-function): Set without using `add-function`.
(help-command-error-confusable-suggestions): Explicitly call
`command-error-default-function` instead.

* lisp/emacs-lisp/cl-macs.el (pcase--mutually-exclusive-p): Don't
optimize during early-bootstrap.

* lisp/emacs-lisp/cl-generic.el (cl--generic-lambda): Tiny simplification.
(cl-defmethod): Label the obsolescence warning as it should.
(cl--generic-compiler): New variable.
(cl--generic-get-dispatcher): Use it.
(cl--generic-prefill-dispatchers): Make freshly made dispatchers.
2022-03-17 19:07:59 -04:00
Jimmy Aguilar Mena
d7d0f5b5a2 Add new variable cursor-face-highlight-nonselected-window
* lisp/simple.el (cursor-face-highlight-nonselected-window) : New
custom default to cursor-in-non-selected-windows.
(redisplay--update-cursor-face-highlight) : Extend highlight condition
to consider the new variable.
2022-03-17 19:36:08 +01:00
Stefan Monnier
f96669e0a4 * lisp/simple.el (cursor-face-highlight-mode): Fix copy&paste 2022-03-14 08:27:31 -04:00
Jimmy Aguilar Mena
11bfff37ad Add local to remove-hook in cursor-face-highlight-mode
Add LOCAL flag in remove-hook and reword the dock string.

Thanks to Stefan Monnier for this
2022-03-14 09:50:41 +01:00
Jimmy Aguilar Mena
c1ea52f4ad Improve cursor-face-highlight-mode a bit more.
Add the hook locally to the buffer only when needed to avoid even
calling the function redisplay--update-cursor-face-highlight when the
mode is enabled.

* lisp/simple.el (redisplay--update-cursor-face-highlight) : Remove
unneeded condition.
(cursor-face-highlight-mode) : Conditionally add or remove
redisplay--update-cursor-face-highlight to pre-redisplay-functions with
buffer local flag.
2022-03-14 02:55:27 +01:00
Jimmy Aguilar Mena
e06c4039c2 Improve the cursor-face feature.
Use a minor mode to reduce potential performance issues.

* lisp/simple.el (cursor-face-highlight-mode) : New minor mode
(completion-setup-function) : Use the new minor mode
cursor-face-highlight-mode in completions.
(redisplay--unhighlight-overlay-function) : Add -- to the name
(redisplay--highlight-overlay-function) : Make the face parameter
optional and add -- in the name.
2022-03-14 02:38:46 +01:00
Jimmy Aguilar Mena
2ce4c038ec Rename hook
* lisp/simple.el (redisplay--update-cursor-property-highlight) : Renamed
to redisplay--update-cursor-property-highlight
2022-03-13 21:35:48 +01:00
Jimmy Aguilar Mena
fd7bde612a Add new special text attribute cursor-face
Reuse the functions for highlight region.
* lisp/simple.el (redisplay-unhighlight-overlay-function) :
(redisplay-highlight-overlay-function) : New functions from previous
lambda
(redisplay-unhighlight-region-function) :
(redisplay-highlight-region-function) : Redefined with the new functions.
(redisplay--update-cursor-property-highlight) : New function for
pre-redisplay-functions.
2022-03-13 19:32:42 +01:00
Lars Ingebrigtsen
13b9268374 Add a mechanism for querying before executing a command
* doc/emacs/custom.texi (Disabling): Document it.
* doc/lispref/commands.texi (Disabling Commands): Document the
low-level stuff.

* lisp/simple.el (command-execute): Respect the `(query ...)'
value for `disabled'.
(command-execute--query): New function.
(command-query): New function.
2022-02-14 11:20:41 +01:00
Eli Zaretskii
fe27479cad Fix 'exchange-point-and-mark' in 'transient-mark-mode'
* lisp/simple.el (exchange-point-and-mark): Don't deactivate mark
when 'transient-mark-mode' is ON.  (Bug#53150)

(cherry picked from commit 415ed4b425)
2022-02-13 15:22:13 +02:00
Eli Zaretskii
2289a7a271 Fix "C-SPC C-SPC" after "C-x C-x"
* lisp/simple.el (exchange-point-and-mark): Fix what the command
does when 'transient-mark-mode' is OFF.  (Bug#52896)

(cherry picked from commit 19c6cad182)
2022-02-13 15:21:50 +02:00
Eli Zaretskii
68b3273214 ; * lisp/simple.el (count-words): Doc fix. 2022-02-13 15:05:13 +02:00
Lars Ingebrigtsen
242a2765d3 Make `C-u M-x count-words' also give totals
* lisp/simple.el (count-words-region): Adjust callers.
(count-words): If given a prefix, give totals (bug#9959).
(count-words--buffer-format, count-words--format): Rename and
don't message, but return the string.
2022-02-13 10:56:20 +01:00
Antoine Levitt
2f80d8058b Improve the set-fill-column prompt
* lisp/simple.el (set-fill-column): Improve the prompt (bug#53874).
2022-02-09 10:53:19 +01:00
Eli Zaretskii
0a5ece3da1 Allow <Delete> key to delete entire grapheme clusters
* lisp/simple.el (delete-forward-char): If deleting forward,
delete complete grapheme clusters as single units.

* etc/NEWS: Announce the change.
2022-01-29 12:19:23 +02:00
Michael Albinus
87c2367011 Clarify where the shell-command output goes
* lisp/simple.el (shell-command):
* doc/emacs/misc.texi (Single Shell): Clarify where the output
goes if the specified buffer isn't the current one (bug#40896).
2022-01-28 16:32:15 +01:00
Po Lu
03f4a2ff64 Merge from origin/emacs-28
11ea45c9e4 Fix UB in ebrowse
ba57b78064 Fix execute-extended-command-for-buffer in fundamental-mode
ef0c1d4c2c Add workaround to handle a problem with Enlightenment WM (...
2022-01-21 15:27:35 +08:00
Andrew Hyatt
27b3948a8a Fix indirect font changes incorrectly affecting original buffer
* lisp/face-remap.el (face-attrs--make-indirect-safe):
(clone-indirect-buffer-hook): Set up a face remapping alist
(bug#53294).

* lisp/simple.el (clone-indirect-buffer): Move the point the hook
is run.

* src/buffer.c (Fmake_indirect_buffer, syms_of_buffer): Move the
place where the clone-indirect-buffer-hook variable is defined, so
that we can call it from C.
2022-01-20 14:42:31 +01:00
Lars Ingebrigtsen
ba57b78064 Fix execute-extended-command-for-buffer in fundamental-mode
* lisp/simple.el (execute-extended-command-for-buffer): Protect
against the current local map being nil (bug#52907).
2022-01-20 11:00:41 +01:00
Stefan Kangas
8df828e405 Merge from origin/emacs-28
5990148860 * lisp/simple.el (undo-no-redo): Fix customization group
ac2cdb8a46 * lisp/progmodes/xref.el (xref-file-name-display): Fix doc...
c05864dd25 Avoid another segfault in 'face_at_buffer_position'
2022-01-15 06:47:59 +01:00
Philipp Stephani
5990148860 * lisp/simple.el (undo-no-redo): Fix customization group 2022-01-14 22:06:13 +01:00
Eli Zaretskii
415ed4b425 Fix 'exchange-point-and-mark' in 'transient-mark-mode'
* lisp/simple.el (exchange-point-and-mark): Don't deactivate mark
when 'transient-mark-mode' is ON.  (Bug#53150)
2022-01-10 19:10:52 +02:00
Eli Zaretskii
19c6cad182 Fix "C-SPC C-SPC" after "C-x C-x"
* lisp/simple.el (exchange-point-and-mark): Fix what the command
does when 'transient-mark-mode' is OFF.  (Bug#52896)
2022-01-07 20:30:17 +02:00
Eli Zaretskii
dcd76bd48d Merge from origin/emacs-28
836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year.
86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year
ebe8772f65 ; Minor fixes related to copyright years
23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye...
8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t.
19dcb237b5 ; Add 2022 to copyright years.

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	lib/cdefs.h
#	lisp/erc/erc-dcc.el
#	lisp/erc/erc-imenu.el
#	lisp/erc/erc-replace.el
#	lisp/image-dired.el
#	lisp/progmodes/xref.el
#	m4/alloca.m4
#	m4/byteswap.m4
#	m4/errno_h.m4
#	m4/getopt.m4
#	m4/gnulib-common.m4
#	m4/inttypes.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/sys_socket_h.m4
2022-01-01 07:03:03 -05:00
Eli Zaretskii
19dcb237b5 ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00