1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-13 09:32:47 +00:00
Commit Graph

634 Commits

Author SHA1 Message Date
Stefan Kangas
a463dccdd0 Merge from origin/emacs-28
b4067394dc Set `default-directory' of Tramp archive connection buffer
2529e82002 ; * doc/lispref/functions.texi (Declare Form): Fix typo.
54c4ceb009 Update the documentation of 'declare' forms
7263631dca Fix bookmark support for Help functions in native-compilat...

# Conflicts:
#	lisp/help.el
2022-07-24 09:55:01 +02:00
Eli Zaretskii
7263631dca Fix bookmark support for Help functions in native-compilation builds
* lisp/help.el (describe-key--helper, describe-function--helper):
New helper functions.
(describe-key): Call 'describe-key--helper' instead of a
lambda-function.
* lisp/help-fns.el (describe-function): Call
'describe-function--helper' instead of a lambda-function.
(Bug#56643)
2022-07-23 11:11:47 +03:00
Stefan Kangas
5f1023a2ff Minor doc fix in search-forward-help-for-help
* lisp/help.el (search-forward-help-for-help): Use command
substitution.
2022-07-21 09:23:27 +02:00
Stefan Kangas
ac0027f6a5 Remove dead branch from substitute-command-keys
* lisp/help.el (substitute-command-keys): Remove dead branch;
where-is-internal will follow any remaps for us.  Note also that the
test case for remapping still pass.
2022-07-11 17:22:19 +02:00
Lars Ingebrigtsen
274fcfa850 Restore temp-buffer-resize-mode behaviour wrt. [back] buttons
* lisp/help.el (help--window-setup): If temp-buffer-resize-mode, do
the window setup after adding [back] buttons (bug#56306).
2022-06-30 12:35:55 +02:00
Stefan Kangas
37315f9895 Don't error out on invalid literal key substitutions
It would be backwards-incompatible to error out on invalid literal key
substitutions.  Consider this docstring fragment, where "\\`" should
have been escaped but wasn't:

    "Example value: \"\\(?:\\`[#.]\\)\\|\\(?:[#~]\\'\\)\"."

If we error out, we can't display this docstring at all.  However, it
is clearly better to display something in such cases, even if
suboptimal, than refusing to display anything at all.

* lisp/help.el (substitute-command-keys): Don't error out on invalid
literal key substitutions: just ignore them instead.
* test/lisp/help-tests.el
(help-tests-substitute-command-keys/literal-key-sequence-errors):
Delete test.
(help-tests-substitute-command-keys/literal-key-sequence-ignore-invalid):
New test.
2022-06-25 12:25:58 +02:00
Lars Ingebrigtsen
a5387dec4e Fix previous describe-key change
* lisp/help.el (describe-function-orig-buffer): Ensure we bind
dynamically.
2022-06-21 13:34:54 +02:00
Lars Ingebrigtsen
ef03c8852d Make describe-key do doc string command key substitution again
* lisp/help.el (describe-key): Do doc string command key
substitution (bug#56106).
2022-06-21 13:33:02 +02:00
Lars Ingebrigtsen
7934bad23b Fix fontification in describe-key
* lisp/help.el (describe-key): Use insert instead of princ so that
text properties on the key descriptions survive.
2022-06-21 13:25:19 +02:00
Stefan Kangas
4f3c1eb4c5 Respect no-face argument in literal key substitutions
* lisp/help.el (substitute-command-keys): Respect 'no-face' argument
also in literal key substitutions.
* test/lisp/help-tests.el
(help-tests-substitute-key-bindings/help-key-binding-face): Rename
from help-tests-substitute-key-bindings/face-help-key-binding.
(help-tests-substitute-key-bindings/help-key-binding-no-face): New test.
2022-06-18 19:56:07 +02:00
Lars Ingebrigtsen
f188b0185e Allow saying \\=`M-x ...' in a doc string
* lisp/help.el (substitute-command-keys): Allow saying \\=`M-x
foo' in doc strings (and have it be fontified as a key binding).
2022-06-13 17:02:55 +02:00
Lars Ingebrigtsen
a6b8bcad58 Further tweaks to how remapped commands are described
* lisp/help.el (describe-map): Rework how remapped commands are
output to avoid repetitions.

They're now shown as:

C-x 4 C-o	ido-display-buffer
  (Remapped via <remap> <display-buffer>)
C-x 5 C-o	ido-display-buffer-other-frame
  (Remapped via <remap> <display-buffer-other-frame>)
C-x x i		ido-insert-buffer
  (Remapped via <remap> <insert-buffer>)
2022-06-11 12:34:18 +02:00
Lars Ingebrigtsen
15a5c5ce40 Make describe-prefix-bindings say when there are no matches
* lisp/help.el (describe-prefix-bindings): Say when there are no
bindings under a prefix (bug#55875), for instance in `C-c C-h' in
a buffer with no `C-c' commands.
2022-06-10 11:39:51 +02:00
Lars Ingebrigtsen
f0cd91067d Improve `C-h b' output for remapped commands.
* lisp/help.el (describe-map): Include the bindings of the
remapped commands (bug#14084).

This will result in output like this, instead of just listing the
remapped commands:

<remap> <display-buffer>                ido-display-buffer
C-x 4 C-o                               display-buffer
<remap> <display-buffer-other-frame>    ido-display-buffer-other-frame
C-x 5 C-o                               display-buffer-other-frame
<remap> <insert-buffer>                 ido-insert-buffer
C-x x i                                 insert-buffer
<remap> <kill-buffer>                   ido-kill-buffer
C-x k                                   kill-buffer
<remap> <switch-to-buffer>              ido-switch-buffer
C-x b                                   switch-to-buffer
<remap> <switch-to-buffer-other-frame>  ido-switch-buffer-other-frame
C-x 5 b                                 switch-to-buffer-other-frame
<remap> <switch-to-buffer-other-window> ido-switch-buffer-other-window
C-x 4 b                                 switch-to-buffer-other-window
2022-06-09 16:41:03 +02:00
Lars Ingebrigtsen
d036891967 Fix the final divergent single quote usages in doc strings
* lisp/view.el (view-mode-map):
* lisp/repeat.el (repeat-is-really-this-command):
* lisp/help.el (substitute-command-keys):
* lisp/electric.el (electric-quote-mode):
* lisp/cedet/srecode/texi.el (srecode-texi-texify-docstring):
* lisp/cedet/semantic/sort.el
(semantic-orphaned-member-metaparent-type): Audit usages of single
quotes in doc strings.
2022-05-24 18:48:50 +02:00
Lars Ingebrigtsen
334fa0c91d Restore `with-help-window' return code
* lisp/help.el (help--window-setup): Return the correct thing.
2022-05-14 04:13:56 +02:00
Lars Ingebrigtsen
bd464297bd Don't overwrite variables set by callback in help--window-setup
* lisp/help.el (help--window-setup): Initialize the buffer in the
correct order to avoid resetting variables set by the callback.
2022-05-13 17:14:36 +02:00
Lars Ingebrigtsen
cd87a5c7a1 Don't clear out local variables in `with-help-window'
* lisp/help-mode.el (help-mode-setup): Declare obsolete.
(help-mode-finish): Ditto.

* lisp/help.el (with-help-window): Don't be a wrapper around
`with-temp-buffer-window', because that made the macro big and
difficult to understand.
(help--window-setup): Implement the relevant bits from
`with-temp-buffer-window'.  Also don't clear out local variables,
because that makes things like `text-scale-mode' not work (bug#25979).
2022-05-13 17:14:36 +02:00
Lars Ingebrigtsen
ebfec5c119 Allow substitute-command-keys to include menus in \{...} output
* doc/lispref/help.texi (Keys in Documentation): Document it.
* lisp/help.el (substitute-command-keys): Add an argument to
include menus in the \{...-map} output (bug#24236).
2022-05-13 15:54:16 +02:00
Stefan Kangas
2fba71cf1f Fix handling double-click-time nil or t
* lisp/mouse.el (mouse-double-click-time): New function to always
return a number for `double-click-time'.
* lisp/emulation/viper-mous.el (viper-multiclick-timeout):
* lisp/foldout.el (foldout-mouse-swallow-events):
* lisp/help.el (help--read-key-sequence):
* lisp/org/org-mouse.el (org-mouse-show-context-menu): Use
'mouse-double-click-time' instead of 'double-click-time'.
* src/keyboard.c (syms_of_keyboard): Mention
'mouse-double-click-time' in doc string of 'double-click-time'.
* test/lisp/mouse-tests.el (mouse-test-mouse-double-click-time):
New test.
2022-05-02 12:03:08 +02:00
Lars Ingebrigtsen
97badaab79 Allow reusing the *Help* window with i'/s/ commands
* doc/emacs/help.texi (Help): Document it.

* lisp/help-mode.el (help-function-def--button-function): Use it.
* lisp/help-mode.el (help-goto-info): Use it.

* lisp/help.el (help-window-select): Mention it.
(help-window-keep-selected): New user option (bug#9054).

* lisp/info-look.el (info-lookup-symbol):
(info-lookup): Allow keeping the same window.
2022-05-02 11:30:52 +02:00
Stefan Monnier
4dba7c31a2 Use advice--cd*r where applicable
* lisp/emacs-lisp/bytecomp.el (byte-compile--function-signature):
* lisp/emacs-lisp/advice.el (ad-get-orig-definition):
* lisp/help.el (help-function-arglist): Use `advice--cd*r`.
2022-04-26 17:36:13 -04:00
Lars Ingebrigtsen
d5f2305187 Clean up view-emacs-news code
* lisp/help.el (view-emacs-news): Remove workaround after fixing
mode: cookie error.
2022-04-18 11:53:59 +02:00
Lars Ingebrigtsen
b49cca7012 Make :filters run in the correct buffer in describe-buffer-bindings
* lisp/help.el (describe-map-tree): Take an optional buffer parameter.
(describe-map): Ditto, and use it to run `lookup-key' in the
correct buffer.  This fixes problems of filters being run in the
wrong buffer (bug#39149).

* src/keymap.c (Fdescribe_buffer_bindings): Pass in BUFFER to
describe-map-tree.
2022-04-17 18:06:26 +02:00
Lars Ingebrigtsen
1a339d6ba5 Don't leave `C-h N' in a text-mode derived mode
* lisp/help.el (view-emacs-news): Use emacs-news-view-mode.
* lisp/textmodes/emacs-news-mode.el (emacs-news-view-mode): Split
into own mode to avoid confusion.
2022-04-16 19:42:33 +02:00
Lars Ingebrigtsen
5a59059b24 Add a new mode for editing and viewing the Emacs NEWS file
* etc/NEWS (mode): Use emacs-news-mode.
* lisp/help.el (view-emacs-news): Use emacs-news-mode.

* lisp/textmodes/emacs-news-mode.el: New mode for editing and
viewing the Emacs NEWS file.
2022-04-16 15:42:10 +02: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
Lars Ingebrigtsen
55bcad776d Fix byte-code button in help--describe-command
* lisp/help.el (help--describe-command): Fix byte-code button
(bug#24235).
2022-03-15 12:44:50 +01:00
Stefan Kangas
1de7382b57 Merge from origin/emacs-28
e77fc8262a Update to Org 9.5.2-22-g33543d
9bce4b67f1 ; * lisp/help.el (with-help-window): Doc fix.  (Bug#54170)
558b03a958 Add explicit '--no-heading' for ripgrep
2022-02-28 06:33:06 +01:00
Eli Zaretskii
9bce4b67f1 ; * lisp/help.el (with-help-window): Doc fix. (Bug#54170) 2022-02-27 15:54:27 +02:00
Lars Ingebrigtsen
52af077d6a Improve the describe-key doc string
* lisp/help.el (describe-key): Say something about prefix keys
(bug#33320).
2022-02-02 20:16:04 +01:00
Sebastian Urban
1f5fa1de7f Make where-is correctly identify aliases
* lisp/help.el (where-is): Make aliases correctly say which
function is an alias for what (bug#37325).
2022-01-28 17:27:28 +01:00
Alan Mackenzie
57b698f159 Commit fixes and enhancements to the scratch/correct-warning-pos branch
No longer strip positions from symbols before each use of a form, instead
relying on the low level C routines to do the right thing.  Instead strip them
from miscellaneous places where this is needed.  Stip them alson in
`function-put'.

Push forms onto byte-compile-form-stack and pop them "by hand" rather than by
binding the variable at each pushing, so that it will still have its data
after an error has been thrown and caught by a condition case.  This gives an
source position to the ensuing error message.

* lisp/emacs-lisp/byte-run.el (byte-run--ssp-seen, byte-run--circular-list-p)
(byte-run--strip-s-p-1, byte-run-strip-symbol-positions): New functions and
variables, which together implement stripping of symbol positions.  The latest
(?final) version modifies the argument in place rather than making a copy.
(function-put): Strip symbol positions from all of the arguments before doing
the `put'.

* lisp/emacs-lisp/bytecomp.el (byte-compile--form-stack): has been renamed to
byte-compile-form-stack and moved to macroexp.el.
(byte-compile-initial-macro-environment (eval-and-compile)): Replace
macroexpand-all-toplevel with macroexpand--all-toplevel.
(displaying-byte-compile-warnings): bind byte-compile-form-stack here.
(byte-compile-toplevel-file-form, byte-compile-form): Push the top level form
onto byte-compile-form-stack (whereas formally the variable was bound at each
pushing).  Manually pop this from of the variable at the end of the function.

* lisp/emacs-lisp/cl-macs.el (cl-define-compiler-macro): Remove the symbol
stripping.

* lisp/emacs-lisp/comp.el (comp--native-compile): Set max-specpdl-size to at
least 5000 (previously it was 2500).  Bind print-symbols-bare to t.

* lisp/emacs-lisp/macroexp.el (byte-compile-form-stack): Definition move here
from bytecomp.el for easier compilation.
(byte-compile-strip-symbol-positions and associated functions): Removed.
(macro--expand-all): push argument FORM onto byte-compile-form-stack at the
start of this function, and pop it off at the end.
(internal-macroexpand-for-load): No longer strip symbol positions.  Bind
symbols-with-pos-enabled and print-symbols-bare to t.

* lisp/help.el (help--make-usage): Strip any position from argument ARG.

* src/fns.c (Fput): No longer strip symbol positions from any of the
arguments.
2022-01-14 19:06:04 +00: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
Stefan Kangas
6ecb24f877 Merge from origin/emacs-28
1821844357 Add missing K key documentation for Cangjie input methods
be860c1385 Fix manual entry of 'quit-restore-window' (Bug#52328)
35a96139df Clarify a comment in xdisp.c
6ba2f028cf Revert "Grep alias `all' shall not match parent directory"
eb9e33e238 ; * etc/NEWS: Non-nil repeat-keep-prefix is not the defaul...
538fc1d0e0 Fix mode-line display in Calendar mode

# Conflicts:
#	etc/NEWS
#	lisp/help.el
2021-12-09 14:53:51 +01:00
Eli Zaretskii
538fc1d0e0 Fix mode-line display in Calendar mode
* lisp/help.el (substitute-command-keys): New optional argument
NO-FACE, to avoid putting the 'help-key-binding' face on the key
bindings.
* lisp/calendar/calendar.el (calendar-mode-line-entry): Call
'substitute-command-keys' with the new optional argument non-nil.
(Bug#52366)

* doc/lispref/help.texi (Keys in Documentation): Document the new
optional argument of 'substitute-command-keys'.

* etc/NEWS: Announce the addition of a new argument to
'substitute-command-keys'.
2021-12-08 16:22:10 +02:00
Lars Ingebrigtsen
5404973916 Make help--describe-command more robust
* lisp/help.el (help--describe-command): `help-function' buttons
are defined in help-mode.el, so it might not exist yet when
calling `documentation' directly (bug#52291).
2021-12-05 02:58:06 +01:00
Stefan Kangas
48d1e6e9d9 Merge from origin/emacs-28
f38dfa56a0 ; Update loaddefs files.
b3d4b18507 ; make change-history-commit
334ff0232e * lisp/repeat.el: Use same logic for repeat-check-key and ...
8230a47ecc * lisp/help.el (help--analyze-key): Prefer posn-set-point ...

# Conflicts:
#	lisp/ldefs-boot.el
2021-12-02 17:34:10 +01:00
Juri Linkov
8230a47ecc * lisp/help.el (help--analyze-key): Prefer posn-set-point over mouse-set-point
* lisp/help.el (help--analyze-key): Use posn-set-point instead of
mouse-set-point that runs the hook mouse-leave-buffer-hook via
mouse-minibuffer-check.  Using posn-set-point also unnecessitates
extra conditions added in bug#51421.

* lisp/isearch.el (isearch-describe-key, isearch-describe-mode):
Add precautions to not call isearch-update when the executed
command exited isearch-mode (bug#51173).
2021-12-01 19:36:00 +02:00
Gregory Heytings
49422d2e69 Do not buttonize key bindings outside of *Help* buffers
* etc/NEWS: Mention the new variable.

* lisp/apropos.el (apropos-describe-plist): Bind the new
variable (bug#52053).
* lisp/button.el (button-describe): Bind the new variable.

* lisp/help-fns.el (describe-function, describe-variable)
(describe-face, describe-symbol, describe-syntax)
(describe-categories, describe-keymap, describe-mode)
(describe-widget): Bind the new variable.

* lisp/help-macro.el (make-help-screen): Bind the new variable.

* lisp/help.el (help-buffer-under-preparation): New variable
that is bound to t by commands that create a *Help* buffer.
(substitute-command-keys): Use the new variable:
help-link-key-to-documentation is supposed to have an effect
only "in *Help* buffers". Fixes bug#52053.
(view-lossage, describe-bindings, describe-key): Bind the new
variable.

* lisp/repeat.el (describe-repeat-maps): Bind the new variable.

* lisp/international/mule-cmds.el (describe-input-method)
(describe-language-environment): Bind the new variable.

* lisp/international/mule-diag.el (describe-character-set)
(describe-coding-system, describe-font, describe-fontset)
((list-fontsets): Bind the new variable.
2021-11-29 15:13:31 +01:00
Stefan Kangas
1aef1a6673 Add new format for literal key sequences to substitute-command-keys
* lisp/help.el (substitute-command-keys): Add new format "\\`f'" for
literal key sequences.  (Bug#50804)
* doc/lispref/help.texi (Keys in Documentation): Document the above
new substitution.

* test/lisp/help-tests.el
(help-tests-substitute-command-keys/literal-key-sequence):
(help-tests-substitute-command-keys/literal-key-sequence-errors): New
tests.
(help-tests-substitute-key-bindings/face-help-key-binding): Extend test.
2021-11-22 06:44:10 +01:00
Lars Ingebrigtsen
ce2f7335f1 Make the optional describe-map-tree parameters optional
* lisp/help.el (describe-map-tree): Make the optional parameters
optional.  This makes testing easier.
2021-11-18 08:11:26 +01:00
Stefan Kangas
0fbe543bc1 Use substitute-command-keys in some messages
* lisp/dired.el (dired-get-file-for-visit):
* lisp/doc-view.el (doc-view-buffer-message):
* lisp/help.el (help-window-setup):
* lisp/ibuf-ext.el (ibuffer-do-kill-lines):
* lisp/vc/ediff.el (ediff-documentation): Use 'substitute-command-keys'.
2021-11-17 14:29:15 +01:00
Lars Ingebrigtsen
f32280bfa6 Don't create links to undefined commands in help--describe-command
* lisp/help.el (help--describe-command): Don't create links to
commands that aren't defined.
2021-11-13 10:05:44 +01:00
Lars Ingebrigtsen
de06e05395 Make the lambda/closure buttons in `C-h b' say what they do
* lisp/button.el (buttonize): Add a help-echo property.

* lisp/help.el (help--describe-command): Say what the
lambda/closure buttons do.
2021-11-06 22:31:06 +01:00
Lars Ingebrigtsen
292f50d27b Make lambda/closure help buttons format as Emacs Lisp
* lisp/help.el (help--describe-command): Format lambda/closures as
Emacs Lisp.

* lisp/emacs-lisp/pp.el (pp-display-expression): Allow formatting
as Emacs Lisp.
2021-11-04 21:52:56 +01:00
Lars Ingebrigtsen
1c3e45396e Rename button-buttonize to buttonize
* lisp/help.el (help--describe-command):
* lisp/emacs-lisp/memory-report.el (memory-report--buffers):
* lisp/button.el (button-buttonize):
* doc/lispref/display.texi (Making Buttons): Rename
button-buttonize to just buttonize and adjust callers.
2021-11-04 18:14:29 +01:00
Lars Ingebrigtsen
093234f845 Revert overlay-related changes in `C-h b'
* lisp/help.el (describe-bindings): Revert overlay-related changes
-- these are already output (normally) by `describe-buffer-bindings'.
2021-11-02 17:34:47 +01:00
Lars Ingebrigtsen
cd73ec72a6 Make lambdas/closures/byte code in `C-h b' clickable
* lisp/help.el (help--describe-command): Add links for
lambdas/closures/byte code (bug#24235).

* lisp/emacs-lisp/pp.el (pp-display-expression): Autoload.
2021-11-02 16:20:19 +01:00