Commit graph

500 commits

Author SHA1 Message Date
Stefan Monnier
1faeef7924 (compiled-function-p): New function (bug#56648)
* lisp/subr.el (compiled-function-p): New function.

* test/lisp/international/ucs-normalize-tests.el (ucs-normalize-part1):
* lisp/gnus/gnus.el (gnus):
* lisp/mh-e/mh-e.el (mh-version):
* lisp/emacs-lisp/macroexp.el (emacs-startup-hook):
* lisp/emacs-lisp/cl-macs.el (compiled-function):
* lisp/emacs-lisp/bytecomp.el (byte-compile-fdefinition)
(byte-compile, display-call-tree):
* lisp/emacs-lisp/byte-opt.el (<toplevel-end>):
* lisp/emacs-lisp/advice.el (ad-compiled-p):
* lisp/cedet/semantic/bovine.el (semantic-bovinate-stream):
* lisp/loadup.el (macroexpand-all):
* admin/unidata/unidata-gen.el (unidata--ensure-compiled): Use it.

* lisp/emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
Add entries for it.
(pcase--split-pred): Use it.

* lisp/help-fns.el (help-fns-function-description-header): Use `functionp`.
(help-fns--var-safe-local): Use `compiled-function-p`.
2022-08-14 12:30:05 -04:00
Stefan Kangas
3d7d8ddc5a ; Fix typos 2022-08-08 14:23:29 +02:00
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
df508ffd2b Merge from origin/emacs-28
ae1ace1cf4 Adjust help-fns.el tests for recent change
04bdcf4aaa * src/terminal.c (Fframe_terminal): Use active voice
7fa491a9e9 Improve 'terminal-live-p' docstring some more
b9ac8c29ae Improve terminal-live-p docstring
0b4c81a152 * lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector): F...
8f8373170f * lisp/progmodes/cperl-mode.el: Don't mention obsolete arc...
25bc330a6d Make 'describe-function' say "byte-compiled" when appropriate
2b31e667be ;Improve documentation of locale-specific string comparison
2022-07-23 01:37:59 +02:00
Stefan Kangas
c8a586c1db Don't list obsolete in "other commands" help section
* lisp/help-fns.el (help-fns--list-local-commands): Don't list
obsolete commands.
2022-07-21 09:23:20 +02:00
Eli Zaretskii
25bc330a6d Make 'describe-function' say "byte-compiled" when appropriate
* lisp/help-fns.el (help-fns-function-description-header): Say
"byte-compiled" when describing byte-compiled functions.
2022-07-21 10:18:30 +03:00
Stefan Monnier
c32212bf96 (help-fns--first-release): Try and avoid false positives
We used to use a very "optimistic" regexp which worked well for
longish symbol names but suffered from too many false positives on
short names.  Use a more restrictive regexp, which should make the
recent "weed out" change unnecessary.

This in turn requires the use of '...' more consistently in etc/NEWS* files.

* lisp/help-fns.el (help-fns--first-release-regexp): New function.
(help-fns--first-release): Use it.  Fix minor issue with the Emacs
version regexp.
(help-fns--mention-first-release): Undo last change.

* etc/NEWS*: Replace `...' with '...'.  Indent code examples by at
least 2 spaces. Add previously missing '...' quotes around many of
the variables and functions described.
2022-07-18 22:22:34 -04:00
Lars Ingebrigtsen
9b5eb661bf Fix xref links in `C-h o'
* lisp/help-fns.el (describe-symbol): Make xref links happen in
all sections (bug#49587).

* lisp/help-fns.el (describe-symbol): Add back/forward links.

* lisp/help-mode.el (help-make-xrefs): Factor out links from
here...
(help-xref--navigation-buttons): To here.
2022-07-16 18:26:58 +02:00
Lars Ingebrigtsen
630bbe3932 Weed out some false positives in help-fns--mention-first-release
* lisp/help-fns.el (help-fns--mention-first-release): Weed out
things that give too many false positives (bug#49062).
2022-07-16 13:52:46 +02:00
Stefan Kangas
27c3a8b277 Remove some ineffectual calls to purecopy
* lisp/dired.el (dired-chown-program, dired-trivial-filenames):
* lisp/emacs-lisp/shortdoc.el (shortdoc--display-function):
* lisp/help-fns.el (help-fns--mention-shortdoc-groups):
* lisp/mail/mail-extr.el (mail-extr-full-name-prefixes)
(mail-extr-all-letters-but-separators, mail-extr-all-letters)
(mail-extr-first-letters, mail-extr-last-letters)
(mail-extr-bad-dot-pattern, mail-extr-full-name-suffix-pattern)
(mail-extr-alternative-address-pattern)
(mail-extr-trailing-comment-start-pattern)
(mail-extr-name-pattern, mail-extr-telephone-extension-pattern)
(mail-extr-ham-call-sign-pattern, mail-extr-normal-name-pattern)
(mail-extr-two-name-pattern)
(mail-extr-listserv-list-name-pattern)
(mail-extr-stupid-vms-date-stamp-pattern)
(mail-extr-hz-embedded-gb-encoded-chinese-pattern)
(mail-extr-x400-encoded-address-pattern)
(mail-extr-x400-encoded-address-field-pattern-format)
(mail-extr-x400-encoded-address-surname-pattern)
(mail-extr-x400-encoded-address-given-name-pattern)
(mail-extr-x400-encoded-address-full-name-pattern): Remove
ineffectual calls to purecopy.
2022-07-10 19:42:25 +02:00
Eli Zaretskii
a525c9f5c9 ; Fix doc strings in help-fns.el
* lisp/help-fns.el (help-fns-edit-mode-done)
(help-fns-edit-mode-cancel): Doc fixes.
2022-07-04 15:13:12 +03:00
Stefan Kangas
906b97edb9 New command help-fns-edit-mode-cancel
* lisp/help-fns.el (help-fns-edit-mode-cancel): New command.
(help-fns--edit-value-mode-map): Bind it to 'C-c C-k'.
(help-fns-edit-variable): Advertise it in help text.
2022-07-04 12:12:45 +02:00
Lars Ingebrigtsen
fb0d95984b Put the obsoletion earlier in the *Help* buffer
* lisp/help-fns.el (help-fns--obsolete): Remove indentation and fill.
(help-fns--var-obsolete): Ditto.
(describe-function-1): Output the obsoletion info first since it's
vital information.
(describe-variable): Ditto (bug#56251).
2022-06-28 15:22:13 +02:00
Lars Ingebrigtsen
19c44e2be3 Font-lock variable values in *Help*
* lisp/help-fns.el (describe-variable): Font-lock the variable
value (bug#47363).
2022-06-26 21:43:05 +02:00
Lars Ingebrigtsen
ac39c327b5 Tweak quoting in help-fns--compiler-macro
* lisp/help-fns.el (help-fns--compiler-macro): Fix quotes in help
text.
2022-06-20 02:12:06 +02:00
Lars Ingebrigtsen
0edc2f4901 Fix some declare-after-interactive functions
* lisp/progmodes/opascal.el (opascal-new-comment-line):
* lisp/image-mode.el (image-transform-fit-to-height):
* lisp/help-fns.el (help-fns-edit-variable):
* lisp/gnus/gnus-salt.el (gnus-pick-start-reading):
* lisp/eshell/esh-util.el (eshell-for):
* lisp/ldefs-boot.el (view-return-to-alist-update): Fix warnings
about declare after interactive.
2022-06-17 18:19:02 +02:00
Stefan Kangas
250f9e7f83 Improve help-enable-variable-value-editing help
* lisp/help-fns.el (help-enable-variable-value-editing): Expand
docstring to better explain what effect it has.
(help-fns-edit-variable): Use command substitution.
2022-06-17 16:30:51 +02:00
Lars Ingebrigtsen
488a4cd61b Allow editing all symbols in help-fns--editable-variable
* lisp/help-fns.el (help-fns--editable-variable): Allow editing
all symbols (bug#56038).
2022-06-17 16:30:16 +02:00
Lars Ingebrigtsen
fbc0cc0e9f Re-re-fix previous describe-function change
* lisp/help-fns.el (describe-function): Put back binding removed
by mistake in previous change.
2022-06-05 22:52:59 +02:00
Lars Ingebrigtsen
46822e9c5e Fix key binding buffer issue in describe-function better
* lisp/help-fns.el (describe-function): Revert previous change here.
(describe-function-1): Just use describe-function-orig-buffer
instead of the key-buffer binding -- this will also make the
rendering results correct when hitting `g' and `l'.
2022-06-05 22:48:28 +02:00
Lars Ingebrigtsen
3f388d7929 Make `C-h f' look up key bindings in the current buffer again
* lisp/help-fns.el (describe-function): Pass in the correct buffer
to look up key bindings in.
(describe-function-1): Use it.
2022-06-05 21:48:21 +02:00
Po Lu
d63d633a68 Handle invalid NEWS files during describe-function
* src/help-fns.el (help-fns--first-release): Don't error if
searching for a heading fails.
2022-05-24 21:01:24 +08:00
Lars Ingebrigtsen
ed34cbeae7 Audit symbol quoting in Lisp doc strings
* lisp/vc/vc-svn.el (vc-svn-dir-status-files):
* lisp/so-long.el (so-long-mode-maintain-preserved-variables):
* lisp/help-fns.el (help-fns--most-relevant-active-keymap):
* lisp/gnus/nnselect.el (nnselect-get-artlist):
(nnselect-store-artlist):
* lisp/forms.el (forms-enumerate):
* lisp/ffap.el (ffap-string-at-point):
* lisp/emacs-lisp/byte-run.el (define-obsolete-variable-alias):
Audit symbol quoting in Lisp doc strings.
2022-05-24 12:36:51 +02:00
Visuwesh
9ac40fb980 describe-keymap: Suggest symbol at point
* lisp/help-fns.el (describe-keymap): Suggest symbol at point
if it is a keymap.  (Bug#55393)
* etc/NEWS: Announce change in behavior of 'describe-keymap'.
2022-05-15 08:23:05 +03:00
Lars Ingebrigtsen
949180b8ab Put help-fns--compiler-macro last in the *Help* buffer
* lisp/help-fns.el (help-fns-describe-function-functions): Make
help-fns--compiler-macro the last entry (because it's not the most
interesting information).
2022-05-14 04:59:24 +02:00
Lars Ingebrigtsen
5f7dd959c2 Improve the *Help* output for compiler macros and the like
* doc/lispref/functions.texi (Advice and Byte Code): New node.

* lisp/help-fns.el (help-fns--compiler-macro): Also output data on
other byte compilation things, and link to the manual (bug#23264).
2022-05-14 04:13:56 +02:00
Lars Ingebrigtsen
1cda7cfb39 Respect help-window-keep-selected in shortdoc buttons
* lisp/help-fns.el (help-fns--mention-shortdoc-groups): Respect
help-window-keep-selected.

* lisp/emacs-lisp/shortdoc.el (shortdoc-display-group): Allow
reusing the window.
2022-05-06 16:21:07 +02:00
Lars Ingebrigtsen
c7d49f91da Fix another help-fns--insert-menu-bindings parsing problem
* lisp/help-fns.el (help-fns--insert-menu-bindings): Fix keymap
traversal when elements are symbols.
2022-04-28 12:16:35 +02:00
Juri Linkov
1e0c4883b7 * lisp/help-fns.el (help-fns--insert-menu-bindings): Don't highlight heading. 2022-04-27 10:36:41 +03:00
Lars Ingebrigtsen
dd5ca0eaf2 Make new menu *Help* output be more resilient
* lisp/help-fns.el (help-fns--insert-menu-bindings): Only insert
the heading if it turns out that we actually find the menu.
(help-fns--insert-bindings): Tweak calling convention.
2022-04-26 13:23:51 +02:00
Lars Ingebrigtsen
fd1ca094bc Change the display of menu bindings in *Help*
* lisp/help-fns.el (help-fns--insert-menu-bindings): New function
to describe menu entries more fully (bug#52870).
(help-fns--key-bindings): Use it.
2022-04-25 21:14:33 +02:00
Lars Ingebrigtsen
07f8fafe6b Further help-fns--editable-variable fixes
* lisp/help-fns.el (help-fns--editable-variable): Don't bug out on
non-symbols.
2022-04-24 16:03:12 +02:00
Po Lu
e2d870016c Allow looking up window system colors on Haiku
* lisp/help-fns.el (help-fns--editable-variable): Fix describing
variables which don't have symbol values.
* lisp/term/haiku-win.el (haiku-allowed-ui-colors): Set list of
allowed UI colors.
* src/haiku_support.cc (be_get_ui_color): New function.
* src/haiku_support.h: Update prototypes.
* src/haikufns.c (haiku_get_color): Look for defined UI color.
(syms_of_haikufns): New defvar `haiku-allowed-ui-colors'.
* src/haikuterm.c (haiku_term_init): Fix coding style.
2022-04-24 05:37:22 +00:00
Lars Ingebrigtsen
655b39bd4b Don't have help-fns--editable-variable override link buttons
* lisp/help-fns.el (help-fns--editable-variable): Don't override
link buttons (bug#40774).
2022-04-23 17:01:55 +02:00
Lars Ingebrigtsen
01282cbd80 Allow editing variable values in *Help* buffers
* lisp/help-fns.el (help-enable-variable-value-editing): New user
option.
(describe-variable): Tag values for editing.
(help-fns--editable-variable, help-fns-edit-variable): New
functions (bug#36826).
(help-fns--edit-value-mode-map, help-fns--edit-value-mode)
(help-fns-edit-mode-done): New mode and commands.
2022-04-17 18:59:59 +02:00
Lars Ingebrigtsen
2ea3e7b246 Fix describe-mode--minor-modes formatting issue
* lisp/help-fns.el (describe-mode--minor-modes): Fix multi-line
local-minor paragraph.
2022-04-14 03:08:32 +02:00
Lars Ingebrigtsen
864c8013fd Make `C-h m' actually output the documentation for the major mode
* lisp/help-fns.el (describe-mode): Get the documentation for the
correct major mode.
2022-04-13 23:30:55 +02:00
Lars Ingebrigtsen
3c059f269e Redo `C-h m' output
* lisp/help-fns.el (describe-mode--minor-modes): New function
(bug#2473).
(describe-mode): Rewritten to include local minor mode links first,
then the major mode, and then global minor mode links, and then
all the minor modes.
2022-04-13 03:50:55 +02:00
Lars Ingebrigtsen
6b16092a8d Make `describe-mode' include a link to the major mode function
* lisp/help-fns.el (describe-mode): Add a link to the mode
function so that the user can go to the manual more easily
(bug#575).
2022-04-13 03:50:55 +02:00
Lars Ingebrigtsen
f788bb33e5 Extend find-lisp-object-file-name
* lisp/help-fns.el (find-lisp-object-file-name): Add optional
parameter to always look in the DOC file (bug#17685).
2022-02-08 11:10:03 +01:00
Lars Ingebrigtsen
d97e9d701d Fix some standard-output/help-buffer confusion in describe-function-1
* lisp/help-fns.el (describe-function-1): We're outputting to
standard-output, so deconfuse slightly.
2022-02-08 08:24:30 +01:00
Lars Ingebrigtsen
d18764000f Fix describe-function-1 test failure from previous change
* lisp/help-fns.el (describe-function-1): Fix test failure from
previous patch.
2022-02-08 08:15:08 +01:00
Lars Ingebrigtsen
95a021fe5f Minor fix to how describe-function-1 displays symbols with spaces
* lisp/help-fns.el (describe-function-1): Ensure that symbols like
`bar\ ' aren't rendered incorrectly (bug#23130).
2022-02-08 08:02:52 +01:00
Stefan Monnier
1d1b664fbb (function-history): New symbol property (bug#53632)
Rework the code we have in Fdefalias that tries to keep track
of definitions so as to be able to undo them later.

We used to store in `load-history` when an autoload is redefined as
a non-autoload and in the `autoload` symbol property we used to store
the autoload data that used to be used before it got overriden.

Instead, store the history of the function definition of
a symbol in its `function-history` symbol property.
To make this list cheap in the default case, the latest value is not stored
in the list (since it's in the `symbol-function`) and neither is the first
file.  So if there's only been a single definition (the most common case),
the list is empty and the property is just not present at all.

The patch also gets rid of the `autoload` vs `defun` distinction in
`load-history` which seems unnecessary (a significant part of the
motivation for this patch was to get rid of the special handling of
autoloads in this part of the code).

* src/data.c (add_to_function_history): New function.
(defalias): Use it.  Don't add the `t` entries for autoloads and always
use `defun` regardless of the kind of definition.
Change `Vautoload_queue` to only hold the function
symbols since the rest is now available from `function-history`.
* src/eval.c (un_autoload): Adjust accordingly.

* src/lread.c (load-history): Udate docstring.

* lisp/loadhist.el (loadhist-unload-filename): New var.
(unload-feature): Bind it.
(loadhist-unload-element): Document its availability.
(loadhist--restore-autoload): Delete var.
(loadhist--unload-function): Delete function.
(loadhist-unload-element): Delete the `t` and `autoload` methods.
Rewrite the `defun` method using `function-history`.

* lisp/help-fns.el: Require `seq`.
(help-fns--autoloaded-p): Rewrite.
(help-fns-function-description-header): Adjust call accordingly.

* doc/lispref/loading.texi (Where Defined): Remove `autoload` and `t`
entries from `load-history` since we don't generate them any more.
Document the `function-history` which replaces the `autoload` property.
(Unloading): Adjust symbol property name accordingly.

* test/lisp/loadhist-resources/loadhist--bar.el:
* test/lisp/loadhist-resources/loadhist--foo.el: New files.
* test/lisp/loadhist-tests.el (loadhist-tests-unload-feature-nested)
(loadhist-tests-unload-feature-notnested): New tests.
2022-01-31 11:07:26 -05:00
Po Lu
ec5c723844 Fix error when describing menu items that don't have equivalent keys
* lisp/help-fns.el (help-fns--key-bindings): Never pass nil to
insert.
2022-01-20 20:18:29 +08:00
Lars Ingebrigtsen
689e64cefe Improve how menus are described in *Help*
* lisp/help-fns.el (help-fns--insert-bindings): New function.
(help-fns--key-bindings): Split menu/key handling and output menu
bindings separately (bug#52870).
2022-01-20 12:04:27 +01:00
Lars Ingebrigtsen
d30fde6b0c Avoid infloops in help-fns--analyze-function with aliases
* lisp/help-fns.el (help-fns--analyze-function): Use
function-alias-p to avoid infloops.
2022-01-13 09:49:19 +01: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