Compare commits

..

454 commits

Author SHA1 Message Date
Andreas Schwab
d5ab8b6f24 ; Fix last change 2023-05-06 22:27:55 +02:00
Andreas Schwab
ab5258b192 Simplify check for non-empty list
* lisp/gnus/nntp.el (nntp-with-open-group): Simplify check for
non-empty list.
2023-05-06 22:17:45 +02:00
Po Lu
31a66dc891 Fix portability problem in lisp/Makefile.in
* lisp/Makefile.in (check-defun-dups): Avoid POSIX command
substitutions.
2023-05-06 20:43:22 +08:00
Po Lu
a5d142e830 Fix portability problem in toplevel Makefile
* Makefile.in (sanity-check, preferred-branch-is-current): Avoid
POSIX command substitution, to make Makefile work with the SVR4
shell.
2023-05-06 20:42:22 +08:00
Eli Zaretskii
9b66a64d9c Fix interactive forms in some Lisp packages
* lisp/woman.el (woman-reset-emulation):
* lisp/treesit.el (treesit--explorer-jump):
* lisp/speedbar.el (speedbar-toggle-etags):
* lisp/filesets.el (filesets-convert-patterns):
* lisp/calculator.el (calculator-saved-move):
* lisp/progmodes/gud.el (gud-basic-call):
* lisp/progmodes/ebrowse.el (ebrowse-redraw-marks)
(ebrowse-view-file-other-frame):
* lisp/progmodes/dcl-mode.el (dcl-indent-to):
* lisp/net/socks.el (socks-open-connection):
* lisp/net/ntlm.el (ntlm-build-auth-request):
* lisp/emacs-lisp/backtrace.el (backtrace-expand-ellipsis):
* lisp/calc/calc-prog.el (calc-edit-macro-finish-edit):
* lisp/calc/calc-misc.el (calc-info-goto-node):
* lisp/net/dictionary.el (dictionary-new-search)
(dictionary-definition, dictionary-switch-tooltip-mode): Fix
interactive functions where the 'interactive' form did not supply
the mandatory arguments.  (Bug#62864)
2023-05-06 11:29:58 +03:00
Andrew G Cohen
f261226d9b Allow X-Message-SMTP-Method to include more MTAs
* lisp/gnus/message.el (message-multi-smtp-send-mail): Allow the
X-Message-SMTP-Method header to override the default mailer with not
only smtp and sendmail but other MTAs as well.
* doc/misc/message.texi: Document changes to the usage of
X-Message-SMTP-Method.
2023-05-06 09:05:28 +08:00
Dmitry Gutov
8d1332d135 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs 2023-05-06 03:59:59 +03:00
Dmitry Gutov
53cc61d60d package-upgrade: Implement the upgrading of built-ins
* lisp/emacs-lisp/package.el (package--upgradeable-packages):
Add new argument.  When INCLUDE-BUILTINS is non-nil, also search
among package--builtins (bug#62720).
(package-upgrade): Use the new argument.  Bind
package-install-upgrade-built-in when necessary.  Mark the package
as selected if it was previously an "active built-in".
(package-upgrade-all): Update the docstring.
2023-05-06 03:58:49 +03:00
Dmitry Gutov
0c6311386a Merge from origin/emacs-29
79a886ba36 (package-upgrade): Don't remove the package from 'package...
c0ab4e9ca9 Eglot: re-rename eglot-upgrade to eglot-upgrade-eglot
b4e90070f9 Fix arguments of xml.c functions as displayed in Help buf...
b1bda8228e More fixes for NetBSD/vax
a2d4cd06f4 Improve VHDL mode highlighting
2f3a514b6d Clarify documentation wrt floating point division by zero...
94e984e670 Make loaddefs-generate slightly more tolerant
aba41d2c4b ; Minor doc cleanups in go-ts-mode.el
b42ccb2e5c ; Minor grammar fix in treesit manual.
ab44c8a6f9 Fix order of rcirc-connect arguments
8eb6e33691 Fix rcirc messages printing in the wrong place
2901a3443c Prevent unnecessary modifications of 'package-vc-selected...
eaad302bd6 Rename eglot-update to eglot-upgrade
eaf25b9c6a go-ts-mode: Use iota query only if supported (Bug#63086)
cc090294d7 (rng-complete-tag): Add the (ignored) argument to the :co...
21ec6c1d5c Update to Transient v0.3.7-219-g3ded15b
8d5aa8df4a Fix inserting selection data into Mozilla programs
57562c3fd0 Recognize defstruct slot names in various eieio functions
b93eb68cc3 Use 'calendar-buffer' instead of fixed string

# Conflicts:
#	etc/EGLOT-NEWS
2023-05-06 03:41:54 +03:00
Dmitry Gutov
3baab6c432 ; Merge from origin/emacs-29
The following commit was skipped:

e338a8ac41 Handle point not at EOB in minibuffer-choose-completion
2023-05-06 03:36:29 +03:00
Dmitry Gutov
47c424f5ec Merge from origin/emacs-29
fceaf230b0 Note that Emacs pauses when handling sentinel errors
2023-05-06 03:36:29 +03:00
Dmitry Gutov
79a886ba36 (package-upgrade): Don't remove the package from 'package-selected-packages'
* lisp/emacs-lisp/package.el (package-upgrade):
Don't remove the package from 'package-selected-packages', fixing
the problem described in https://debbugs.gnu.org/62720#718.
2023-05-06 03:32:27 +03:00
F. Jason Park
ba44b48184 Add interface for finding users in erc-server-PRIVMSG
* lisp/erc/erc-backend.el (erc-server-PRIVMSG): Call new hook
`erc--user-from-nick-function' for turning the sender's nick into a
channel user, if any.
* lisp/erc/erc-button.el (erc-button--add-phantom-speaker): Redo
completely using simplified API.
(erc-button--fallback-user-function): Add internal function-interface
variable for finding an `erc-server-user' object when the usual places
disappoint.
(erc-button--get-phantom-user): Add new function, a getter for
`erc-button--phantom-users'.
(erc-button--phantom-users-mode): Replace advice subscription for
`erc-button--modify-nick-function' with one for
`erc-button--user-from-nick-function' and one for
`erc-button--fallback-user-function'.
(erc-button--get-user-from-speaker-naive): Remove unused function.
(erc-button--add-nickname-buttons): Call
`erc-button--fallback-user-function' when a user can't be found in
`erc-server-users' or `erc-channel-users'.
* lisp/erc/erc.el (erc--user-from-nick-function): New
function-interface variable for determining an `erc-server-user'
`erc-channel-user' pair from the sender's nick.
(erc--examine-nick): Add new function to serve as default value for
`erc--user-from-nick-function'.  (Bug#60933)
2023-05-05 17:18:01 -07:00
F. Jason Park
d141f7149b Improve erc-button--modify-nick-function interface
* lisp/erc/erc-button.el (erc-button--check-nicknames-entry): Remove
unused let binding.
(erc-button--preserve-bounds): Remove unused function.
(erc-button--nick): New struct type to serve as collection plate for
`erc-button--modify-nick-function' consumers.
(erc-button--modify-nick-function): Reexplain interface, now based on
`erc-button--nick' object.  Change default value to `identity'.
(erc-button--add-phantom-speaker): Redo to expect `erc-button--nick'
object.
(erc-button-add-nickname-buttons): Rework slightly to construct an
`erc-button--nick' object for feeding to
`erc-button--modify-nick-function'.  Only run the latter when an
`erc-server-user' has successfully been found.  (Bug#60933)
2023-05-05 17:18:01 -07:00
F. Jason Park
5adda2f468 Revise FORM-as-function interface in erc-button-alist
* lisp/erc/erc-button.el (erc-button-alist): Remove redundant "<URL:
foo>" entry, which adds nothing beyond highlighting the surrounding
bookends at the expense of doubling up on face properties for no
reason.  Revise the FORM-as-function interface by removing the dynamic
binding of face options and treating all implementers as replacements
for `erc-button-add-button'.
(erc-button--maybe-warn-arbitrary-sexp): Make more robust by having it
handle all accepted FORM types other than booleans.
(erc-button-add-buttons-1): Rework to only check FORM field once.
(erc-button--substitute-command-keys-in-region,
erc-button--display-error-with-buttons): Rename former as latter and
change signature to conform to new `erc-button-add-buttons' interface.
(erc-button--display-error-notice-with-keys): Call renamed helper.
* test/lisp/erc/erc-button-tests.el (erc-button-alist--url,
erc-button-tests--form, erc-button-tests--some-var,
erc-button-tests--erc-button-alist--function-as-form,
erc-button-alist--function-as-form,
erc-button-tests--erc-button-alist--nil-form,
erc-button-alist---nil-form): Add tests and helpers.  (Bug#60933)
2023-05-05 17:18:01 -07:00
F. Jason Park
35dd1ade7f Preprocess prompt input linewise in ERC
* etc/ERC-NEWS: Mention revised role of `erc-pre-send-functions'
relative to line splitting.
* lisp/erc/erc-common.el (erc-input): Add new slot `refoldp' to allow
`erc-pre-send-functions' members to indicate that splitting should
occur a second time after all members have had their say.
(erc--input-split): Specify some defaults for overridden slots and
explicitly declare some types for good measure.
* lisp/erc/erc-goodies.el (erc-noncommands-mode,
erc-noncommands-enable, erc-noncommands-disable): Replace
`erc-pre-send-functions' with `erc--input-review-functions'.
* lisp/erc/erc-ring.el (erc-ring-enable, erc-ring-disable,
erc-ring-mode): Subscribe to `erc--input-review-functions' instead of
`erc-pre-send-functions' for `erc--add-to-input-ring'.
* lisp/erc/erc.el (erc-pre-send-functions): Note some nuances
regarding line splitting in doc string and note that a new slot is
available.
(erc--pre-send-split-functions, erc--input-review-functions): Rename
former to latter, while also obsoleting.  Remove large comment.  Add
new default member `erc--run-input-validation-checks'.
(erc-send-modify-hook): Replace the obsolete `erc-send-pre-hook' and
`erc-send-this' with `erc-pre-send-functions' in doc string.
(erc--check-prompt-input-for-excess-lines): Don't trim trailing
blanks.  Rework to also report overages in characters as well as
lines.
(erc--run-input-validation-hooks): New function to adapt an
`erc--input-split' object to `erc--check-prompt-input-functions'.
(erc-send-current-line): Run `erc--input-review-functions' in place of
the validation hooks they've subsumed.  Call `erc--send-input-lines'
instead of the now retired but not deprecated `erc-send-input'.
(erc--run-send-hooks, erc--send-input-lines): New functions that
together form an alternate version of `erc-send-input'.  They operate
on input linewise but make accommodations for older interfaces.
* test/lisp/erc/erc-tests.el (erc-ring-previous-command): Replace
`erc-pre-send-functions' with `erc--input-review-functions'.
(erc-tests--with-process-input-spy): Shadow
`erc--input-review-functions'.
(erc-check-prompt-input-for-excess-lines): Don't expect trailing
blanks to be trimmed.
(erc--run-send-hooks): New test.  (Bug#62947)
2023-05-05 17:18:01 -07:00
F. Jason Park
3a5a6fce95 Redo line splitting for outgoing messages in ERC
* lisp/erc/erc-backend.el (erc--reject-unbreakable-lines): New
variable, an escape hatch for somewhat regaining pre-5.6
line-splitting behavior.
(erc--split-line): New utility function that doesn't rely on
column-oriented filling.
* lisp/erc/erc.el (erc--pre-send-split-functions): Append
`erc--split-lines' to value.
(erc--split-lines): New function to re-split current selection of
lines.
(erc-send-input): Hard-code line preparation instead of calling
`erc--pre-send-split-functions', in order to bake in traditional
behavior before move to "pre-splitting".
* test/lisp/erc/erc-scenarios-base-split-line.el: New file.
* test/lisp/erc/erc-tests.el (erc--split-line): New test.
(erc-send-current-line): Don't expect a flood argument when
interpreting a command because it's not passed along to the command's
handler.  This was previously misleading because it assigned undue
significance to something that had no bearing on the fate of a
command.
* test/lisp/erc/resources/base/flood/ascii.eld: New file.
* test/lisp/erc/resources/base/flood/koi8-r.eld: New file.
* test/lisp/erc/resources/base/flood/utf-8.eld: New file.
* test/lisp/erc/resources/erc-d/erc-d.el: Don't decode input.
(Bug#62947)
2023-05-05 17:18:01 -07:00
F. Jason Park
1630656770 Don't send multiline commands as messages in ERC
* lisp/erc/erc.el (erc-command-regexp): Relocate from further down in
same file.
(erc--check-prompt-input-for-multiline-command): Reject slash commands
containing multiple lines during input validation and before running
additional hooks.
(erc--discard-trailing-multiline-nulls): Don't mark input that begins
with a possible "slash command" as constituting a plain message just
because it has a trailing newline.  It's relatively easy to add a
newline by accident, which can result in the unintended sharing of a
command line.  Also, ERC already has a /SAY command that allows a user
to send a message starting a literal command.
* test/lisp/erc/erc-tests.el (erc-send-whitespace-lines): Fix test to
expect validation error when non-blank lines follow a slash command.
(Bug#62947)
2023-05-05 17:18:01 -07:00
F. Jason Park
b0d761be0f Restore module var toggles in ERC's Custom buffers
* lisp/erc/erc-common.el (erc--neuter-custom-variable-state): Remove
function.  ERC famously toggles global minor-mode vars during normal
operations, which adds noise to its customization buffers because
`customize-variable-state' always sees an activated module's mode
variable as having "CHANGED".  To suppress this annoyance, a
workaround was employed that used a dishonest `:get' function to
simply return the "saved value," when present.  While this improved
the Customize experience, it also misled users, which likely wasn't
justified.
(erc--make-show-me-widget): Add helper to avoid forward declarations.
(erc--prepare-custom-module-type): Don't deprive users of a working
minor-mode toggle.
(erc--find-feature): New function to guess the feature of a module's
containing library.
(define-erc-module): Remove `:get' keyword.  Specify `:require'
instead, whose value may be nil.  Users who currently have mode vars
in their `custom-file' won't be impacted by this addition because
those `custom-set-variables' entries will still lack a REQUEST list
and hence won't incur a startup penalty.  And new users intent on
using the toggle will hopefully do so with the knowledge they're
opting in to requiring ERC on startup, which is not the case if they
follow the recommended practice of using `erc-modules' instead.
(erc-with-server-buffer): Inline `erc-server-buffer'.
* test/lisp/erc/erc-tests.el (erc-process-input-line): Use helper.
(define-erc-module--global): Change expected expansion.  (Bug#60935)
2023-05-05 17:18:01 -07:00
F. Jason Park
2e18ba6302 Simplify erc-button movement commands
* etc/ERC-NEWS: Mention TAB being bound to new command `erc-tab' and
`erc-previous-button' now stopping at the start of buttons.
* lisp/erc/erc-button.el (erc-button-mode, erc-button-enable,
erc-button-disable): Add and remove `erc-button-next' to
`erc--tab-functions' hook, which is tantamount to binding the command
in the read-only area of an ERC buffer.
(erc-button-next-function): Deprecate and remove from client code path
because this module doesn't concern itself with prompt input and thus
no longer needs to conform to the `completion-at-point-functions'
interface.
(erc-button--prev-next-predicate-functions): New variable, a hook to
determine whether to continue searching for a button.  Other modules
should utilize this as needed.
(erc-button--end-of-button-p): Add function to serve as default value
for `erc-button--continue-predicate'.
(erc--button-next): Add generalized button-movement function.
(erc-button-next, erc-button-previous): Make `erc-button-previous'
behave more predictably by having it land at the beginning of buttons.
And remove roundabout appeal to HOF in `erc-button-next'.
(erc-button-previous-of-nick): New command to jump to previous
appearance of nick at point.
* lisp/erc/erc-fill.el (erc-fill-wrap, erc-fill-wrap-enable,
erc-fill-wrap-disable): Add and remove merge-related hookee from
`erc-button--prev-next-predicate-functions'.
(erc-fill--wrap-merged-button-p): New function to detect redundant
speakers.
* lisp/erc/erc.el (erc-complete-functions): Quote TAB in doc string.
(erc-mode-map): Bind `erc-tab' to TAB.
(erc--tab-functions, erc-tab): Add new command and hook to serve as
unified dispatch for TAB-related operations.  It calls `c-a-p' in the
input area and defers to module code in the read-only message area.
* test/lisp/erc/erc-button-tests.el: New file.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--wrap-populate): Run
finalizer for transient keymap timer.
* test/lisp/erc/erc-tests.el
(erc-button--display-error-notice-with-keys): Move to new dedicated
test file for erc-button and fix expected behavior of
`erc-button-previous'.  (Bug#62834)
2023-05-05 17:18:01 -07:00
F. Jason Park
2641dfd4b4 Add erc-timestamp property to invisible messages
* lisp/erc/erc-fill.el (erc-fill--wrap-beginning-of-line): Pretend
nicks with an empty string as a `display' prop are `invisible-p' and
break out of hidden "merged" nicks after moving.  (Bug#60936.)
* lisp/erc/erc-match.el (erc-hide-fools): Add comment.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Always add
`erc-timestamp' and `cursor-sensor-functions' properties but respect
tradition and don't actually stamp any invisible messages.
2023-05-05 17:18:01 -07:00
F. Jason Park
90a9c7b7b5 Actually define erc-default-server-functions
* lisp/erc/erc-backend.el: Remove top-level `add-hook' for
`erc-default-server-functions'.
* lisp/erc/erc.el (erc-default-server-hook,
erc-default-server-functions): Officially deprecate the former and
rename it to the latter.
(erc-default-server-handler): Mark obsolete because its replacement
took over years ago.
(erc-debug-missing-hooks): Append instead of mutate.
2023-05-05 17:18:01 -07:00
F. Jason Park
9e1a5a389e Ignore erc-reconnect-display after a timeout
* lisp/erc/erc-backend.el (erc--server-reconnect-display-timer): New
variable to store active timer that, upon firing, zeroes out
`erc--server-last-reconnect-count'.
(erc--server-last-reconnect-on-disconnect): New function to run on
`erc-disconnected-hook'.
(erc--server-last-reconnect-display-reset): New function to ensure the
reconnect-display period ends.
* lisp/erc/erc.el (erc-reconnect-display-timeout): New option to
control how long `erc-reconnect-display' affects the displaying of new
buffers following an automatic reconnection.
(erc-process-input-line): Ensure user input marks the end of the
reconnect-display period.
(erc-cmd-JOIN): Don't bother resetting
`erc--server-last-reconnect-count' because it's now handled by its
sometime caller, `erc-process-input-line'.
(erc-connection-established): Schedule timer and register hook to
reset last-reconnect count and terminate the reconnect-display period.
* test/lisp/erc/erc-scenarios-base-buffer-display.el:
(erc-scenarios-base-buffer-display--reconnect-common): Add new args to
test fixture to allow for asserting display properties at various
stages throughout a session.
(erc-scenarios-base-reconnect-options--buffer,
erc-scenarios-base-buffer-display--defwin-recbury-intbuf): Rename
former to latter and rework to better reflect realistic settings
for the relevant display options.
(erc-scenarios-base-reconnect-options--default,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf): Rename
former to latter and rework to be more realistic.
(erc-scenarios-base-buffer-display--count-reset-timeout): New
test for new option `erc-reconnect-display-timeout'.  (Bug#62833)
2023-05-05 17:18:01 -07:00
F. Jason Park
5de90fa961 Extend erc-interactive-display to cover /JOINs
* lisp/erc/erc.el (erc-display): Mention that buffer-related display
options live in the customization group `erc-buffers'.
(erc-buffer-display, erc-join-buffer): Swap alias and aliased so that
the favored name, `erc-buffer-display', appears in the definition and
in the Customize menu.  Also note related buffer-display options in
the doc string.
(erc-query-display, erc-interactive-display): Make the former an alias
of the latter, new in ERC 5.6, because their roles were functionally
redundant and thus confusing.  Inherit the default value from
`erc-query-display' because users are more familiar with the pop-up
window behavior than a single-window replacement.
(erc-reconnect-display): Use preferred name for cross-referencing
fallback option `erc-buffer-display' in doc string, and explain how
/reconnect handling differs.
(erc--setup-buffer-hook): Add new internal hook for modules that
operate on windows and frames, such as erc-speedbar and
erc-status-sidebar.
(erc-open): Run `erc--setup-buffer-hook' after `erc-setup-buffer' so
hook members know their code isn't tied to `erc-setup-buffer' itself,
which may be used in other contexts, but rather to a new ERC buffer on
which some display-related action has just been performed.
(erc--called-as-input-p): New variable for "slash" commands, like
`erc-cmd-FOO', to detect whether they're being called "interactively"
as a result of input given at ERC's prompt.
(erc-process-input-line): Bind `erc--called-as-input-p' when running
slash commands.
(erc-cmd-JOIN): When called interactively, schedule a callback to wrap
the response handler and control how new buffers are thus displayed.
(erc-cmd-QUERY): Use preferred alias for `erc-query-display'.
* test/lisp/erc/erc-scenarios-base-buffer-display.el:
(erc-scenarios-base-buffer-display--interactive-default): New test.
* test/lisp/erc/erc-tests.el (erc-process-input-line,
erc-select-read-args, erc-tls, erc--interactive): Change expected
default value of `erc-interactive-display' from `buffer' to
`window'.  (Bug#62833)
2023-05-05 17:18:01 -07:00
F. Jason Park
8654cea584 Move ERC's buffer-display tests to separate file
* test/lisp/erc/erc-scenarios-base-buffer-display.el: New file.
* test/lisp/erc/erc-scenarios-base-reconnect.el
(erc-scenarios-common--base-reconnect-options,
erc-scenarios-base-reconnect-options--buffer,
erc-scenarios-base-reconnect-options--default): Move to new file and
rename.  (Bug#62833)
* test/lisp/erc/resources/erc-d/erc-d-tests.el (erc-d-run-linger):
Lengthen timeout.
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--m): Ensure buffer is
live before inserting.
2023-05-05 17:18:01 -07:00
F. Jason Park
c9f1ad2a87 Revive option erc-query-on-unjoined-chan-privmsg
* etc/ERC-NEWS: Mention reinstated and renamed legacy option
`erc-query-on-unjoined-chan-privmsg' as well as a change in behavior
for `erc-auto-query', when nil.  Also fix erroneous ChangeLog
reference in 5.5 section.
* lisp/erc/erc-backend.el (erc-server-PRIVMSG): Consider flag
`erc-receive-query-display-defer' and revived option
`erc-query-unjoined-chan-privmsg' when deciding whether to create a
new query buffer.  And only "open" a buffer for an unknown target when
the latter option is non-nil.
* lisp/erc/erc.el (erc-cmd-QUERY): Make error more informative.
(erc-query): Revise deprecation message.
(erc-auto-query, erc-receive-query-display): Swap alias and aliased
and add option to `erc-buffers' group.  Mention the nonstandard
meaning of nil and update package-version to signify a behavioral
change, even though the default value remains untouched.
(erc-receive-query-display-defer): Add new variable, a compatibility
switch to access legacy behavior for `erc-auto-query'.
(erc-query-on-unjoined-chan-privmsg,
erc-ensure-target-buffer-on-privmsg): Revise doc string and add alias.
Change package-version to ERC 5.6 due to slightly refined meaning.
* test/lisp/erc/erc-scenarios-base-attach.el: New file.
* test/lisp/erc/resources/base/channel-buffer-revival/reattach.eld:
New file.  (Bug#62833)
2023-05-05 17:18:01 -07:00
Mattias Engdegård
1ef219e220 Make old-struct test more robust
* test/lisp/emacs-lisp/cl-lib-tests.el (old-struct):
Use the `vector` constructor instead of vector literals to
avoid failing because of `type-of` constant-folding.
2023-05-05 22:00:28 +02:00
Mattias Engdegård
044392c5c5 Constant-propagate cons and vector literals
* lisp/emacs-lisp/byte-opt.el (byte-optimize--substitutable-p):
Allow quoted lists and conses, and vector literals, to be substituted
from lexical variables.  This can eliminate variable bindings and
create new constant folding opportunities.
2023-05-05 22:00:28 +02:00
Mattias Engdegård
3b038d46e2 Remove useless handling of erroneous code in Lisp optimiser
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
((closure ...) ...) is a malformed function call; treat it as such.
Better malformed function warning location.
2023-05-05 22:00:27 +02:00
Mattias Engdegård
1438574dd7 Don't inline funcall to literal lambda form
* lisp/emacs-lisp/byte-opt.el (byte-optimize-funcall): Don't convert

  (funcall '(lambda ...) ...) -> ((lambda ...) ...)

because that would inline what is essentially an `eval` of a
function using dynamic binding rules into lexbound code.
2023-05-05 22:00:27 +02:00
João Távora
0e8d8a7228 Fido-mode: never shadow 'external' completion style
As explained in the manual (20.7.2 Fast minibuffer selection)
'fido-mode' and 'fido-vertical-mode' give priority the "flex"
completion style.

In fact, bug#62015 was recently fixed in commit because that priority
was not taking place correctly and some completions were missed.

However, an exception must be made for the 'external' completion
style.

That style, made available by the lisp/external-completion.el library,
is specifically designed to work with backends that provide only a
partial view of all completions.  If we allow 'flex' to step in front
of 'external' it could mean that 'flex' matches something and
'external' isn't triggered as it probably should.

To reproduce have the rust-mode ELPA package and the rust-analyzer LSP
server handy.  Then:

  emacs -Q -f package-initialize main.rs

Where main.rs is this content:

  fn foo1()    {} fn foo2()    {} fn foo3() {}
  fn foobar1() {} fn foobar2() {} fn foobar3() {}

The rust-analyzer server can be quickly configured to return only 3
workspace symbols max, so evaluate:

  (setq-default eglot-workspace-configuration
                '(:rust-analyzer
                    (:workspace (:symbol (:search (:limit 3))))))

Now start M-x eglot and M-x fido-vertical-mode and type C-u M-. to
find an arbitrary symbol in this one-file project.

Type 'f'.  You will see the three foo's are listed, correctly.

Now type '3'.   You will only see "foo3".

But that's wrong because "foobar3" was available, if only the server
had been asked for it.  This commit fixes the situation and no
completions are lost.

As an unfortunate side-effect of this commit, the fontification of
completions-common-part on the matches is lost, but that is not worse
than missing out on completions and there are better ways to recover
the fontification anyway (in external-completion.el).

See also:
https://github.com/joaotavora/eglot/discussions/1219#discussioncomment-5818336

* lisp/icomplete.el (icomplete--fido-ccd): Do not touch entries
with 'external in them.
2023-05-05 19:46:50 +01:00
Michael Albinus
f6476f8536 Improve ange-ftp-file-remote-p
* lisp/net/ange-ftp.el (ange-ftp-file-remote-p): Handle hop
identification.
2023-05-05 19:39:22 +02:00
Mattias Engdegård
778a1ee35b Fix dired and tramp where ls does not have the -N option
This includes BSD ls, also used by macOS (bug#63142).

* lisp/dired.el (dired-insert-directory):
* lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory):
Test whether -N is understood by ls since that option is used along
with --dired.  Remove -N when we remove --dired.
2023-05-05 19:19:51 +02:00
João Távora
c0ab4e9ca9 Eglot: re-rename eglot-upgrade to eglot-upgrade-eglot
* doc/misc/eglot.texi (Getting the latest version): Mention
eglot-upgrade-eglot.

* etc/EGLOT-NEWS: Mention eglot-upgrade-eglot.

* lisp/progmodes/eglot.el (eglot-upgrade-eglot): Rename from
eglot-update.
(eglot-update): New compatibility alias.
2023-05-05 14:58:17 +01:00
Eli Zaretskii
b4e90070f9 Fix arguments of xml.c functions as displayed in Help buffers
* lisp/subr.el (libxml-parse-xml-region)
(libxml-parse-html-region): Adjust advertised-calling-convention
to the changes in commit cc33c6cf3a.  (Bug#63291)
2023-05-05 10:08:59 +03:00
Po Lu
b1bda8228e More fixes for NetBSD/vax
* src/sysdep.c (init_signals) [__vax__]: Treat SIGILL
as a floating point error on VAXen.
Otherwise, (log 0.0) crashes Emacs.
2023-05-05 14:15:23 +08:00
Cyril Arnould
a2d4cd06f4 Improve VHDL mode highlighting
* lisp/progmodes/vhdl-mode.el (vhdl-compiler-alist): Differentiate
between ModelSim errors, warnings, and notes when highlighting
them.  Add a new entry for Xilinx Vivado.  (Bug#63251)

Copyright-paperwork-exempt: yes
2023-05-05 08:45:29 +03:00
Jim Porter
f204c4a6cf ; Use a Bourne shell-compatible form for command substitution
* build-aux/git-hooks/post-commit:
* build-aux/git-hooks/pre-push: Use `` instead of $().
2023-05-04 22:44:40 -07:00
Jim Porter
eb3a90619f ; Allow spaces in directory names for Git hooks
* build-aux/git-hooks/post-commit:
* build-aux/git-hooks/pre-push: Quote "$HOOKS_DIR" to allow spaces.
2023-05-04 21:04:46 -07:00
Spencer Baugh
34ac7d9087 Make vc-hg-annotate-command async
There's no benefit in this running the process synchrounously, and
it's annoying for it to block the Emacs UI.

* lisp/vc/vc-hg.el (vc-hg-annotate-command):
Run asynchronously (bug#63123).
2023-05-05 02:42:49 +03:00
Michael Albinus
5f79d821a0 Suspend timers when reading Tramp process output
* lisp/net/tramp-compat.el (xdg): Require.
(tramp-compat-temporary-file-directory): Set it to
$XDG_CACHE_HOME/emacs if possible.

* lisp/net/tramp.el (tramp-debug-to-file): Fix docstring.
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-debug-message): Simplify backtrace check.
(with-tramp-locked-connection): Suppress timers.  (Bug#49954, Bug60534)

* test/lisp/net/tramp-tests.el (tramp-test09-insert-file-contents):
Adapt test.
(tramp-test45-asynchronous-requests): Remove :unstable tag.
Adapt test.
2023-05-04 20:42:24 +02:00
Jim Porter
d3ec68f5e4 ; Fix post-commit and pre-push hooks in worktrees again
* build-aux/git-hooks/post-commit:
* build-aux/git-hooks/pre-push: Use "$(dirname $0)" to get the hooks
directory.
2023-05-04 09:22:40 -07:00
Po Lu
2f3a514b6d Clarify documentation wrt floating point division by zero and NaN
* doc/lispref/numbers.texi (Float Basics)
(Arithmetic Operations): Document what happens on a VAX.
Tested on NetBSD 9.3.
2023-05-04 22:09:14 +08:00
Robert Pluim
94e984e670 Make loaddefs-generate slightly more tolerant
There are packages in the wild, such as vlf-20191126.2250, which have
entries that are not terminated by three ';', but by two.  Tolerate
such entries.

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Search for two
';' as a delimiter, not three.  (Bug#63236)
2023-05-04 16:03:13 +02:00
Eli Zaretskii
aba41d2c4b ; Minor doc cleanups in go-ts-mode.el
* lisp/progmodes/go-ts-mode.el (go-ts-mode--iota-query-supported-p)
(go-ts-mode--other-type-node-p, go-mod-ts-mode--in-directive-p):
Doc fixes.
2023-05-04 16:37:39 +03:00
Basil L. Contovounesios
b42ccb2e5c ; Minor grammar fix in treesit manual. 2023-05-04 12:16:57 +02:00
Philip Kaludercic
ab44c8a6f9 Fix order of rcirc-connect arguments
* lisp/net/rcirc.el (rcirc): Pass SERVER-ALIAS before CLIENT-CERT.
(rcirc-connect): Take SERVER-ALIAS before CLIENT-CERT.

This is necessary for the 'rcirc-reconnect' trick to work that applies
the contents of 'rcirc-connection-info' to 'rcirc-connect', otherwise
the server alias gets lost as certfp information.

This addresses a change made in b79cb838a4.
2023-05-04 10:06:32 +02:00
Thuna
8eb6e33691 Fix rcirc messages printing in the wrong place
* lisp/net/rcirc.el (rcirc-send-message): Print the message before
sending it to the server.
(rcirc-print): Get the time with subsecond precision.
* lisp/calendar/parse-time.el (parse-time-string
parse-iso8601-time-string): Accept optional second FORM arguments,
with the same meaning as in `decode-time'.  Mention as such in the
docstring.  (Bug#59501)

Copyright-paperwork-exempt: yes
2023-05-04 10:06:32 +02:00
Philip Kaludercic
2901a3443c Prevent unnecessary modifications of 'package-vc-selected-packages'
* lisp/emacs-lisp/package-vc.el (package-vc--unpack): Handle the
structure of correctly, not as an alist but a list of alists.
(package-vc--archive-spec-alist, package-vc--archive-spec-alists,
package-vc--desc->spec, package-vc--read-archive-data,
package-vc--download-and-read-archives, package-vc--unpack): Rename
'package-vc--archive-spec-alist' to 'package-vc--archive-spec-alists'.
2023-05-04 10:06:32 +02:00
Dmitry Gutov
eaad302bd6 Rename eglot-update to eglot-upgrade
* doc/misc/eglot.texi (Getting the latest version):
Update the reference.

* lisp/progmodes/eglot.el (eglot-upgrade): Rename from
'eglot-update', as discussed on emacs-devel, in line with
'package-upgrade'.
2023-05-04 01:39:15 +03:00
Randy Taylor
eaf25b9c6a go-ts-mode: Use iota query only if supported (Bug#63086)
iota query support was added on January 5, 2022.  To support older
versions of the tree-sitter-go grammar (like the latest tagged version,
v0.19.1, which was released on March 3, 2021), check if the query is
supported before trying to use it.

* lisp/progmodes/go-ts-mode.el (go-ts-mode--iota-query-supported-p): New
function.
(go-ts-mode--font-lock-settings): Use it.
2023-05-04 00:56:19 +03:00
Dmitry Gutov
cc090294d7 (rng-complete-tag): Add the (ignored) argument to the :company-kind function
* lisp/nxml/rng-nxml.el (rng-complete-tag): Add the (ignored)
argument to the :company-kind function.  Fixes the "Wrong number
of arguments" error reported at
https://github.com/company-mode/company-mode/issues/1386.
2023-05-03 23:58:27 +03:00
Stefan Monnier
b28d44d422 * lisp/emacs-lisp/package.el (package-buffer-info): Fix thinko 2023-05-03 13:18:08 -04:00
Jonas Bernoulli
21ec6c1d5c
Update to Transient v0.3.7-219-g3ded15b 2023-05-03 15:02:31 +02:00
Po Lu
8d5aa8df4a Fix inserting selection data into Mozilla programs
* lisp/select.el (xselect-convert-to-text-uri-list): Don't
return any value when converting non-DND selections to this
drag-and-drop target.

Reported by Tobias Bading <tbading@web.de>.
2023-05-03 20:02:01 +08:00
Thuna
57562c3fd0 Recognize defstruct slot names in various eieio functions
* lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Set
each slot's name's 'slot-name' property so that
'eieio--known-slot-name-p' can recognize them.  (Bug#62959)

Copyright-paperwork-exempt: yes
2023-05-03 14:44:59 +03:00
Michael Albinus
5eaa7ec098 Tramp code cleanup
* doc/lispref/files.texi (Magic File Names): Order alphabetically.

* lisp/net/tramp.el (tramp-file-name-for-operation):
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Order alphabetically.

* lisp/net/tramp.el (tramp-handle-file-user-uid)
(tramp-handle-file-group-gid, tramp-read-id-output):
* lisp/net/tramp-archive.el (tramp-archive-handle-file-group-gid):
(tramp-archive-handle-file-user-uid): Fix docstring.

* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test44-user-group-ids): Fix docstring.
2023-05-03 13:26:35 +02:00
Eli Zaretskii
3f66b26d64 ; * lisp/dired.el (dired-insert-directory): Fix a typo in a comment. 2023-05-03 14:15:42 +03:00
Alan Mackenzie
4707f6adf6 Fontify "extern foo ();" correctly inside a function
This fixes bug#63224.

* lisp/progmodes/cc-engine.el (c-forward-type): Handle the "("
as a special case by trying to parse it with
c-forward-declarator and accepting it as a typeless function
when that fails.
2023-05-03 10:01:14 +00:00
Mattias Engdegård
5315f4f518 ; * lisp/simple.el (blink-matching-open): retain props in bootstrap 2023-05-03 11:09:37 +02:00
Jim Porter
40d6609563 Use connection-aware functions when getting the UID/GID in Eshell
This means, for example, that when using Tramp to sudo in Eshell, "rm"
queries the user before deleting anything (bug#63221).

* lisp/eshell/esh-util.el (eshell-user-login-name): New function...
* lisp/eshell/em-unix.el (eshell/whoami): ... use it.

* lisp/eshell/em-ls.el (eshell-ls-applicable): Use 'file-user-uid' and
'eshell-user-login-name'.
(eshell-ls-decorated-name): Use 'file-user-uid'.

* lisp/eshell/em-pred.el (eshell-predicate-alist): Use 'file-user-uid'
and 'file-group-gid'.

* lisp/eshell/em-unix.el (eshell-interactive-query): New widget...
(eshell-rm-interactive-query, eshell-mv-interactive-query)
(eshell-cp-interactive-query, eshell-ln-interactive-query): ... use
it.
(eshell-interactive-query-p): New function...
(eshell/rm, eshell/mv, eshell/cp, eshell/ln): ... use it.

* lisp/simple.el (file-group-gid): New function.

* lisp/net/ange-ftp.el (ange-ftp-file-group-gid): New function...
(file-group-gid): ... use it.

* lisp/net/tramp.el (tramp-handle-file-group-gid):
* lisp/net/tramp-archive.el (tramp-archive-handle-file-group-gid): New
functions.

* lisp/net/tramp.el (tramp-file-name-for-operation): Add
'file-group-gid'.

* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Add 'file-group-gid' mapping.

* test/lisp/net/tramp-tests.el (tramp-test44-file-user-group-ids):
* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test44-file-user-group-ids): Add tests for
'file-group-gid'.

* doc/lispref/files.texi (Magic File Names): Mention 'file-group-gid'.

* doc/lispref/os.texi (User Identification): Document
'file-group-gid', and move 'group-real-gid' to match the order of
'user-real-uid'.

* etc/NEWS: Announce 'file-group-gid'.
2023-05-02 21:28:34 -07:00
Eli Zaretskii
fa33a14ebe ; Fix last change
* lisp/simple.el (blink-matching-paren-highlight-offscreen)
(blink-matching-paren-offscreen)
(blink-paren-open-paren-line-string): Doc fixes.  (Bug#63089)
2023-05-02 21:36:26 +03:00
Shynur
299bd316cd Display matched offscreen open paren with a distinct face
Propertize matched offscreen openparen that is showing in
the echo area in order to make it prominent; use shadow
face for non-context characters (i.e., 'Matches') for the
same purpose.
* lisp/simple.el (blink-matching-paren-offscreen): Add this
face for highlighting.
* lisp/simple.el (blink-matching-paren-highlight-offscreen): Add
this option to toggle face `blink-matching-paren-offscreen'.
* lisp/simple.el (blink-paren-open-paren-line-string): Propertize
the matched offscreen openparen with a face conditionally.
(Bug#63089)
2023-05-02 21:31:29 +03:00
Thuna
b93eb68cc3 Use 'calendar-buffer' instead of fixed string
* test/lisp/calendar/cal-julian-tests.el (with-cal-julian-test):
Use 'calendar-buffer' instead of a literal fixed name.
(Bug#61546)

Copyright-paperwork-exempt: yes
2023-05-02 21:02:19 +03:00
Spencer Baugh
e338a8ac41 Handle point not at EOB in minibuffer-choose-completion
Without this change, only the minibuffer contents before point
are cleared when a completion is chosen, which results in stray
text when point is in the middle of the minibuffer.

After this change, we heuristically decide either to clear the
whole buffer or only part of it, taking into account the
location of point.

This is a backport for the Emacs 29 release branch of a simpler
fix in minibuffer-completion-help.

* lisp/minibuffer.el (minibuffer-next-completion):
(minibuffer-choose-completion):
Recalculate completion-base-affixes with point.  (Bug#62700)
2023-05-02 20:54:25 +03:00
Spencer Baugh
fceaf230b0 Note that Emacs pauses when handling sentinel errors
Noting this behavior and variable here makes it easier to
understand the behavior of Emacs when a sentinel has an error.

* doc/lispref/processes.texi (Filter Functions): Note that Emacs
pauses when handling sentinel errors.
(Sentinels): Note that Emacs pauses when handling sentinel errors.
(Bug#63096)
2023-05-02 20:50:16 +03:00
Eli Zaretskii
f1a7cd71a0 Fix Dired when QUITING_STYLE is set in the environment
* lisp/dired.el (dired-insert-directory): Ensure non-default
quoting style of file names is not used by 'ls' when we invoke it
with the --dired switch.  (Bug#63142)
2023-05-02 20:46:17 +03:00
Eli Zaretskii
f8c86654c7 ; * doc/lispref/functions.texi (Declare Form): Fix whitespace. 2023-05-02 15:55:44 +03:00
Eli Zaretskii
daf602a5c8 Merge from origin/emacs-29
46392c1623 Fix vertical-motion when tab-line is displayed in a window
0e52beeace Update to Org 9.6.5-3-g2993f4
dd21003878 Prevent generating empty autoload files
2bcf11d0ef * lisp/org/org-macs.el (org--inhibit-version-check): Fix ...
ca43435816 Fix redisplay of mode line after its format changes from nil
610a7657e0 Fix c-ts-mode--emacs-c-range-query
7f94558b77 Improve documentation of warnings
5a3f0e2c55 ; Doc fix in c-ts-mode.el
21361d0563 Fix FOR_EACH_TAIL fontification (bug#62951)
d0df3404fd ; * etc/EGLOT-NEWS:  chsharp-le -> csharp-ls
c229e83c3c ; * etc/EGLOT-NEWS (https): Elglot -> Eglot.
b4f2f49978 Fix documentation of libxml-parse-* functions
5dd784961d ; * src/treesit.c (syms_of_treesit): Fix error messages.
ddfa0d8da9 ; Remove some leftover text
2023-05-02 08:50:09 -04:00
Eli Zaretskii
4f44c56c86 Revert "; * lisp/progmodes/c-ts-mode.el: allow loading file without treesit"
This reverts commit 7d246c359c.
The same problem was already fixed on the release branch,and this
change will just cause merge conflicts.
2023-05-02 15:43:51 +03:00
Mattias Engdegård
7d246c359c ; * lisp/progmodes/c-ts-mode.el: allow loading file without treesit 2023-05-01 19:09:47 +02:00
Jim Porter
d01543f114 ; Use $GIT_DIR to find the .git directory inside our hooks
This resolves an issue with running the hooks from a worktree.  See
<https://lists.gnu.org/archive/html/emacs-devel/2023-05/msg00000.html>.

* build-aux/git-hooks/post-commit:
* build-aux/git-hooks/pre-push: Use $GIT_DIR.
2023-05-01 09:51:56 -07:00
Mattias Engdegård
aa135e09b6 Declare cl-delete to have important-return-value (bug#61730)
* lisp/emacs-lisp/cl-macs.el: Set property on `cl-delete`.
* lisp/progmodes/python.el (python-shell--add-to-path-with-priority):
Prevent warning by cleaner code.
2023-05-01 17:22:02 +02:00
Mattias Engdegård
7acb3f1c06 Add the function declaration and property important-return-value
Now the declaration

 (declare (important-return-value t))

can be used to have the byte-compiler warn when the return value from
a call is discarded (bug#61730).

* lisp/emacs-lisp/bytecomp.el (byte-compile-form)
(important-return-value-fns): Use the function property
`important-return-value` instead of looking through a static list.
* lisp/emacs-lisp/byte-run.el (byte-run--set-important-return-value)
(defun-declarations-alist): New function declaration, setting the
property of the same name.
* lisp/emacs-lisp/cl-macs.el:
* lisp/subr.el (assoc-default): Set the property.
* doc/lispref/functions.texi (Declare Form):
* doc/lispref/symbols.texi (Standard Properties): Document.
* etc/NEWS: Announce.
2023-05-01 17:11:50 +02:00
Eli Zaretskii
46392c1623 Fix vertical-motion when tab-line is displayed in a window
* src/xdisp.c (try_window, try_window_id): Account for tab-line,
if present, when converting scroll-margin at the top of the window
to vertical pixel coordinate.  (Bug#63201)
2023-05-01 15:27:21 +03:00
F. Jason Park
aa56253407 Compare case-folded nicks with erc-fill-wrap-merge
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Downcase
both current and previous speaker when comparing nicks.
* test/lisp/erc/erc-fill-tests.el (erc-fill-wrap--merge): Add
title-case nick to test.
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update
snapshot.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update
snapshot.  (Bug#60936)
2023-04-30 18:28:54 -07:00
Kyle Meyer
0e52beeace Update to Org 9.6.5-3-g2993f4 2023-04-30 19:36:21 -04:00
Philip Kaludercic
dd21003878 Prevent generating empty autoload files
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Remove
optimisation that would mistakenly discard old loaddefs in case a file
was not modified by EXTRA-DATA is non-nil.  (Bug#62734)
2023-04-30 18:42:58 +02:00
Stefan Monnier
2bcf11d0ef * lisp/org/org-macs.el (org--inhibit-version-check): Fix docstring
Also, add an explanation to the docstring for what the version
check is about.
2023-04-30 09:41:13 -04:00
Eli Zaretskii
ca43435816 Fix redisplay of mode line after its format changes from nil
* src/dispnew.c (update_window): Make sure a mode-line's row of
the current glyph matrix is disabled when the mode line is not
being displayed.  (Bug#63186)
2023-04-30 16:24:05 +03:00
Michael Albinus
610a7657e0 Fix c-ts-mode--emacs-c-range-query
* lisp/progmodes/c-ts-mode.el (c-ts-mode--emacs-c-range-query):
Check for (treesit-available-p).
2023-04-30 12:11:00 +02:00
Eli Zaretskii
7f94558b77 Improve documentation of warnings
* doc/lispref/control.texi (Errors):
* doc/lispref/os.texi (Startup Summary):
* doc/lispref/display.texi (Warning Basics, Warning Variables)
(Warning Options, Delayed Warnings): Improve documentation of
warnings.  Document the automatic delaying of warnings during
startup.  (Bug#63181)
2023-04-30 11:07:36 +03:00
Eli Zaretskii
5a3f0e2c55 ; Doc fix in c-ts-mode.el
* lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-for-each-tail):
Doc fix.
2023-04-30 08:21:38 +03:00
Andrew G Cohen
605414d018 Fix outgoing mime type regression (Bug#62815)
* lisp/net/mailcap.el (mailcap-mime-extensions,
mailcap-parse-mimetype-file, mailcap-mime-types): Don't regexp-quote
mimetypes in a context where they should be strings.
(mailcap--regexp-quote-type): Remove.
2023-04-30 10:05:11 +08:00
Yuan Fu
21361d0563
Fix FOR_EACH_TAIL fontification (bug#62951)
Fix the fontification inconsistency between different FOR_EACH_TAIL's.
See the comment for more explanation.  Also enable the emacs-devel
feature automatically when c-ts-mode-emacs-sources-support is on.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--for-each-tail-regexp): Move up.
(c-ts-mode--font-lock-settings): New font-lock rule for FOR_EACH_TAIL.
(c-ts-mode--fontify-for-each-tail): New function.
(c-ts-mode): Automatically enable emacs-devel feature.
2023-04-29 15:51:09 -07:00
João Távora
30892cbd33 Eglot: bump to 1.15
* lisp/progmodes/eglot.el (Version): Bump to 1.15

* etc/EGLOT-NEWS: Update.
2023-04-29 23:31:29 +01:00
João Távora
c604cb6a8a Eglot: unbreak for Emacs 26
Emacs 26 doesn't have newer progress-reporter-update.
I think I'll start using compat.el soon.

* lisp/progmodes/eglot.el (eglot--apply-text-edits): Unbreak for
Emacs 26 which doesn't have newer progress-reporter-update.
2023-04-29 20:46:12 +01:00
Theodor Thornhill
d0df3404fd ; * etc/EGLOT-NEWS: chsharp-le -> csharp-ls 2023-04-29 19:59:49 +02:00
Theodor Thornhill
c229e83c3c ; * etc/EGLOT-NEWS (https): Elglot -> Eglot. 2023-04-29 19:56:26 +02:00
Wilhelm H Kirschbaum
e03cfec0a4 Improve call indentation for elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--indent-rules): Change match order.
(Bug#63110)

* test/lisp/progmodes/elixir-ts-mode-resources/indent.erts:
Add test case.
2023-04-29 12:16:56 +03:00
Wilhelm H Kirschbaum
e0e93f7eec Add bitstring indentation and navigation for elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--sexp-regexp): Add bistring.
(elixir-ts--indent-rules): Handle bitstring indentation.
(Bug#63109)

* test/lisp/progmodes/elixir-ts-mode-resources/indent.erts:
Add test case.
2023-04-29 12:13:47 +03:00
Eli Zaretskii
b408df11e3 Optimize search for composable characters in redisplay
* src/composite.c (composition_compute_stop_pos): Accept new
argument INCLUDE_STATIC, and look for potential static
compositions only if this argument is non-zero.
* src/xdisp.c:
* src/composite.c:
* src/indent.c: All callers adjusted.
* src/xdisp.c (compute_stop_pos): Don't search for static
compositions.  Search for automatic compositions only after the
iterator gets past the composition stop_pos computed last time.
Use a better position for limiting search for automatic
compositions.  (Bug#62780)
2023-04-29 11:50:47 +03:00
Eli Zaretskii
b4f2f49978 Fix documentation of libxml-parse-* functions
* doc/lispref/text.texi (Parsing HTML/XML):
* src/xml.c (Flibxml_parse_html_region, Flibxml_parse_xml_region):
Update the documentation regarding the use of BASE-URL argument.
(Bug#63125)
2023-04-29 09:39:15 +03:00
Eli Zaretskii
5dd784961d ; * src/treesit.c (syms_of_treesit): Fix error messages. 2023-04-28 21:14:32 +03:00
Dmitry Gutov
ddfa0d8da9 ; Remove some leftover text 2023-04-28 19:28:25 +03:00
Jonas Bernoulli
5c0f0751d0 Support displaying all package maintainers (Bug#62524)
* lisp/emacs-lisp/package.el (describe-package-1): Use new
:maintainers package extra property from "archive-contents",
if non-nil.
* (package-buffer-info): Fix docstring.
2023-04-28 18:18:13 +02:00
Eli Zaretskii
e155df7da7 Merge from origin/emacs-29
212e30f678 ; Fix byte-compilation warnings in c-ts-mode.el
1f2214dabd Skip over whitespace in annotation-top-cont check (bug#63...
7e136c51f6 Update zh-CN tutorial translation
d3ca0b3aa2 ; * lisp/progmodes/c-ts-mode.el: Fix comments and doc str...
c6f15c2486 ; Fix last change.
b9e06330f7 ; * etc/NEWS: Followup to bug#62720.
b33d25f596 ; Minor improvements in doc strings of package-upgrade co...
c3a61870b9 Fix eglot.texi

# Conflicts:
#	etc/NEWS
2023-04-28 12:14:26 -04:00
Eli Zaretskii
212e30f678 ; Fix byte-compilation warnings in c-ts-mode.el
* lisp/progmodes/c-ts-mode.el (treesit-parser-set-included-ranges)
(treesit-query-compile): Declare treesit.c functions.
(treesit-load-name-override-list): Defvar it.
2023-04-28 12:01:19 -04:00
Mattias Engdegård
6ebce84ff2 Use t for non-nil default values in boolean defcustom declarations
* lisp/emulation/viper-ex.el (ex-unix-type-shell):
* lisp/emulation/viper-init.el (viper-ms-style-os-p):
* lisp/eshell/em-glob.el (eshell-glob-case-insensitive):
* lisp/filecache.el (file-cache-ignore-case):
* lisp/lpr.el (lpr-add-switches):
* lisp/ls-lisp.el (ls-lisp-ignore-case):
* lisp/mail/binhex.el (binhex-use-external):
* lisp/progmodes/cperl-mode.el (cperl-electric-parens-mark):
Normalise default values to nil or t.
2023-04-28 15:03:47 +02:00
Theodor Thornhill
1f2214dabd Skip over whitespace in annotation-top-cont check (bug#63141)
* lisp/progmodes/csharp-mode.el (csharp-guess-basic-syntax): Make sure
we skip over whitespace when looking for the next '['.
2023-04-28 14:00:57 +02:00
Po Lu
a57a8b75f5 Make mode-line behavior better with grayscale visuals
* lisp/faces.el (mode-line, mode-line-inactive)
(mode-line-highlight): Enable gray faces on grayscale visuals.
2023-04-28 14:43:31 +08:00
Ruijie Yu
7e136c51f6 Update zh-CN tutorial translation
* etc/tutorials/TUTORIAL.cn (INTRO): Additions from English
version; say "interrupt" not "quit" a partially-entered command;
fixed minor inconsistency (English says partially-entered command,
Chinese used to say partially-executed command -- they are
different); converted half-width square brackets containing
translators' notes into full-width ones for consistency.
(BASIC CURSOR CONTROL): mention that a word boundary for Chinese
can also be space; fixed incorrect terminology (keyboard vs
terminal); retain English term "terminal"; retain English term
"prefix argument"; "most commands _interpret_ prefix args as
repeat-count", not "explain"; ensure space is added on both ends
of an English word.
(WINDOWS): Clarify it is the digit 1 in C-x 1.
(INSERTING AND DELETING): Mention the term "continuation line" and
retain its English term, because this term is mentioned again
later in the tutorial; avoid saying the name of "\\"; add
description for "electric" and a rough translation; sync English
for prefix argument for DEL and C-d; ensure that translators'
notes are marked explicitly so; add indentation to the instruction
about continuation lines; additional translations such as
mentioning C--, etc.
(FILES): Re-pluralize the heading; space around English words;
describe what C-g cancels (the command) when entering file name;
replace "search for" with "find"; minor rephrasing; explicit
translator notes; fixed the write-file message to no longer
contain ellipses (see src/fileio.c:5541).
(BUFFERS): Re-pluralize the heading; mention that C-x C-b also
shows buffer name; C-x s only looks for file-visiting buffers.
(EXTENDING THE COMMAND SET): Include C-x s and C-x b in list of
learned commands.
(MODE LINE): Remove the dashes in description on the point
location.
(MULTIPLE WINDOWS): Mention the difference between frame
and window; also add translator notes pointing to end of
tutorial which contains a terminology list.
(MULTIPLE FRAMES): Change the M-x commands to keybinds C-x 5 2 and
C-x 5 0 to sync with English.
(GETTING MORE HELP): Change C-h f to C-h x, to sync with English.
(INSTALLING PACKAGES): Rephrase "available packages", used to say
lit., "existing", now says lit., "installable"; consistently
translate the term "package", and retain its English name.
(TRANSLATION): Add my name as co-maintainer of this file.

* etc/tutorials/TUTORIAL.translators (TUTORIAL.cn): Add my name
as co-maintainer for TUTORIAL.cn.
2023-04-28 09:09:10 +03:00
Eli Zaretskii
d3ca0b3aa2 ; * lisp/progmodes/c-ts-mode.el: Fix comments and doc strings (bug#62951). 2023-04-28 08:40:56 +03:00
Eli Zaretskii
c6f15c2486 ; Fix last change. 2023-04-28 08:27:20 +03:00
Eli Zaretskii
b9e06330f7 ; * etc/NEWS: Followup to bug#62720. 2023-04-28 08:26:39 +03:00
Eli Zaretskii
b33d25f596 ; Minor improvements in doc strings of package-upgrade commands
* lisp/emacs-lisp/package.el (package-upgrade)
(package-upgrade-all): Doc fixes.  (Bug#62720)
2023-04-28 08:14:37 +03:00
Eli Zaretskii
c3a61870b9 Fix eglot.texi
* doc/misc/eglot.texi (Troubleshooting Eglot): Add missing @menu.
(Performance, Getting the latest version): Improve wording and
indexing, add cross-references.
2023-04-28 07:54:16 +03:00
Po Lu
a97c382682 Merge from origin/emacs-29
a40f181623 Fix two crashes upon startup
44ebd9cbd5 Eglot: explain how to update Eglot in manual (bug#62720)
941ef044f2 Eglot: fix edge case when deleting inlay hint overlays
a365984d9e package-upgrade[-all]: Expand docstrings to note the curr...
f965f35b33 Rename all functions called package-*-update-* to package...
31b58161bb Fix FOR_EACH_TAIL in c-ts-mode (bug#62951)
0cf6e0998b * Makefile.in (distclean): Remove the 'native-lisp' direc...
933705d61e Improve greek-ibycus4 input method

# Conflicts:
#	etc/NEWS
2023-04-28 11:51:01 +08:00
Po Lu
a40f181623 Fix two crashes upon startup
* src/image.c (image_create_bitmap_from_data)
(image_create_bitmap_from_file): Specify a Window or a Pixmap
describing the screen, not a back buffer drawable which may not exist.
Otherwise, Emacs crashes on startup when a bitmap icon is in use.
2023-04-28 11:47:46 +08:00
João Távora
44ebd9cbd5 Eglot: explain how to update Eglot in manual (bug#62720)
* lisp/progmodes/eglot.el (eglot-update): New command.

* doc/misc/eglot.texi (Troubleshooting): Rework.
2023-04-28 00:39:08 +01:00
João Távora
941ef044f2 Eglot: fix edge case when deleting inlay hint overlays
When asked to update hints in a region (FROM TO),
eglot--update-hints-1 first deletes the existing hints.  It must
however take care to delete all overlays that logically belong to the
region, even if they don't physically belong to it, e.g. inlay
overlays spanning (FROM-1 FROM) and having a 'after-string' property.

* lisp/progmodes/eglot.el (eglot--update-hints-1): Fix edge case.
2023-04-28 00:39:08 +01:00
Dmitry Gutov
a365984d9e package-upgrade[-all]: Expand docstrings to note the current limitation
* lisp/emacs-lisp/package.el (package-upgrade, package-upgrade-all):
Expand docstrings to note the current limitation (bug#62720).
2023-04-28 02:24:10 +03:00
Dmitry Gutov
f965f35b33 Rename all functions called package-*-update-* to package-*-upgrade-*
* lisp/emacs-lisp/package-vc.el (package-vc-upgrade-all):
Rename from 'package-vc-update-all'.
(package-vc-upgrade): Rename from 'package-vc-update'.

* lisp/emacs-lisp/package.el (package-upgrade):
Rename from 'package-update' (bug#62750).
(package--upgradeable-packages):
Rename from 'package--updateable-packages'.
(package-upgrade-all): Rename from 'package-update-all'.
2023-04-28 02:12:11 +03:00
Yuan Fu
31b58161bb
Fix FOR_EACH_TAIL in c-ts-mode (bug#62951)
* lisp/progmodes/c-ts-mode.el
(c-ts-mode--indent-styles): New indent rule.

(c-ts-mode--for-each-tail-regexp)
(c-ts-mode--for-each-tail-body-matcher)
(c-ts-mode--emacs-c-range-query)
(c-ts-mode--for-each-tail-ranges)
(c-ts-mode--reverse-ranges)
(c-ts-mode--emacs-set-ranges): New functions and variables.

(c-ts-mode): Create a emacs-c parser.  More setup for Emacs source
support.

* lisp/treesit.el (treesit-query-range): Ignore underscore-prefixed
capture names.
2023-04-27 12:50:16 -07:00
Eli Zaretskii
0cf6e0998b * Makefile.in (distclean): Remove the 'native-lisp' directory. 2023-04-27 21:39:33 +03:00
Michael Albinus
dbd7465790 Fix thinko in tramp-gvfs-maybe-open-connection
* lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
Use `assoc-default'.
2023-04-27 19:41:18 +02:00
Michael Albinus
98006bfd09 Fix Tramp bug#63102
* lisp/net/tramp.el (tramp-remote-path): Add ;;;###tramp-autoload cookie.
(Bug#63102)
2023-04-27 19:40:46 +02:00
Mattias Engdegård
5ead8c5f69 Clarify nconc behaviour for dotted lists (bug#63103)
* doc/lispref/lists.texi (Rearrangement): Explicitly say that dotted
lists are valid args to `nconc` and give an example.
2023-04-27 14:20:45 +02:00
Mattias Engdegård
1dcb737405 Don't rewrite (nconc X nil) -> X for any X (bug#63103)
Since the last cdr of a non-terminal argument to `nconc` is
overwritten no matter its value:

  (nconc (cons 1 2) nil) => (1)

a terminating nil arg cannot just be eliminated unconditionally.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-nconc):
Only eliminate a terminal nil arg to `nconc` if preceded by
a nonempty proper list.  Right now we only bother to prove this
for `(list ...)`, so that

  (nconc (list 1 2 3) nil) -> (list 1 2 3)

* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--test-cases): Add test cases.
2023-04-27 14:20:45 +02:00
Po Lu
521386f920 ; * admin/charsets/mapconv (LC_ALL): Fix typo. 2023-04-27 18:51:40 +08:00
Po Lu
0e0fd0c38f Fix bootstrap on Unix
* admin/charsets/Makefile.in (${charsetdir}/JISX0201.map): Use
run_mapconv, which uses the correct awk.
* admin/charsets/mapconv (LC_ALL): Don't place assignment in
same line as export.
2023-04-27 18:50:47 +08:00
Eli Zaretskii
933705d61e Improve greek-ibycus4 input method
* lisp/leim/quail/greek.el ("greek-ibycus4"): Add another sequence
for CAPITAL LETTER RHO WITH DASIA.  (Bug#63104)
2023-04-27 10:25:20 +03:00
Stefan Kangas
dde576d731 ; Merge from origin/emacs-29
The following commit was skipped:

c46e93b1f5 Explain ERC 5.5 regressions in new version 5.5.0.29.1
2023-04-27 06:30:14 +02:00
Stefan Kangas
1c5140e813 Merge from origin/emacs-29
af43f0a295 * doc/misc/erc.texi: Elaborate on upgrading via ELPA.
10948948c1 Improve outline-default-state docstring
b5ace2eed8 Document problems with /bin/sh on Solaris 10
7b2ad8f199 ; Add missing <<inserted by help-with-tutorial>> line to ...
2023-04-27 06:30:14 +02:00
Eli Zaretskii
14d3431253 ; * lisp/help.el (describe-bindings-outline-rules): Fix :type tags. 2023-04-26 19:25:23 +03:00
Michael Albinus
022f50ebe6 New command 'tramp-cleanup-some-buffers'
* doc/misc/tramp.texi (Cleanup remote connections):
Document tramp-cleanup-some-buffers and
tramp-cleanup-some-buffers-hook.

* etc/NEWS: New command 'tramp-cleanup-some-buffers'.

* lisp/net/tramp.el (tramp-handle-make-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-sh.el (tramp-sh-handle-make-process):
Use `tramp-taint-remote-process-buffer'.

* lisp/net/tramp.el (tramp-post-process-creation): New defun.
(tramp-handle-make-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Use it.

* lisp/net/tramp-cmds.el (tramp-tainted-remote-process-buffers):
New defvar.
(tramp-cleanup-dired-buffer-p)
(tramp-delete-tainted-remote-process-buffer-function)
(kill-buffer-hook, tramp-cleanup-remote-process-p)
(tramp-cleanup-some-buffers): New defuns.
(tramp-cleanup-some-buffers-hook): New defcustom.  Add
`buffer-file-name', `tramp-cleanup-dired-buffer-p' and
`tramp-cleanup-remote-process-p' to the hook.
(kill-buffer-hook):
Add `tramp-delete-tainted-remote-process-buffer-function'.
(tramp-cleanup-all-buffers): Rework.

* lisp/net/tramp-compat.el (tramp-compat-always): New defalias.

* test/lisp/net/tramp-tests.el (tramp--test-always): Delete.
(tramp-test10-write-region, tramp-test21-file-links)
(tramp--test-deftest-direct-async-process)
(tramp-test37-make-auto-save-file-name)
(tramp-test38-find-backup-file-name)
(tramp-test39-make-lock-file-name)
(tramp-test39-detect-external-change): Use `tramp-compat-always'.
2023-04-26 18:06:39 +02:00
F. Jason Park
c46e93b1f5 Explain ERC 5.5 regressions in new version 5.5.0.29.1
* doc/misc/erc.texi: Bump version to 5.5.0.29.1.
* etc/ERC-NEWS: Don't hype bugged option `erc-reconnect-display'.
* lisp/erc/erc-dcc.el (erc-dcc-do-GET-command): Add comment explaining
parsing bug in ERC 5.5 (bug#62444).
* lisp/erc/erc-networks.el (erc-networks-on-MOTD-end): Mention known
/MOTD bug in error notice so people don't waste energy reporting
it (bug#62151).
* lisp/erc/erc.el: Change Version header to 5.5.0.29.1.  Don't bother
updating the `customize-package-emacs-version-alist' entry
because no option defaults are affected.
(erc-version): Change version to 5.5.0.29.1.
(erc-reconnect-display, erc-query-on-unjoined-chan-privmsg): Add
warning to doc strings and `custom-set' functions.  It's believed that
these bugs degrade the user experience significantly enough to warrant
such mentions (bug#62833).
(erc-query): Fix erroneous redirect string in deprecation spec.
Do not merge to master.
2023-04-26 06:21:29 -07:00
F. Jason Park
af43f0a295 * doc/misc/erc.texi: Elaborate on upgrading via ELPA. 2023-04-26 06:21:29 -07:00
Robert Pluim
10948948c1 Improve outline-default-state docstring
* lisp/outline.el (outline-default-state): Explain which functions are
available to affect heading visibility.
2023-04-26 12:31:00 +02:00
Eli Zaretskii
b5ace2eed8 Document problems with /bin/sh on Solaris 10
* etc/PROBLEMS (Solaris): Document problems with '/bin/sh'.
Suggested by Paul Eggert <eggert@cs.ucla.edu>.  (Bug#63067)
2023-04-26 09:39:35 +03:00
Mohsen Banan
7b2ad8f199 ; Add missing <<inserted by help-with-tutorial>> line to TUTORIAL.fa. 2023-04-26 08:58:10 +03:00
Eli Zaretskii
d07815a7cc Allow inserting #x6A58 using chinese-ctlaub IM
* leim/MISC-DIC/CTLau-b5.html (CTLau-b5 : Hanzi input by Cantonese
transcription (Lau style)): Add #x6A58 to GAT and GWAT.  (Bug#62898)
2023-04-25 17:39:23 +03:00
Eli Zaretskii
fa4eae191c ; * etc/NEWS: Fix last change. 2023-04-25 17:31:05 +03:00
Antero Mejr
c7fc4c8119 eww: Provide completions for bookmarks and suggested URIs.
* lisp/net/eww.el (eww): Add the result of 'eww-suggest-uris' to the
completion collection argument.
(eww-bookmark-urls): New procedure.
(eww-suggest-uris): Add "eww-bookmark-urls" to the default list.
* etc/NEWS (EWW): Add NEWS entry for the change.  (Bug#62800)
2023-04-25 17:29:23 +03:00
Antero Mejr
df6cc4d33b eww: Enable completion in URL/keyword prompt.
* lisp/net/eww.el (eww): Use 'completing-read' when prompting for a URL
or keywords.
(eww-minibuffer-url-keymap): New keymap for use in the URL/keyword
prompt.
* etc/NEWS (EWW): Add NEWS entry for the change.  (Bug#62800)
2023-04-25 17:28:10 +03:00
Eli Zaretskii
5741583f54 ; Auto-commit of loaddefs files. 2023-04-25 10:08:34 -04:00
Eli Zaretskii
095ec506d0 Merge from origin/emacs-29
524e161a53 Followup to addition of TUTORIAL.fa
76f50df153 Add Farsi/Persian translation of the tutorial
8eacfaea6d Add Mongolian language environments
fe8efbb8f7 Document the 'end-session' event on MS-Windows
d80f959bed Update to Org 9.6.4-9-g8eb209
98c6cfcbe4 Don't support versioned grammar libraries on MS-Windows
8f71c1546d Accept versioned tree-sitter language grammar files
99add09d5e tab-bar-new-tab: inhibit side-window checks
087e818194 * etc/NEWS: Fix outline level.  (Bug#63042)
d7f38558c4 ; Improve font selection for Traditional Mongolian
965c5e0231 Fix rendering of Traditional Mongolian script
9a0f10b5f8 Fix line-number-at-pos when POSITION is out of narrowing
4e0f4292aa ; * etc/tutorials/TUTORIAL: Fix punctuation.
dec2ac0c65 Fix exiting Emacs after saving a tutorial

# Conflicts:
#	etc/NEWS
2023-04-25 09:57:23 -04:00
Eli Zaretskii
f55ac7a745 ; Update authors.el
* admin/authors.el (authors-aliases): Update per
https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00692.html.
2023-04-25 16:45:31 +03:00
Po Lu
e6004ed30c Improve portability of pkg-config tests.
* configure.ac: Fix problems found after pkg-config was
installed on Solaris 10.
2023-04-25 20:41:05 +08:00
Your Name
b8f94eb0f1 Fix configure.ac for some Bourne shells
This fixes running configure under /bin/sh on Solaris 10, and
some other Unix systems.

* configure.ac: Avoid POSIX style command substitutions.
(emacs_major_version): Avoid POSIX style pattern substitution.
(PORT_PACKAGE, MAC_FLAGS, MAC_LIBS): Avoid POSIX style command
substitutions.
2023-04-25 20:28:38 +08:00
Eli Zaretskii
524e161a53 Followup to addition of TUTORIAL.fa
* etc/NEWS: Announce addition of TUTORIAL.fa.

* etc/tutorials/TUTORIAL.translators (TUTORIAL.fa): New entry.

* lisp/language/misc-lang.el ("Persian"): Add tutorial property.
2023-04-25 12:26:20 +03:00
Mohsen Banan
76f50df153 Add Farsi/Persian translation of the tutorial
* etc/tutorials/TUTORIAL.fa: New file.

* lisp/language/misc-lang.el (arabic-shaper-ZWNJ-handling): Fix
typo in doc string.
2023-04-25 12:19:24 +03:00
Eli Zaretskii
8eacfaea6d Add Mongolian language environments
* lisp/language/misc-lang.el ("Mongolian-traditional"):
* lisp/language/cyrillic.el ("Mongolian-cyrillic"): New
language environments.

* etc/HELLO: Add Mongolian Traditional.
* etc/NEWS: Announce the new language environments.

(Bug#63028)
2023-04-25 11:50:59 +03:00
Eli Zaretskii
fe8efbb8f7 Document the 'end-session' event on MS-Windows
* doc/lispref/commands.texi (Misc Events): Document the
'end-session' event.  (Bug#63058)
2023-04-25 09:35:30 +03:00
Kyle Meyer
d80f959bed Update to Org 9.6.4-9-g8eb209 2023-04-24 19:47:12 -04:00
Eli Zaretskii
98c6cfcbe4 Don't support versioned grammar libraries on MS-Windows
* src/treesit.c (treesit_load_language_push_for_each_suffix):
Don't append ".0.0" on WINDOWSNT.
2023-04-24 21:46:35 +03:00
Yuan Fu
8f71c1546d
Accept versioned tree-sitter language grammar files
By discussion on emacs-devel, titled "Versioned Tree-sitter parser
libraries".

* src/treesit.c (Vtreesit_str_dot_0): New variable.
(treesit_load_language_push_for_each_suffix): Additionally look for
lib_base_name.0 and lib_base_name.0.0.
(syms_of_treesit): Initialize Vtreesit_str_dot_0.
2023-04-24 10:38:40 -07:00
Eli Zaretskii
d18c4ef4fe ; Fix last change in help.el
* lisp/help.el (describe-bindings-outline-rules): Fix :type.
Reported by Robert Pluim <rpluim@gmail.com>.
2023-04-24 19:22:44 +03:00
Mattias Engdegård
de0b96c4ae ; * lisp/mail/uudecode.el (uudecode-use-external): Boolean value. 2023-04-24 16:06:14 +02:00
Mattias Engdegård
613591f384 Require custom values of boolean type to be nil or t
This helps detecting mistakes in types and/or initial values.

* lisp/wid-edit.el (boolean): Add :match function.
2023-04-24 16:03:47 +02:00
Benson Chu
99add09d5e tab-bar-new-tab: inhibit side-window checks
Previously, calling 'tab-bar-new-tab-to' only removed the
'window-side' property on the currently selected window,
and then a call to 'delete-other-windows' was made to
ensure that the selected window was the only window.
We can skip this check by shadowing 'window--sides-inhibit-check'
to t.
* lisp/tab-bar.el (tab-bar-new-tab-to): Inhibit side-window checks.
(Bug#62427)

Copyright-paperwork-exempt: yes
2023-04-24 14:47:14 +03:00
Eshel Yaron
2ef6f943ab Add option to control default outlining in 'C-h b'
* lisp/help.el (describe-bindings-outline-rules): New user option.
(describe-bindings): Use it instead of hardcoding "Key translations".
(Bug#62708)
2023-04-24 14:42:00 +03:00
Eli Zaretskii
62e4eb8fcf Fix build when Org's version changes
* lisp/org/org-macs.el (org--inhibit-version-check): Rename from
'org--built-in-p' and make it a defvar.  All users changed.
(Bug#62762)
2023-04-24 14:16:05 +03:00
Michael Albinus
087e818194 * etc/NEWS: Fix outline level. (Bug#63042)
Fix typos.
2023-04-24 09:40:43 +02:00
Jim Porter
65735cee71 ; Fix last change 2023-04-23 12:08:32 -07:00
Jim Porter
3ce462c8fd When examining merge commits in our Git hooks, only check the first parent
This does two things:

  1. We can properly validate log entries in merge commits.
  2. We don't check commits that were merged in from other branches.

* build-aux/git-hooks/commit-msg-files.awk (get_commit_changes): Get
the changes compared to the first parent.

* build-aux/git-hooks/pre-push: Only get the first parent of merge
commits when returning the rev-list, and only check "master" or
"emacs-NN" branches.
2023-04-23 12:07:08 -07:00
Jim Porter
e26dcc0e14 ; Fix logic of Git pre-push hook when pushing a new branch
* build-aux/git-hooks/pre-push: Update the Git command to run on each
iteration.
2023-04-23 12:07:08 -07:00
Jim Porter
9914de503b Improve the logic of the file entry Git hooks to support more cases
In addition to starting with a "*", file entries now need a ":"
somewhere in them.  This helps reduce false positives with bulleted
lists.  Also, support multiple files separated by commas after a "*".

* build-aux/git-hooks/commit-msg-files.awk (check_commit_msg_files):
Accumulate file entries over multiple lines to support the above.
2023-04-23 12:07:08 -07:00
Eli Zaretskii
d7f38558c4 ; Improve font selection for Traditional Mongolian
* lisp/international/fontset.el (setup-default-fontset): Improve
the font spec for Traditional Mongolian.  (Bug#63028)
2023-04-23 19:11:49 +03:00
Eli Zaretskii
965c5e0231 Fix rendering of Traditional Mongolian script
* lisp/international/characters.el: Set punctuation syntax for Po
characters from the Mongolian block
* lisp/international/fontset.el (setup-default-fontset): Add
fontset setting for Traditional Mongolic.
* lisp/language/misc-lang.el (composition-function-table): Add
rules for Traditional Mongolic.  (Bug#63028)
2023-04-23 17:04:56 +03:00
Michael Albinus
2e85ac2b27 Add new Tramp method "flatpak"
* doc/misc/tramp.texi (Inline methods): Add flatpak.

* etc/NEWS: Add new Tramp method "flatpak".  Fix typos.

* lisp/net/tramp-container.el (tramp-flatpak-program): New defcustom.
(tramp-flatpak-method): New defconst.
(tramp-flatpak--completion-function): New defun.  Set it for "flatpak".
(tramp-methods) <flatpak>: Add.
(tramp-container-connection-local-default-flatpak-variables):
New defconst.  Set respective connection-local variables.
2023-04-23 13:37:39 +02:00
Eli Zaretskii
9a0f10b5f8 Fix line-number-at-pos when POSITION is out of narrowing
* src/fns.c (Fline_number_at_pos): Don't signal an error when
ABSOLUTE is nil and POSITION is outside of the narrowing, like the
original Lisp implementation did.  Minor speedup by using the byte
position where it is available from the get-go.  (Bug#62857)
2023-04-22 19:27:16 +03:00
Eli Zaretskii
4e0f4292aa ; * etc/tutorials/TUTORIAL: Fix punctuation. 2023-04-22 13:40:57 +03:00
Eli Zaretskii
dec2ac0c65 Fix exiting Emacs after saving a tutorial
* lisp/tutorial.el (tutorial--starting-point): Make it
permanent-local, so that saving the tutorial to some file doesn't
kill this buffer-local variable.  Otherwise, trying to exit Emacs
after saving the tutorial will signal an error, because
'tutorial--starting-point' is void.  (Bug#37326)
2023-04-22 13:35:36 +03:00
kobarity
3badd2358d Improve docstring of python-indent-def-block-scale
* lisp/progmodes/python.el (python-indent-def-block-scale): Improve
docstring.  (Bug#62696)
2023-04-22 12:30:25 +03:00
Eli Zaretskii
c14a41c24c ; * etc/NEWS: Fix last change. (Bug#62696) 2023-04-22 12:29:55 +03:00
kobarity
711e8bc717 Add a new user option in Python mode to improve the indentation
* lisp/progmodes/python.el (python-indent-block-paren-deeper): New
user option.
(python-indent-context): Add a new context :inside-paren-from-block.
(python-indent--calculate-indentation): Modify according to
`python-indent-block-paren-deeper' and :inside-paren-from-block.
* test/lisp/progmodes/python-tests.el
(python-indent-inside-paren-block-1)
(python-indent-inside-paren-block-2)
(python-indent-inside-paren-block-3)
(python-indent-inside-paren-block-4): New tests.
(python-indent-inside-paren-5, python-indent-dedenters-8): Modify
according to the new context.
* etc/NEWS: Document the new user option.  (Bug#62696)
2023-04-22 12:28:37 +03:00
Eli Zaretskii
2f013c46f7 Merge from origin/emacs-29
44145bf07e Add indentation style setting for c-ts-mode in .dir-local...
e7db6c59cc ; * .dir-locals.el (c-ts-mode): Add settings.
d041f01b02 ; Minor fix in Emacs Lisp Intro manual
2023-04-22 04:56:57 -04:00
Mattias Engdegård
e6ca5834a6 Improved nconc and append compiler optimisations
Add the transforms:

  (nconc) -> nil
  (nconc X) -> X

and for arguments to `nconc`:

  nil -> <elided>
  (list X...) (list Y...) -> (list X... Y...)
  (list X) Y -> (cons X Y)

* lisp/emacs-lisp/byte-opt.el (byte-optimize-nconc): New.
(byte-optimize-append): Fix minor flaws and generalise.
2023-04-22 09:47:23 +02:00
Eli Zaretskii
44145bf07e Add indentation style setting for c-ts-mode in .dir-locals.el
* lisp/progmodes/c-ts-mode.el (c-ts-indent-style-safep): New
predicate.
(c-ts-mode-indent-style): Use it to test the value for being safe.

* .dir-locals.el (c-ts-mode): Set 'c-ts-mode-indent-style' to 'gnu'.
2023-04-22 09:41:50 +03:00
Dmitry Gutov
4f3dae2b0d project--read-project-buffer: Fixup default-directory if needed
* lisp/progmodes/project.el (project--read-project-buffer):
Make sure that when the read buffer is new, its default-directory
belongs to the project (bug#62974).
2023-04-22 02:27:34 +03:00
Yuan Fu
42def8422f
; * etc/NEWS: Mention the new symbol images. 2023-04-21 13:49:39 -07:00
Eli Zaretskii
e7db6c59cc ; * .dir-locals.el (c-ts-mode): Add settings. 2023-04-21 20:54:15 +03:00
Eli Zaretskii
d041f01b02 ; Minor fix in Emacs Lisp Intro manual
* doc/lispintro/emacs-lisp-intro.texi (what-line): Fix punctuation
and wording.  Reported by Holger Kienle <hkienle@posteo.de>.
(Bug#62998)
2023-04-21 19:16:52 +03:00
Eli Zaretskii
f1ce49d148 Merge from origin/emacs-29
3899acbb33 ; * src/fringe.c: Fix description of large circle.  (Bug#...
2b10e1827d sql: add missing postgresql types
9ac1259278 Fix display of menu-bar bindings of commands in *Help* bu...
ecdd3a9efa Improve Completion Example section in the Emacs manual
626e1ac62b Improve 'message-server-alist' docstring
327986936c Add index entry for fallback modes
1c4783c330 ; * etc/NEWS: Copyedits and grammar fixes.
3d6f755331 xref-search-program-alist: Fix searching larger file list...
1b8b2cf61b Fix typo and inaccuracy in the ELisp Reference manual
df17682ebf ; Support 'dart-ts-mode' in Eglot
e0dc60e078 ; Fix typos in gdb-mi.el
60560cc7ad Fix description of lexical environment's internals
1456adf424 ; Eglot: fix a typo in a customization type
2f59595f5f ; * etc/NEWS: Grammar fixes.
596b780ab7 Update to Org 9.6.4-2-g0f6ae7
a0b04a2247 Documentation copyedits for 'package-install-upgrade-buil...
580d8278c5 Allow upgrading built-in packages with 'package-install'
329304c23f ; * src/term.c (init_tty): Fix last change.  (Bug#62877)
200dbf7d30 Minor changes in c-ts-mode.el's support of DEFUNs
9686b015a0 Fix strike-through attribute support on TTY frames
39035fbfc5 Avoid crashes in 'describe-keymap' due to shadowing

# Conflicts:
#	etc/NEWS
#	lisp/progmodes/c-ts-mode.el
#	lisp/progmodes/eglot.el
2023-04-21 07:29:14 -04:00
Jim Porter
4416262f59 Add Git hooks to check filenames listed in the commit message
See <https://lists.gnu.org/archive/html/emacs-devel/2023-04/msg00274.html>.

* build-aux/git-hooks/commit-msg-files.awk:
* build-aux/git-hooks/post-commit:
* build-aux/git-hooks/pre-push: New files...
* autogen.sh: ... add them.
2023-04-20 21:40:02 -07:00
Stefan Monnier
c4e038c7be * lisp/emacs-lisp/gv.el: Silly typo 2023-04-20 15:51:44 -04:00
Eli Zaretskii
3899acbb33 ; * src/fringe.c: Fix description of large circle. (Bug#62961) 2023-04-20 13:06:24 +03:00
Ruijie Yu
fd4c9246fc Handle modifications in extensionless zip files (bug#61326)
* lisp/arc-mode.el (archive-*-write-file-member)
(archive-*-expunge): Refactor to correctly modify
extensionless zip archives.
(archive-expunge): Move implementation to a separate helper
function to facilitate testing.
(archive--act-files): New helper function to wrap around
`call-process' calls.
(archive--need-rename-p): New helper function to check whether
a temporary rename is necessary.
(archive--ensure-extension) (archive--maybe-rename): New helper
functions to rename archive if the caller deems it necessary.
(archive--with-ensure-extension): New helper function to handle
writing an archive while ensuring extensionless archives work
correctly by temporarily renaming them.

* test/lisp/arc-mode-tests.el (arc-mode-test-zip-ensure-ext):
New regression test for bug#61326.
2023-04-20 12:26:05 +03:00
Eli Zaretskii
e0c8e4f12f ; Minor fixes for user-facing text in last vc-cvs.el changes
* lisp/vc/vc-cvs.el (vc-cvs-repository-hostname)
(vc-cvs-parse-root): Fix doc strings, text of messages, and use of
"pathname".  (Bug#62693)
2023-04-20 11:53:32 +03:00
Nicolas Martyanoff
2b10e1827d sql: add missing postgresql types
* lisp/progmodes/sql.el: Add multiple missing PostgreSQL types: bigserial,
smallserial, macaddr8, jsonb, jsonpath, built-in range types, object
identifier types (oid & co).
2023-04-20 10:50:04 +03:00
Yuan Fu
cc0f9389b8
Fix treesit-install-language-grammar for non-interactive call
A continuation of bug#62704.

* lisp/treesit.el (treesit-install-language-grammar): Differentiate
between interactive and non-interactive call, and don't prompt when
it's called non-interactively.
2023-04-19 16:25:48 -07:00
Eli Zaretskii
9ac1259278 Fix display of menu-bar bindings of commands in *Help* buffers
* lisp/help-fns.el (help-fns--insert-menu-bindings): Propertize
with 'help-key-binding' face only the menu items, not the arrows
between successive items.  This is because 'char-displayable-p' is
unreliable when we propertize the character with an arbitrary
face: that face could specify a font which doesn't support the
character after all, while 'char-displayable-p' assumes there are
no restrictions on fonts that can be used for displaying the
character.  Also, make the code more efficient by avoiding the
call to 'char-displayable-p' inside the loop.
2023-04-19 20:46:40 +03:00
Eli Zaretskii
a01528c950 ; * src/fns.c (assq_no_signal): Fix a typo in a comment. 2023-04-19 19:30:55 +03:00
Spencer Baugh
ecdd3a9efa Improve Completion Example section in the Emacs manual
This can be a useful substitute for full-on fuzzy completion, as
provided by other completion styles and completion packages.
* doc/emacs/mini.texi (Completion Example): Give an example of
completion with point not at end of minibuffer.  Also, use
@kbd{@key{TAB}} when telling the user to hit TAB.  (Bug#62836)
2023-04-19 15:21:37 +03:00
Robert Pluim
626e1ac62b Improve 'message-server-alist' docstring
* lisp/gnus/message.el (message-server-alist): Fix typo and clarify
what happens if there is already an X-Message-SMTP-Method header.
2023-04-19 12:33:18 +02:00
Robert Pluim
327986936c Add index entry for fallback modes
* doc/emacs/custom.texi (Specifying File Variables): Add index for
'fallback modes'.
2023-04-19 12:29:57 +02:00
Robert Pluim
c279d65199 ; Double space at end of sentence for vc-cvs.el
* lisp/vc/vc-cvs.el (vc-cvs-repository-hostname, vc-cvs-parse-root)
(vc-cvs-parse-status, vc-cvs-after-dir-status): Double space at end of
sentence.
* test/lisp/vc/vc-cvs-tests.el: Double space at end of sentence.
2023-04-19 10:03:28 +02:00
Robert Pluim
1c4783c330 ; * etc/NEWS: Copyedits and grammar fixes. 2023-04-19 08:38:44 +02:00
Olivier Certner
9a2c723f1b VC: Allow `vc-default-revert' (and CVS) to revert a missing file
* lisp/vc/vc.el (vc-default-revert): Fix reverting a missing file case
by not trying to create a backup through `copy-file'.  Notably impacts
CVS, where `vc-cvs-revert' calls `vc-default-revert'.
2023-04-19 03:47:20 +03:00
Olivier Certner
648f58294b VC: CVS: Fix parsing of 'cvs -qn update' for missing files for 1.12
* lisp/vc/vc-cvs.el (vc-cvs-after-dir-status): Fix the name reported
for missing files in the case of CVS 1.12.3+ where name is quoted in
the warning line (it was not before this version).  Use instead the
following U line, where the name is never quoted on all versions.
2023-04-19 03:47:20 +03:00
Olivier Certner
7a921b6b28 VC: CVS: Fix "Root" file parsing
The new "Root" file parsing has been based on CVS' documentation,
which gives the following format for *remote* repositories:
[:method:][[user][:password]@]hostname[:[port]]/pathname/to/repository
and for local ones:
:local:/pathname/to/repository
or
:local:c:/pathname/to/repository
or alternatively ':local:' replaced by ':fork:', or ':local:' omitted
when the path starts with a slash.

[The actual parsing code in CVS is actually a bit more restrictive.
See 'root.c'.]

Most notably, the previous version could not parse an absolute
pathname without an explicit :local: method or :pserver: lines with
passwords.

* lisp/vc/vc-cvs.el (vc-cvs-parse-root): Rewrite.

(vc-cvs-repository-hostname): Cope with `vc-cvs-parse-root' returning
an empty hostname (can only happen if the "Root" file is invalid),
returning nil in this case.

(vc-cvs-parse-uhp): Remove this standalone function formerly used only
by `vc-cvs-parse-root' and which doesn't allow correct parsing anyway.

* test/lisp/vc/vc-cvs-tests.el: New file, with tests for common "Root"
file content.
2023-04-19 03:47:20 +03:00
João Távora
9093834d0b Eglot: unbreak activation/management of derived modes (bug#62907)
After recent changes to how LSP "languageId" is computed from major
modes and stored in the eglot-lsp-server object, the activation of the
'eglot--managed-mode' minor mode in modes _derived_ from some
major-mode mentioned in 'eglot-server-programs' was broken.

This commit restores that by introducing a new helper which uses the
same logic to provide the current-buffer's "languageId" to the server
and to discover if the server should manage the mode at all.  This
ensures the two things stay in sync.

Also, this helper uses the function 'provided-mode-derived-p' to fix
this bug#62907.

* lisp/progmodes/eglot.el (eglot--languageId): New helper.
(eglot-current-server, eglot--TextDocumentItem): Use it.
2023-04-19 00:59:17 +01:00
Dmitry Gutov
08b480e13f flymake-end-of-line-diagnostics-face: Tweak a little
* lisp/progmodes/flymake.el
(flymake-end-of-line-diagnostics-face):
Use height 0.85 and ensure the box doesn't change the line height
(https://debbugs.gnu.org/62029#86).
2023-04-19 01:57:26 +03:00
Dmitry Gutov
3d6f755331 xref-search-program-alist: Fix searching larger file lists on MS Windows
* lisp/progmodes/xref.el (xref-search-program-alist):
Add '-s 10000' to xargs' options when on Windows or DOS.
Apparently the xargs port doesn't currently know how to obey the
system-wide limits (https://debbugs.gnu.org/bug=61667#521).
2023-04-19 01:29:50 +03:00
Shynur
1b8b2cf61b Fix typo and inaccuracy in the ELisp Reference manual
* doc/lispref/loading.texi (Dynamic Modules): Fix a typo.
* doc/lispref/customize.texi (Group Definitions): Faces are also
in the 'custom-group' property of a customization group.
(Bug#62887)

Copyright-paperwork-exempt: yes
2023-04-18 15:03:32 +03:00
Eli Zaretskii
df17682ebf ; Support 'dart-ts-mode' in Eglot
* lisp/progmodes/eglot.el (eglot-server-programs): Add
'dart-ts-mode'.  Patch by Mou Tong <mou.tong@outlook.com>.
(Bug#62879)
2023-04-18 14:49:18 +03:00
Eli Zaretskii
e0dc60e078 ; Fix typos in gdb-mi.el
* lisp/progmodes/gdb-mi.el (gdbmi-bnf-result-state-configs): Fix
typos introduced while fixing bug#10580.  (Bug#62858)
2023-04-18 14:36:28 +03:00
Eli Zaretskii
60560cc7ad Fix description of lexical environment's internals
* doc/lispref/variables.texi (Lexical Binding): Update the
description of how the lexical environment is represented
internally.  (Bug#62840)
2023-04-18 14:30:28 +03:00
Idir Lankri
1456adf424 ; Eglot: fix a typo in a customization type
* lisp/progmodes/eglot.el (eglot-ignored-server-capabilities): Fix the
value associated with the tag "Go to declaration".  (Bug#62849)

Copyright-paperwork-exempt: yes
2023-04-18 14:17:25 +03:00
Basil L. Contovounesios
0d2fdf6e36 Fix verilog-diff-file-with-buffer
* lisp/progmodes/verilog-mode.el: Fix commentary to avoid implying
XEmacs defines diff-command.
(verilog-diff-file-with-buffer): Claim compatibility with Emacs 21
rather than XEmacs in commentary, since the latter does not seem to
define diff-command.  Use get-buffer in place of likely thinko
with-temp-buffer + BUFNAME + current-buffer.  Fix unused
unwind-protect: move temporary file deletion to its unwind
forms (bug#62620).  Avoid race condition between file existence
check and deletion.  Handle list-valued diff-switches.  Avoid
passing empty argument to diff-command.
2023-04-18 11:14:38 +01:00
Michael Albinus
0c99254a3d Fix :package-version in flymake.el
* lisp/progmodes/flymake.el (flymake-end-of-line-diagnostics-face)
(flymake-error-echo-at-eol, flymake-warning-echo-at-eol)
(flymake-note-echo-at-eol): Fix :package-version.
2023-04-18 11:10:12 +02:00
Andrew G Cohen
55a0504c48 * lisp/gnus/gnus-sum.el (gnus-summary-refer-thread): Fix limiting 2023-04-18 11:17:00 +08:00
Stefan Monnier
b0b968d9af * lisp/emacs-lisp/gv.el (error): Add gv-expander
This fixes incorrect expansion of (setf (case-exhaustive ..) ..),
as found for example in `elpa-admin.el`.
2023-04-17 18:15:45 -04:00
João Távora
db2d6aac30 Flymake: improve new flymake-show-diagnostics-at-end-of-line feature
* lisp/progmodes/flymake.el (flymake-end-of-line-diagnostics-face)
(flymake-error-echo-at-eol, flymake-warning-echo-at-eol)
(flymake-note-echo-at-eol): New faces
(flymake-error, flymake-warning, flymake-note): Use new faces.
(flymake--highlight-line): Rework.
(flymake-after-change-function): Rework.
2023-04-17 19:17:12 +01:00
Robert Pluim
2f59595f5f ; * etc/NEWS: Grammar fixes. 2023-04-17 12:24:30 +02:00
Yuan Fu
a46201f57e
; Fix typos in treesit.c
* src/treesit.c (treesit_traverse_validate_predicate)
(Ftreesit_node_match_p): Fix typos.
2023-04-16 20:35:45 -07:00
Yuan Fu
d005e685e1
New helper function assq_no_signal
* src/fns.c (assq_no_signal): New function.
* src/lisp.h (assoc_no_signal): Declare it.
* src/treesit.c (safe_assq): Remove function.
(treesit_traverse_get_predicate): Change safe_assq to assq_no_signal.
2023-04-16 20:33:51 -07:00
Kyle Meyer
596b780ab7 Update to Org 9.6.4-2-g0f6ae7 2023-04-16 21:13:08 -04:00
Andrew G Cohen
6c81ef4cf9 Include previous summary buffer articles in gnus thread referrals
* lisp/gnus/gnus-search.el (gnus-search-thread): Include all the
current articles along with the thread when searching outside the
current group.
2023-04-17 08:52:38 +08:00
João Távora
2d24eb69ed Eglot: guard against empty 'textDocument/documentSymbol' response
* lisp/progmodes/eglot.el (eglot-imenu): Protect against missing response.
2023-04-17 01:37:19 +01:00
Eli Zaretskii
a0b04a2247 Documentation copyedits for 'package-install-upgrade-built-in' etc
* etc/NEWS: More details about the new option
'package-install-upgrade-built-in'.

* lisp/emacs-lisp/package.el (package-install-upgrade-built-in)
(package--active-built-in-p, package-install): Doc fixes.
(Bug#62720)
2023-04-16 18:11:07 +03:00
Philip Kaludercic
580d8278c5 Allow upgrading built-in packages with 'package-install'
* etc/NEWS: Mention the change
* lisp/emacs-lisp/package.el (package--upgradable-built-in-p): Add new
predicate.
(package-install-upgrade-built-in): Add new user option to enable
feature.
(package-install): Respect new user option.
2023-04-16 15:44:26 +02:00
Mattias Engdegård
3c8167ec0f Fit symbol_redirect snugly in two bits
This allows the C compiler to do away with all default clauses when
switching on the `redirect` field.

* src/lisp.h (enum symbol_redirect): Use values in the 0..3 range,
which also matches the old comment in struct Lisp_Symbol.
(enum symbol_interned, enum symbol_redirect)
(enum symbol_trapped_write): Comment members.  Remove explicit values.
(struct Lisp_Symbol): Shrink the `redirect` member to 2 bits.
Use the correct type for the `interned` field.
Move value comments to their types.
* src/pdumper.c (dump_symbol): Update hashes.
2023-04-16 14:07:36 +02:00
Eli Zaretskii
329304c23f ; * src/term.c (init_tty): Fix last change. (Bug#62877) 2023-04-16 11:16:45 +03:00
Eli Zaretskii
200dbf7d30 Minor changes in c-ts-mode.el's support of DEFUNs
* lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-DEFUN): Renamed
from 'c-ts-mode--fontify-defun'; all callers changed.
(c-ts-mode-emacs-sources-support): Renamed from
'c-ts-mode-emacs-devel' and made into a defcustom; all users
changed.
(c-ts-mode--emacs-defun-p, c-ts-mode--emacs-defun-at-point)
(c-ts-mode--emacs-current-defun-name): Doc fixes.  (Bug#62825)
2023-04-16 11:12:39 +03:00
Eli Zaretskii
9686b015a0 Fix strike-through attribute support on TTY frames
* src/term.c (init_tty): Fix setting the strike-through capability
with "smxx".  (Bug#62265)
2023-04-16 09:19:15 +03:00
Eli Zaretskii
39035fbfc5 Avoid crashes in 'describe-keymap' due to shadowing
* src/keymap.c (describe_vector): Handle shadowing by something
other than a symbol.  (Bug#62867)
2023-04-16 08:51:22 +03:00
Eli Zaretskii
bc61a1afdd Merge from origin/emacs-29
b7023da662 Make image-map bindings available on image links
d9e96c029b * CONTRIBUTE: Fix a typo
3f71a2a0cf ; * lisp/progmodes/c-ts-mode.el (treesit-node-next-siblin...
adf9c956c2 Add to Eglot support for additional language-servers.
b3603b84bd Partial support for DEFUN in c-ts-mode (bug#62825)

# Conflicts:
#	lisp/progmodes/c-ts-mode.el
2023-04-15 13:05:04 -04:00
Eli Zaretskii
a85279f390 ; Merge from origin/emacs-29
The following commits were skipped:

14e809ddff Fix style and unwinding code in treesit.c
759cdf1e51 Catch signals produced by PRED in tree-sitter search func...
2023-04-15 13:02:06 -04:00
Eli Zaretskii
7191318b71 Merge from origin/emacs-29
864a4dc236 Fix compilation of w32.c with old MinGW system headers
a22eb9ae0f ruby-add-log-current-method: Reduce the use of 'nreverse'
17d803d0a7 Fix detection of WebP images by their signature
43290391ce ; Eglot: make version parseable by version-to-list
6e6e8b5c97 Add more documentation for the keys of `package-vc-select...
7972b76c2c ; vc-checkout: Wrap var lookup in 'bound-and-true-p'
e9fef1d70f vc-checkout: Try to use the vc-dir's backend first
372e024acc ; Fix wallpaper-tests on XFCE
7055fd8e43 Improve documentation related to 'ispell-complete-word'
61fd017abd * configure.ac: Add -lbsd on Haiku.
05971c4d9a Add menu to 'c-ts-mode' and 'c++-ts-mode'

# Conflicts:
#	lisp/progmodes/eglot.el
#	lisp/progmodes/ruby-mode.el
2023-04-15 13:02:04 -04:00
Eli Zaretskii
febf4467bd ; Merge from origin/emacs-29
The following commit was skipped:

954e2d96a9 Update manual about `sort`
2023-04-15 12:44:49 -04:00
Eli Zaretskii
709d558047 Merge from origin/emacs-29
c62afb10cf Fix wallpaper-tests on MS-Windows
f2d212c696 Fix a couple of eglot-tests
338b3718b6 Fix visiting RPM files
b4afee0319 Fix ff-quiet-mode doc
2445100d7d ; Improve documentation of 'match-buffers'
d4d0da96f0 ; Update make-tarball.txt for Emacs 29.
9b0bf694da ; Fix ldefs-boot.el.
0cb86a348c ; Update ChangeLog.4.

# Conflicts:
#	ChangeLog.4
2023-04-15 12:44:48 -04:00
Eli Zaretskii
0fe7fef54b ; Merge from origin/emacs-29
The following commit was skipped:

5e039d5a6e * lisp/ldefs-boot.el: Regenerate.
2023-04-15 12:43:41 -04:00
Eli Zaretskii
2d7f28ff2e Merge from origin/emacs-29
671abd0cc4 Merge branch 'emacs-29' of git.sv.gnu.org:/srv/git/emacs ...
2023-04-15 12:43:41 -04:00
Eli Zaretskii
3b0e77ec16 ; Merge from origin/emacs-29
The following commit was skipped:

4bc678ec9f Bump Emacs version to 29.0.90
2023-04-15 12:43:41 -04:00
Eli Zaretskii
79b5d1022f Merge from origin/emacs-29
db8f207e52 Fix some cases of incomplete code's indentation [c/c++-ts...
589959fb09 project-search: Pipe the list of files through 'file-regu...
2023-04-15 12:43:40 -04:00
Eli Zaretskii
0f7dea49d9 ; Merge from origin/emacs-29
The following commit was skipped:

2b91567bf6 Update ChangeLog and AUTHORS for Emacs 29
2023-04-15 12:43:40 -04:00
Eli Zaretskii
0f8140a57a Merge from origin/emacs-29
d6af1f1498 ; doc/lispref/windows.texi: Fix @pxref paren.
2023-04-15 12:43:40 -04:00
Eli Zaretskii
b0750baab7 ; Merge from origin/emacs-29
The following commits were skipped:

57490fff6e ; Backport: Eglot: fix misplaced parenthesis in last comm...
2a62273f3b Backport: Eglot: no more tests based on Pylsp (bug#62694)
2023-04-15 12:43:40 -04:00
Eli Zaretskii
5fecdbcd81 Merge from origin/emacs-29
5ef7ff0573 ; Start a new ChangeLog.4 file.
11126c6d30 Fix 'C-h k' for "Paste from Kill Menu" in context menus
74ddfe811f ; * doc/misc/calc.texi (Rewrites Tutorial): Fix a typo (b...
08cda286c3 Improve the documentation of the XDS support
14d1c00e80 Allow reindentation of images inserted by 'mm-inline-image'
b63a9eda01 Fix "C-h k" and "C-h c" with Paste from Kill Menu
b36c21e27d Change cursor color on NS port when it matches the face b...
96714c106b Improve documentation of image-related commands
6a2863ca01 Fix handling of sliced images
5be79fd05a ; * etc/NEWS: Announce 'cyrillic-mongolian' IM.
ca1a0fda98 ; Fix last change.
ce63462dbd Add cyrillic-mongolian input method
5880179270 ; Minor addition to the Emacs FAQ
88847dee12 Jsonrpc: don't bind inhibit-read-only to t so early
cb8c87a423 Allow active region when IM is used

# Conflicts:
#	etc/NEWS
2023-04-15 12:43:37 -04:00
Andreas Schwab
b7023da662 Make image-map bindings available on image links
* lisp/net/shr.el (shr-map): Move shr-browse-image to "M-i".
* lisp/net/eww.el (eww-image-link-keymap): Use shr-image-map.
2023-04-15 13:17:50 +02:00
Alan Mackenzie
d9e96c029b * CONTRIBUTE: Fix a typo 2023-04-15 11:00:38 +00:00
Eli Zaretskii
4c086bf295 Cleaner solution for Org version updates
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): Set org--built-in-p
non-nil, to avoid aborting the build when Org's version is bumped.
($(lisp)/org/org.elc): Remove dependencies of org-version.el, as
no longer needed.  (Bug#62762)
2023-04-15 13:47:00 +03:00
Eli Zaretskii
3f71a2a0cf ; * lisp/progmodes/c-ts-mode.el (treesit-node-next-sibling): Declare. 2023-04-15 13:12:20 +03:00
Eli Zaretskii
6ffde70063 ; * lisp/treesit.el (treesit-node-top-level): Fix typo. 2023-04-15 13:02:25 +03:00
Eli Zaretskii
112858c40f ; * doc/misc/gnus.texi (Finding the Parent): Fix whitespace. 2023-04-15 12:55:35 +03:00
Jostein Kjønigsen
adf9c956c2 Add to Eglot support for additional language-servers.
* lisp/progmodes/eglot.el (eglot-server-programs): Add
'vscode-markdown-language-server' for Markdown and
'dot-language-server' for GraphViz.  (Bug#62844)
2023-04-15 12:16:48 +03:00
Andrew G Cohen
234be3d670 Fix errors when nnselect-always-regenerate is t (bug#61539)
The group parameter nnselect-always-regenerate causes the list of
articles in the group to be generated each time it is needed. For this
to work reliably the list of articles has to be generated at the
appropriate time and to have a reproducible ordering.

* lisp/gnus/gnus-search.el (gnus-search-run-search): For nnselect
groups if the article list has not been stored, regenerate it.
* lisp/gnus/nnselect.el (nnselect-generate-artlist): Sort the
generated list of articles by RSV, group, and number.  Store the
artlist after generation. When the new optional argument INFO is
non-nil, update the group info.
(nnselect-compress-artlist, nnselect-uncompress-artlist): Preserve the
article list ordering.
(nnselect-get-artlist): Return nil when nnselect-always-regenerate is t.
(nnselect-store-artlist): Store the group active range along with the
artlist. Don't keep the artlist if nnselect-always-regenerate is t.
(nnselect-request-group): The full article list isn't needed at this
stage, only the active range.
(nnselect-retrieve-headers): Regenerate the article list if there
is no stored value. Inhibit gnus-demon while retrieving headers.
(nnselect-request-group-scan): Don't generate the article list when
nnselect-always-regenerate is t since it will be generated again later
on.
(nnselect-request-create-group): Allow the artlist to be passed as an
argument to the function. Update the group info and store the artlist.
2023-04-15 08:21:39 +08:00
Andrew G Cohen
bf986c1faf Improve gnus thread-referral
Allow thread referral to use search whenever possible, displaying the
results in the current summary buffer if possible and a new nnselect
buffer if not.

* lisp/gnus/nnimap.el (nnimap-request-thread): Obsolete function.
* lisp/gnus/gnus-search.el (gnus-search-thread): Allow detailed
specification of how/where to search. Add found articles to the
current summary buffer if possible, or create a new ephemeral nnselect
group if not.
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-search): Allow a list
of servers and groups to search.
(gnus-summary-refer-thread): Find thread-related articles by using a
backend-specific method, gnus-search, or retrieving nearby headers in
the current group.
* lisp/gnus/nnselect.el (nnselect-search-thread): Obsolete function.
(nnselect-request-thread): Allow thread referral from nnselect groups.
* doc/misc/gnus.texi (Finding the Parent): Document changes to thread
referral.
2023-04-15 08:10:04 +08:00
Yuan Fu
67ab357cdc
Support treesit-thing-settings in search functions
* src/treesit.c (safe_assq)
(treesit_traverse_get_predicate): New functions.
(treesit_traverse_validate_predicate)
(treesit_traverse_match_predicate): Support symbols.
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree)
(Ftreesit_node_match_p): Move validation down so we can pass LANGUAGE
to it.
2023-04-14 16:58:12 -07:00
Yuan Fu
00fba2a4d5
Add a recursion level limit for tree-sitter search predicates
* src/treesit.c:
(treesit_traverse_validate_predicate): Check for recursion level.
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree)
(Ftreesit_node_match_p): Update uses of
treesit_traverse_validate_predicate.
2023-04-14 16:54:25 -07:00
Yuan Fu
9f777475be
; Minor fixes in treesit.c
* src/treesit.c:
(treesit_initialized): Make static.
(treesit_find_override_name): Add check for XCAR (tail).
(Ftreesit_parser_set_included_ranges): Fix comment.

(treesit_recursion_limit): Change to a compile time
constant.
(treesit_symbol_to_c_name): Precompute the length.
(Ftreesit_pattern_expand): Use predefined symbols.
(treesit_cursor_helper)
(Ftreesit_search_subtree)
(Ftreesit_induce_sparse_tree): Update treesit_recursion_limit.
(syms_of_treesit): New symbols.
2023-04-14 16:54:25 -07:00
Yuan Fu
531b343c3c
Add treesit-thing-settings
* lisp/treesit.el (treesit--things-around)
(treesit--navigate-thing)
(treesit-thing-at-point): Update docstring.
* src/treesit.c (treesit_traverse_validate_predicate): Refer to
treesit-thing-settings.
(syms_of_treesit): Add Vtreesit_thing_settings.
2023-04-14 16:54:22 -07:00
Yuan Fu
9e5c00268e
Convert PATTERN and REGEXP to PRED in tree-sitter functions
Just changing names.

* lisp/treesit.el (treesit-beginning-of-thing):
(treesit-end-of-thing)
(treesit--things-around)
(treesit--navigate-thing)
(treesit-thing-at-point): Change REGEXP and PATTERN to PRED.
2023-04-14 15:52:31 -07:00
Yuan Fu
293029458c
Make use of the new pred shapes in treesit.el
treesit-search-forward and friends now accept more shapes for PRED,
make use of it in navigation functions.

* lisp/treesit.el (treesit-node-top-level): Use treesit-node-match-p.
(treesit--thing-unpack-pattern): Remove function.
(treesit-beginning-of-thing)
(treesit-end-of-thing): Remove PRED argument.
(treesit--things-around): Remove PRED argument, use
treesit-node-match-p.
(treesit--top-level-thing): Remove function.
(treesit--navigate-thing): Remove PRED argument.
(treesit-thing-at-point): Update docstring, don't unpack PATTERN.

* test/src/treesit-tests.el:
(treesit--ert-test-defun-navigation): Don't unpack pattern.
2023-04-14 15:52:30 -07:00
Yuan Fu
a4de6d8dd3
Add treesit-node-match-p
* src/treesit.c (Ftreesit_node_match_p): New function.
2023-04-14 15:52:30 -07:00
Yuan Fu
b3603b84bd
Partial support for DEFUN in c-ts-mode (bug#62825)
The DEFUN is hard to incorporate because it's made of two nodes rather
than one, and most tree-sitter functionalities assume a defun is one
node.  I fixed the indent-defun and add-log functionality, but
beginning/end-of-defun and imenu still don't recognize DEFUN.

* lisp/progmodes/c-ts-mode.el (c-ts-mode-emacs-devel): New variable.
(c-ts-mode--defun-name): Support DEFUN.
(c-ts-mode--defun-valid-p): Support DEFUN.
(c-ts-mode--emacs-defun-p)
(c-ts-mode--emacs-defun-at-point): New functions.
(c-ts-mode-indent-defun): Use c-ts-mode--emacs-defun-at-point.
(c-ts-mode--emacs-current-defun-name): New function.
(c-ts-mode, c++-ts-mode): Optionally setup custom defun-name function.
2023-04-14 13:09:05 -07:00
Mattias Engdegård
c60b59e04c Disallow creation of circular variable alias chains
Make `defvaralias` signal an error upon attempts to create variable
alias cycles.  This detects errors earlier and makes the alias
traversal during execution simpler and faster since no cycle detection
is needed elsewhere.
Now variable and function aliases are handled identically in these
respects.

* src/lisp.h (indirect_variable): Remove declaration.
* src/data.c (indirect_variable): Remove.
(Findirect_variable): Update doc string.  Simplify alias resolution.
(Fboundp, find_symbol_value, set_internal, default_value)
(set_default_internal, Fmake_variable_buffer_local)
(Fmake_local_variable, Fkill_local_variable, Flocal_variable_p)
(Flocal_variable_if_set_p, Fvariable_binding_locus):
* src/buffer.c (buffer_local_value):
* src/eval.c (specbind): Simplify variable alias resolution.
(Fdefvaralias): Update doc string.  Check for cycles.
* doc/lispref/variables.texi (Variable Aliases):
Mention that `defvaralias` can signal `cyclic-variable-indirection`
but `indirect-variable` cannot.
* etc/NEWS: Announce the change.
* test/src/eval-tests.el (eval-tests-defvaralias): New test.
2023-04-14 19:34:23 +02:00
Alan Mackenzie
dc842a71ed Improve C++ concept indentation.
This fixes bug #62386.

* lisp/progmodes/cc-engine.el (c-forward-over-compound-identifier): Don't
move forward over whitespace following the identifier.
(c-forward-primary-expression): Add parameter stop-at-end meaning don't move
forward over whitespace after the construct when non-nil.  Don't recognise a
primary expression when an open brace follows a parenthesized expression.
(c-forward-constraint-clause): Extracted from c-forward-c++-requires-clause.
Add parameter stop-at-end as above.
(c-forward-c++-requires-clause): New stop-at-end parameter as above.  Call the
new function c-forward-constraint-clause.
(c-forward-concept-fragment, c-looking-at-concept)
(c-in-requires-or-at-end-of-clause, c-c++-vsemi-p): New functions.
(c-guess-basic-syntax): New CASE 5A.7: "defun" open in a requires expression.
CASE 5F: Close of a non-class declaration level block: Move to earlier in the
function.
CASE 5D: Also check for being in or at end of a constraint.
New CASE 20: A C++ requires sub-clause.
New CASE 16G: The closing brace of a requires clause.
New CASE 17J: First "statement" inside a requires "function".
(c-forward-primary-expression, c-forward-declarator, c-forward-decl-or-cast-1)
(c-looking-at-or-maybe-in-bracelist): Amend the method of detecting end of
symbol "requires" (aka c-fun-name-substitute-key).

* lisp/progmodes/cc-fonts.el (c-get-fontification-context): Amend the method
of detecting end of symbol "requires".

* lisp/progmodes/cc-langs.el (c-at-vsemi-p-fn): Change the C++ entry to
c-c++-vsemi-p.
(c-fun-name-substitute-key): Change to an unadorned regexp.

* lisp/progmodes/cc-vars.el (c-offsets-alist): Add new syntactic symbol
constraint-cont.

* doc/misc/cc-mode.texi (Syntactic Symbols): Add an entry for contraint-cont.
(Constraint Symbols): New node under Syntactic Symbols.
2023-04-14 16:37:33 +00:00
Robert Pluim
7974a9349f * src/nsterm.m (check_native_fs): Add missing void arg. 2023-04-14 16:50:02 +02:00
Michael Albinus
a6a127d4d4 ; Fix typos
* etc/NEWS: Fix typos.

* lisp/progmodes/flymake.el (flymake-error-echo)
(flymake-warning-echo, flymake-note-echo)
(flymake-show-diagnostics-at-end-of-line): Fix :package-version.
2023-04-14 14:36:29 +02:00
Mattias Engdegård
f14a3cafb4 Use BASE_EQ in treesit.c
* src/treesit.c (Ftreesit_node_check, Ftreesit_pattern_expand)
(Ftreesit_query_capture, treesit_traverse_validate_predicate)
(treesit_traverse_match_predicate):
Use BASE_EQ instead of EQ where this is obviously correct.
2023-04-14 13:07:46 +02:00
Alan Mackenzie
f9d8cdbdbd Make c-emacs-features use the proper binding of parse-sexp-lookup-properties
This is relevant for bug #58558, although it does not fix it.  Due to a wrong
ordering of with-current-buffer and a let form, the function overwrote the
global value of parse-sexp-lookup-properties and two other variables.

* lisp/progmodes/cc-defs.el (c-emacs-features): Change the nesting of
with-current-buffer and let so that the let bindings get used.
2023-04-14 10:33:03 +00:00
Eli Zaretskii
14e809ddff Fix style and unwinding code in treesit.c
This was supposed to be a cherry-pick from master, but
isn't, due to the unnecessary rush to fix master without
cleaning up the mess first and without separating changes
that can and cannot be backported.
* src/treesit.c (treesit_traverse_cleanup_cursor): Fix indentation
style.
(Ftreesit_search_subtree, Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Fix specpdl unwinding.  (Bug#62823)
Do not merge to master.
2023-04-14 09:21:05 +03:00
Yuan Fu
759cdf1e51 Catch signals produced by PRED in tree-sitter search functions
Earlier we switched to using cursors rather than nodes to traverse the
parse tree.  Because cursors need cleanup, we have to catch signals
thrown by the predicate functions and free the cursor. Failing to do
this will result in leaking the cursor whenever the predicate function
signals in a search function.  This change fixes the leak.
* src/treesit.c (treesit_traverse_cleanup_cursor): New function.
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Catch signals.  (Bug#62823)

(cherry picked from commit a5eb9f6ad4)
2023-04-14 09:07:46 +03:00
Yuan Fu
d664969544
Fix tree-sitter test
* test/src/treesit-tests.el:
(treesit-search-forward-predicate-invalid-predicate): Fix test.
2023-04-13 19:18:52 -07:00
Yuan Fu
de34de3b35
Fix previous commit on tree-sitter
* src/treesit.c:
(treesit_traverse_validate_predicate): Don't accept symbols.
(treesit_traverse_match_predicate): Don't accept symbols, and use
correct variable for the regexp and pred check.

* test/src/treesit-tests.el:
(treesit-search-forward-predicate): Fix the test.
2023-04-13 18:47:41 -07:00
Andrew G Cohen
3ef54c64fa Fix and cleanup nnselect-push-info
* lisp/gnus/nnselect.el (nnselect-push-info): Don't update backend
marks when quit-config is not nil since gnus-update-marks has already
been called.  Move checking for unread articles outside the
gnus-atomic block so it may be interrupted.  Replace let* with let.
Cleanup code.
2023-04-14 08:53:12 +08:00
Po Lu
2c3ca78e81 Fix bugs in treesit.o
* src/treesit.c (treesit_traverse_match_predicate): Remove
redundant cast.
(treesit_search_forward, treesit_traverse_cleanup_cursor)
(Ftreesit_search_subtree, Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Fix coding style and specpdl
unwinding.
2023-04-14 08:01:12 +08:00
Yuan Fu
361c5fc2d8
Support more predicates in tree-sitter search functions
Right now we support regexp strings and predicate functions for the
PRED argument. This change adds support for (not ...) (or ...)
and (regexp . pred) predicates.

I still need to find a place to document the supported shapes of a
predicate.

* src/treesit.c (treesit_traverse_validate_predicate): New function.
(treesit_traverse_match_predicate): Support more predicate shapes.
(treesit_search_dfs):
(treesit_search_forward)
(treesit_build_sparse_tree): Fix docstring (unrelated to this change).
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Use the new function to validate
predicate shape.
(syms_of_treesit): New error Qtreesit_invalid_predicate.

* test/src/treesit-tests.el:
(treesit--ert-search-setup): Add edebug declaration.
(treesit-search-forward-predicate)
(treesit-search-forward-predicate-invalid-predicate): New tests.
2023-04-13 15:08:51 -07:00
Yuan Fu
a5eb9f6ad4
Catch signals produced by PRED in tree-sitter search functions
Earlier we switched to using cursors rather than nodes to traverse the
parse tree.  Because cursors need cleanup, we have to catch signals
thrown by the predicate functions and free the cursor. Failing to do
this will result in leaking the cursor whenever the predicate function
signals in a search function.

This change fixes the leak.

* src/treesit.c (treesit_traverse_cleanup_cursor): New function.
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Catch signals.
2023-04-13 15:08:51 -07:00
Yuan Fu
dff254946a
Fix tree-sitter tests
After 2ce27563ec, treesit--navigate-things takes a TACTIC argument
instead of using treesit-defun-tactic, so the tests need to change
from binding treesit-defun-tactic to passing the tactic argument,
which is what this change does.

* test/src/treesit-tests.el:
(treesit--ert-insert-and-parse-marker): New argument TACTIC.
(treesit-defun-navigation-nested-1)
(treesit-defun-navigation-nested-2)
(treesit-defun-navigation-nested-3)
(treesit-defun-navigation-top-level): Pass TACTIC argument.
2023-04-13 15:08:51 -07:00
Mattias Engdegård
80f6c1027f ; * doc/misc/flymake.texi (Customizable variables): fix broken list 2023-04-13 21:38:47 +02:00
Mattias Engdegård
6a7532cfcb Faster and less wrong cl-defsubst inlining
Always have inlining of functions defined by `cl-defsubst` let-bind
arguments instead of making incorrect guesses when it might be safe to
substitute them and then botching the substitution.

This change generally results in better and safer code for all
callers, in particular `cl-defstruct` constructors, accessors and
mutators.

* lisp/emacs-lisp/cl-macs.el (cl-defsubst): Remove outdated comment.
(cl--defsubst-expand): Simplify: always let-bind.
(cl--sublis): Remove.
(cl-defstruct): Simplify: remove old hack that is no longer needed.
2023-04-13 21:32:10 +02:00
João Távora
83b5e9cd24 Eldoc: don't overdisplay if using eldoc-documentation-compose
bug#62816

This is about a particular value for 'eldoc-documentation-strategy',
'eldoc-documentation-compose'.  Its helper
'eldoc--documentation-compose-1' was buggy.  It created the callback
for all the backends in 'eldoc-documentation-functions', but arranged
so that it could potentially be invoked immediately and trigger
display, half-defeating the purpose of the "patience" and causing
blinking in the echo area.

Now it creates all the callbacks beforehand and only then passes them
to the corresponding members of eldoc-documentation-functions.  This
sets up the correct state in eldoc--invoke-strategy.

* lisp/emacs-lisp/eldoc.el (eldoc--documentation-compose-1):
Delete.
(eldoc-documentation-compose)
(eldoc-documentation-compose-eagerly): Rework.
2023-04-13 17:42:37 +01:00
João Távora
a74403adda Eglot: fix LSP "languageId" detection
This sweeping fix has been planned for a while, but a user recently
hit this bug as described in
https://github.com/joaotavora/eglot/discussions/1206.

More and more servers today are "multi-language", meaning can handle
more than one file type.  This relies on the ':languageId' string
being set to the correct value for every buffer managed by Eglot
(TextDocumentItem in LSP parlance).

Previously this string was calculated based on an imperfect heuristic
and was wrong quite often.  Many servers don't even care but some
others do, so we have to fix it.

* lisp/progmodes/eglot.el (eglot-lsp-server): Remove slots
'major-modes' and 'language-id'.  Add slot 'languages'.
(eglot--major-modes, eglot--language-ids): New helpers.
(eglot--lookup-mode): Simplify or maybe complicate.
(eglot--guess-contact): Use new eglot--looup-mode.  Change return
value.
(eglot): Rework docstring.
(eglot-reconnect): Use eglot--language-ids, not id.
(eglot--connect): Setup eglot--languages slot in server.
(eglot--TextDocumentItem): Finally, get correct language id.

* test/lisp/progmodes/eglot-tests.el (eglot--guessing-contact):
Enhance macro.
(eglot-test-server-programs-guess-lang): Update test.
2023-04-13 17:42:37 +01:00
João Távora
d45f450cff Flymake: add new flymake-show-diagnostics-at-end-of-line option
Some editors have this.  Depending on your preference, this can either
be wildly distracting and easily confused with actual code, or a
significant early aid that relieves you from moving around or reaching
for the mouse to consult an error message.  To be safe, hide this
behind a customization variable and keep it disabled.

Personally, I find it less obstrusive and more helpful than expected.

* lisp/progmodes/flymake.el (flymake--delete-overlay): New helper.
(flymake--highlight-line): Handle flymake-show-diagnostics-at-end-of-line.
(flymake--clear-foreign-diags): Use flymake--delete-overlay.
(flymake--publish-diagnostics): Use flymake--delete-overlay.
(flymake-mode): Use flymake--delete-overlay.
(flymake-error-echo)
(flymake-warning-echo, flymake-note-echo): New faces.
(flymake-show-diagnostics-at-end-of-line): New option.
(Version): Bump to 1.3.4

* doc/misc/flymake.texi:
(Finding diagnostics): Mention flymake-show-diagnostics-at-end-of-line.
(Customizable variables): Mention
flymake-show-diagnostics-at-end-of-line and a few more relevant faces.

* etc/NEWS (Flymake): Mention flymake-show-diagnostics-at-end-of-line.
2023-04-13 17:42:37 +01:00
Mattias Engdegård
d590af749f Stronger checking in line-number-at-pos tests
* test/lisp/simple-tests.el (line-number-at-pos-keeps-restriction)
(line-number-at-pos-keeps-point): Check all return values.
2023-04-13 17:35:45 +02:00
Mattias Engdegård
abb43a6236 Stop pretending that specpdl overflow can ever occur
* src/eval.c (grow_specpdl_allocation): Remove impossible error.
* src/data.c (syms_of_data): Note obsolence of
`excessive-variable-binding`.
2023-04-13 17:25:25 +02:00
Mattias Engdegård
df4a6342fa ; reorder function effect-declaration lists
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns)
(side-effect-and-error-free-fns, pure-fns): Group by file.
2023-04-13 14:26:31 +02:00
Mattias Engdegård
feef1a0592 Update effect declarations for many built-in functions
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns)
(side-effect-and-error-free-fns, pure-fns): Add many functions.
* lisp/subr.el (copy-tree): Declare error-free.
2023-04-13 14:26:16 +02:00
Eli Zaretskii
864a4dc236 Fix compilation of w32.c with old MinGW system headers
* src/w32.c (CONSOLE_FONT_INFO): Make sure the definition is not
visible for MinGW versions whose w32api's version is before 5.2.0.
(Bug#52792)
2023-04-13 08:18:33 +03:00
Dmitry Gutov
a22eb9ae0f ruby-add-log-current-method: Reduce the use of 'nreverse'
* lisp/progmodes/ruby-mode.el (ruby-add-log-current-method):
Reduce the use of 'nreverse' (bug#62761).

* test/lisp/progmodes/ruby-mode-tests.el
(ruby-add-log-current-method-singleton-referencing-outer):
New test.
2023-04-13 00:46:11 +03:00
Stefan Monnier
861cf3a5c9 (RE_SETUP_SYNTAX_TABLE_FOR_OBJECT): Simplify
It turns out all calls to this function pass the same value
for the `count` argument, and they're all in `regexp.c`.

* src/syntax.c (RE_SETUP_SYNTAX_TABLE_FOR_OBJECT):
Rename from `SETUP_SYNTAX_TABLE_FOR_OBJECT`.  Remove `count` argument.
Move call to `RE_SYNTAX_TABLE_BYTE_TO_CHAR` to where its result is
actually used.
* src/regex-emacs.c (re_search_2, re_match_2): Adjust accordingly.

* src/syntax.h (RE_SYNTAX_TABLE_BYTE_TO_CHAR): Rename from
`SYNTAX_TABLE_BYTE_TO_CHAR` to clarify that it takes a byteoffset as
used in the regexp engine and not a "bytepos".  Adjust all callers.
2023-04-12 16:32:39 -04:00
Stefan Monnier
c2c3114961 (SETUP_SYNTAX_TABLE_FOR_OBJECT): Take a byteoffset
* src/syntax.c (SETUP_SYNTAX_TABLE_FOR_OBJECT): Take a byteoffset.
* src/regex-emacs.c (re_search_2, re_match_2): Simplify accordingly.
2023-04-12 15:50:49 -04:00
Stefan Monnier
d53ff9fe28 src/regex-emacs.c (POS_AS_IN_BUFFER): Delete macro
That macro added 1 to buffer positions because:

    Strings are 0-indexed, buffers are 1-indexed

but the reality is that this 1 was added to the regexp engine's "byte
offsets" which are not 1-based byte positions as used throughout
the rest of Emacs, but they are BEGV_BYTE-relative offsets, so the two
did not cancel out.

* src/regex-emacs.c (PTR_TO_OFFSET, POS_AS_IN_BUFFER): Delete macros;
use `POINTER_TO_OFFSET` instead.
(re_search_2, re_match_2, re_match_2_internal): Adjust accordingly.
* src/syntax.h (SYNTAX_TABLE_BYTE_TO_CHAR): Don't remove 1 from buffer
byteoffsets now that `POS_AS_IN_BUFFER` doesn't add it any more.
2023-04-12 15:44:58 -04:00
Stefan Monnier
1e6463ad22 (struct gl_state_s): Delete offset field
`gl_state` had an `offset` field because:

    For buffers, regex-emacs.c passes arguments to the
    UPDATE_SYNTAX_TABLE functions which are relative to BEGV

but the reality is that these arguments are byte offsets relative to
BEGV_BYTE whereas `offset` was counted in chars, so the two didn't
cancel each other out.

* src/syntax.h (struct gl_state_s): Delete `offset` field.
(UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD)
(SYNTAX_TABLE_BYTE_TO_CHAR):
* src/syntax.c (SETUP_SYNTAX_TABLE, SETUP_SYNTAX_TABLE_FOR_OBJECT)
(update_syntax_table, skip_syntaxes): Simplify accordingly.
2023-04-12 15:20:07 -04:00
Visuwesh
17d803d0a7 Fix detection of WebP images by their signature
* lisp/image.el (image-type-header-regexps): The 4 characters
between "RIFF" and "WEBP" in WebP images can also be newlines.
(Bug#62790)
2023-04-12 20:04:26 +03:00
João Távora
8fdd7710ec Flymake: futher enhance echo-area appearance of diagnostics
Also describe new 'echo-face' property in the Flymake manual, and fix
it's mistaken mention of a non-existing 'flymake-severity' property.

* doc/misc/flymake.texi:
(Flymake error types): Describe new properties and correct mention
of 'severity' property.

* lisp/progmodes/flymake.el:
(flymake-diagnostic-oneliner): Rework.
(flymake-error, flymake-warning, flymake-note): Add new 'echo-face' property.
(flymake--highlight-line)
(flymake-eldoc-function)
(flymake--tabulated-entries-1): Use flymake-diagnostic-oneliner
(Version): Bump to 1.3.3
2023-04-12 14:41:35 +01:00
João Távora
43290391ce ; Eglot: make version parseable by version-to-list
* lisp/progmodes/eglot.el (Version): Correct version.
2023-04-12 13:08:14 +01:00
Mattias Engdegård
9d025eab24 byte-code-function-p is error-free
* lisp/emacs-lisp/byte-opt.el
(side-effect-free-fns, side-effect-and-error-free-fns):
Upgrade `byte-code-function-p` to error-free status.
2023-04-12 10:47:43 +02:00
Mattias Engdegård
ea9831bb3c Better compilation of arguments to ignore
* lisp/emacs-lisp/bytecomp.el (byte-compile-form)
(byte-compile-ignore):
Instead of compiling each `ignore` argument for value which is then
immediately discarded, compile it for effect but suppress
ignore-return-value warnings by passing the special value
`for-effect-no-warn` as for-effect parameter.
Proposed by Stefan Monnier.
2023-04-12 10:47:42 +02:00
Earl Hyatt
6e6e8b5c97 Add more documentation for the keys of package-vc-selected-packages.
* doc/emacs/package.texi (Specifying Package Sources): List the
accepted keys in a new subsection of Fetching Package Sources.

* lisp/emacs-lisp/package-vc.el (package-vc-selected-packages):
Mention the `:doc` key.  Add the `:doc` key to the Customize form,
mention the new Info node, correct "TexInfo" to "Texinfo", avoid
Git-specific terms for the description of `:branch`, mention guessing
`:vc-backend` based on the URL.
2023-04-12 09:45:52 +02:00
Yuan Fu
c146bd893d
Prompt target dir in treesit-install-language-grammar (bug#62704)
* lisp/treesit.el (treesit--check-repo-url): New variable.
(treesit-install-language-grammar): Prompt for target directory.
2023-04-12 00:02:21 -07:00
Yuan Fu
1a5a03c15a
Define sexp in c-ts-mode more broadly (bug#62302)
* lisp/progmodes/c-ts-mode.el: Define sexp in c/c++-ts-mode as
anything but delimiters.
2023-04-12 00:02:21 -07:00
Yuan Fu
2ce27563ec
Add 'restricted' tactic in tree-sitter navigation functions
* lisp/treesit.el (treesit-forward-sexp): Add docstring.  Use
'restricted' tactic.
(treesit-transpose-sexps): Fix docstring.
(treesit-beginning-of-thing)
(treesit-end-of-thing): Add support for TACTIC.
(treesit-beginning-of-defun)
(treesit-end-of-defun): Supply treesit-defun-tactic as TACTIC.
(treesit--navigate-thing): Add support for TACTIC.  Wrap the old form
in a new (if (eq tactic 'restricted) (new-code) (old-form)), and
supply the TACTIC parameter when recursing.
2023-04-12 00:02:20 -07:00
Andrew G Cohen
e54feef094 Expunge immediately when moving articles from nnimap groups
* lisp/gnus/nnselect.el (nnselect-request-move-article): Set
nnimap-expunge to immediately.
2023-04-12 08:19:17 +08:00
Dmitry Gutov
b3a44ff324 ruby-ts-mode: Do not treat parenless calls' args as separate sexp
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--sexp-p): New function.
(ruby-ts-mode): Use it in treesit-sexp-type-regexp (bug#62086).
2023-04-12 02:28:02 +03:00
Dmitry Gutov
7972b76c2c ; vc-checkout: Wrap var lookup in 'bound-and-true-p' 2023-04-12 02:03:14 +03:00
Dmitry Gutov
e9fef1d70f vc-checkout: Try to use the vc-dir's backend first
* lisp/vc/vc.el (vc-checkout): Try to use the vc-dir's backend
before looking for the file's one.  The latter doesn't work when
the file doesn't exist on disk yet (bug#62674).
2023-04-11 22:59:45 +03:00
Eli Zaretskii
372e024acc ; Fix wallpaper-tests on XFCE
* test/lisp/image/wallpaper-tests.el
(wallpaper--find-command-args/return-list): Account for
command-args being a function.  (Bug#62673)
2023-04-11 17:47:48 +03:00
Eli Zaretskii
7055fd8e43 Improve documentation related to 'ispell-complete-word'
* lisp/textmodes/ispell.el (ispell-alternate-dictionary)
(ispell-complete-word-dict, ispell-complete-word): Doc fixes.
(Bug#62775)
2023-04-11 16:24:13 +03:00
João Távora
5609504685 Flymake: take advantage of new Eldoc options
Only echo the first line of a potentially very large error message.

* lisp/progmodes/flymake.el:
(flymake-diagnostic-oneliner): New helper.
(flymake--tabulated-entries-1)
(flymake-eldoc-function): Use it.
(Version): Bump to 1.3.2.
(Package-Requires): Use Eldoc 1.14.0.
2023-04-11 13:35:43 +01:00
Po Lu
61fd017abd * configure.ac: Add -lbsd on Haiku. 2023-04-11 20:08:12 +08:00
Eli Zaretskii
05971c4d9a Add menu to 'c-ts-mode' and 'c++-ts-mode'
* lisp/progmodes/c-ts-mode.el (c-ts-mode-menu): New menu.
2023-04-11 13:37:25 +03:00
Mattias Engdegård
fb66e4d58b nndiary.el: fix dodgy schedule code
* lisp/gnus/nndiary.el (nndiary-last-occurrence):
Don't sort a list and throw away the result because that leaves the
list variable in an undefined state.  Just take the largest element
because that was obviously what the author meant.
2023-04-11 11:57:07 +02:00
Mattias Engdegård
5dab172a17 allout.el: fix subtree expose numbering bug
* lisp/allout.el (allout-process-exposed): Reverse the list of indices
properly so that the correct numbering for nodes in a subtree is used.
Avoid destructive reversing; the list may be a constant (literal).
This flaw was revealed by an ignored-return-value warning.
2023-04-11 11:50:17 +02:00
Mattias Engdegård
954e2d96a9 Update manual about sort
* doc/lispref/sequences.texi (Sequence Functions):
Remove inaccurate and over-specific claims about how `sort` works for
lists: there is no guarantee that it doesn't modify the `car` fields
of the input list (which is precisely what it does at this time).

(cherry picked from commit c753a95923)
2023-04-11 10:12:15 +02:00
Eli Zaretskii
c62afb10cf Fix wallpaper-tests on MS-Windows
* test/lisp/image/wallpaper-tests.el (wallpaper--find-setter)
(wallpaper--find-setter/call-predicate)
(wallpaper--find-setter/set-current-setter)
(wallpaper-set/calls-init-action)
(wallpaper-set/calls-wallpaper-set-function)
(wallpaper-set/runs-command, wallpaper-set/runs-command/detach):
Skip these tests if native functions are used for changing
wallpaper.  These tests are irrelevant in that case.
2023-04-11 10:33:32 +03:00
Basil L. Contovounesios
f2d212c696 Fix a couple of eglot-tests
* test/lisp/progmodes/eglot-tests.el
(eglot-test-rust-analyzer-watches-files): Bump timeout.
(eglot-test-json-basic): Check for yas-minor-mode before using it,
like other tests do (bug#61637).
2023-04-11 07:40:15 +01:00
Antero Mejr
ebac67129e eshell: Add 'rgrep' builtin
* lisp/eshell/em-unix.el (eshell/rgrep): New function.
(eshell-unix-initialize): Add "rgrep" to 'eshell-complex-commands'.

* etc/NEWS: Add NEWS entry for rgrep.

* doc/misc/eshell.texi (Built-ins): Add documentation for rgrep.
2023-04-10 21:00:17 -07:00
Andrew G Cohen
0724e0aeb5 * lisp/gnus/nnselect.el (nnselect-push-info): Sort artlist 2023-04-11 10:55:45 +08:00
Stefan Monnier
54d40577c4 (org-table-make-reference): Fix compiler warning
* lisp/org/org-table.el (org-table-make-reference): Don't use `eq` to
compare against literal strings.
2023-04-10 21:33:56 -04:00
Spencer Baugh
9efa6d2cf2 Add support for prompting for projects by name
* lisp/progmodes/project.el (project-prompter):
New user option (bug#62759).
(project-prompt-project-name): New function.
2023-04-11 02:14:57 +03:00
Dmitry Gutov
2d3947ba7a html-ts-mode--indent-rules: Use 'column-0' instead of 'point-min'
* lisp/textmodes/html-ts-mode.el (html-ts-mode--indent-rules):
Use 'column-0' instead of 'point-min' (bug#62752).
2023-04-11 00:24:33 +03:00
F. Jason Park
7c034f65fd Take better care when setting margins in erc-stamp
* lisp/erc/erc-stamp.el (erc-stamp--adjust-right-margin,
erc-stamp--display-margin-mode): Prefer setting
`fringes-outside-margins' to hiding right margin, and check whether
current buffer is showing before adjusting anything.  (Bug#60936.)
2023-04-10 13:42:29 -07:00
Mattias Engdegård
cb4f4dd891 Don't use mapconcat for effect
* lisp/progmodes/make-mode.el (makefile-browser-fill):
* lisp/url/url-mailto.el (url-mailto):
Use `mapc` instead of `mapconcat`.
2023-04-10 15:20:27 +02:00
Mattias Engdegård
119a7dd220 ebnf2ps: eliminate double nreverse
* lisp/progmodes/ebnf-otz.el (ebnf-split-suffix): Simplify code that
relied on a rather inobvious in-place reversal of a list twice for
correctness, silencing a byte-compiler warning.
2023-04-10 15:12:01 +02:00
Eli Zaretskii
338b3718b6 Fix visiting RPM files
We cannot call 'sh-set-shell' inside 'sh-base-mode', since various
settings of 'sh-mode', in particular the syntax table, is not yet
set.  Likewise with various hooks: since 'sh-base-mode' is not a
mode any file should be visited with, it makes no sense to set up
stuff like 'hack-local-variables-hook' in 'sh-base-mode'; it
should be set in the descendant modes instead.
* lisp/progmodes/sh-script.el (sh-base-mode): Move the call to
'sh-set-shell' from here...
(sh-mode): ...to here...
(bash-ts-mode): ...with a copy here.  (Bug#62748)
2023-04-10 16:09:58 +03:00
Basil L. Contovounesios
b4afee0319 Fix ff-quiet-mode doc
* lisp/find-file.el (ff-quiet-mode, ff-find-other-file): Say that
ff-quiet-mode disables tracing, not the inverse.
2023-04-10 13:49:32 +01:00
Basil L. Contovounesios
ab8153b3bb Clarify process-environment in eglot-tests
* test/lisp/progmodes/eglot-tests.el (eglot--call-with-fixture):
Clarify commentary (bug#61637).  Use null-device and briefer syntax.
2023-04-10 11:03:33 +01:00
Basil L. Contovounesios
ba7ef9699f End default-directory with slash in eglot-tests
* test/lisp/progmodes/eglot-tests.el (eglot--call-with-fixture):
Separate prefix from random part of temporary file name.  Ensure
default-directory ends with a directory separator (bug#61637).
2023-04-10 11:03:33 +01:00
Mattias Engdegård
3faf43137a ; Eliminate warning when dired-map-over-marks value is unused
* lisp/dired.el (dired-map-over-marks): Reformulate.
2023-04-10 11:45:09 +02:00
Mattias Engdegård
c753a95923 Update manual about sort
* doc/lispref/sequences.texi (Sequence Functions):
Remove inaccurate and over-specific claims about how `sort` works for
lists: there is no guarantee that it doesn't modify the `car` fields
of the input list (which is precisely what it does at this time).
2023-04-10 11:45:09 +02:00
Eli Zaretskii
2445100d7d ; Improve documentation of 'match-buffers'
* doc/lispref/buffers.texi (Buffer List):
* lisp/subr.el (match-buffers): Fix documentation of
'buffer-match-p' and 'match-buffers'.
2023-04-10 12:30:23 +03:00
Basil L. Contovounesios
44cc54e409 Tweak file/dir creation in eglot-tests
* test/lisp/progmodes/eglot-tests.el (eglot--make-file-or-dir):
Expand file name only once, under default-directory, avoiding
duplicate dir separators.  Ensure default-directory ends with a dir
separator.  Use with-temp-file.  (Bug#61637)
2023-04-10 10:23:06 +01:00
Eli Zaretskii
d4d0da96f0 ; Update make-tarball.txt for Emacs 29. 2023-04-10 10:31:44 +03:00
Eli Zaretskii
9b0bf694da ; Fix ldefs-boot.el. 2023-04-10 01:54:17 -04:00
Eli Zaretskii
0cb86a348c ; Update ChangeLog.4. 2023-04-10 01:44:40 -04:00
Eli Zaretskii
5e039d5a6e * lisp/ldefs-boot.el: Regenerate. 2023-04-10 01:42:05 -04:00
Eli Zaretskii
671abd0cc4 Merge branch 'emacs-29' of git.sv.gnu.org:/srv/git/emacs into emacs-29
Pull in latest changes.
2023-04-10 01:17:26 -04:00
Eli Zaretskii
4bc678ec9f Bump Emacs version to 29.0.90
* README:
* configure.ac:
* nt/README.W32:
* msdos/sed2v2.inp: Bump version to 29.0.90.
2023-04-10 01:15:30 -04:00
Dmitry Gutov
db8f207e52 Fix some cases of incomplete code's indentation [c/c++-ts-mode]
* lisp/progmodes/c-ts-mode.el (c-ts-base--before-indent): Try to
guess when the parse tree is incomplete, and provide a better node
to indent against (bug#62717).
(c-ts-base-mode): Set up advice for local treesit-indent-function.
2023-04-10 02:58:46 +03:00
Basil L. Contovounesios
b5c5e923db Simplify let-bindings in eglot-tests
* test/lisp/progmodes/eglot-tests.el (eglot--call-with-fixture):
Don't allow fixture elements to be symbol-value pairs (bug#61637).
This feature was used in only one test.  The same effect can be
achieved in a simpler way, and closer to the body, with plain
let-bindings.
(eglot--with-fixture): Adapt docstring accordingly.
(eglot-test-ensure): Adapt c-mode-hook binding accordingly.
(eglot--cleanup-after-test): Remove symbol restoring logic.
2023-04-10 00:33:13 +01:00
Basil L. Contovounesios
f09f571b3c Minor eglot-tests cosmetics
* test/lisp/progmodes/eglot-tests.el:
(eglot--eldoc-on-demand, eglot--tests-force-full-eldoc)
(eglot-test-multiline-eldoc, eglot-test-rust-on-type-formatting)
(eglot-test-path-to-uri-windows): Fix headings, commentary, and
indentation (bug#61637).
2023-04-10 00:18:15 +01:00
Dmitry Gutov
589959fb09 project-search: Pipe the list of files through 'file-regular-p'
* lisp/progmodes/project.el (project-search): Pipe the list of
files through 'file-regular-p' to skip directories (bug#62735).
2023-04-10 02:09:45 +03:00
Basil L. Contovounesios
6674ac17eb Avoid Git project in eglot-test-eclipse-connect
* test/lisp/progmodes/eglot-tests.el (eglot-test-eclipse-connect):
Avoid creating a Git project, which subsequently confuses
project-files (bug#62741).
2023-04-09 23:32:14 +01:00
Basil L. Contovounesios
48f3bfb8b9 Tweak ert-remote-temporary-file-directory in tests
* lisp/emacs-lisp/ert-x.el (ert-remote-temporary-file-directory):
Don't add trailing slash to HOME (bug#61637).  Reindent docstring.
2023-04-09 20:28:32 +01:00
Eli Zaretskii
2b91567bf6 Update ChangeLog and AUTHORS for Emacs 29
* admin/authors.el: Update for Emacs 29.

* etc/AUTHORS: Re-generate for Emacs 29.

* ChangeLog.4: New generated file.
* Makefile.in (PREFERRED_BRANCH): Update to emacs-29.
(CHANGELOG_HISTORY_INDEX_MAX): Bump to 4.
2023-04-09 15:27:52 -04:00
Basil L. Contovounesios
d6af1f1498 ; doc/lispref/windows.texi: Fix @pxref paren. 2023-04-09 19:08:06 +01:00
Basil L. Contovounesios
9037159c47 Pacify byte-compiler warnings in nadvice-tests
* test/lisp/emacs-lisp/nadvice-tests.el
(advice-test-called-interactively-p)
(advice-test-called-interactively-p-around)
(advice-test-called-interactively-p-filter-args)
(advice-test-call-interactively): Heed advertised-calling-convention
of called-interactively-p to pacify byte-compiler warnings.
2023-04-09 19:03:10 +01:00
Michael Albinus
2347b102af Adapt Tramp test
* test/lisp/net/tramp-tests.el (tramp-test09-insert-file-contents):
Adapt test.
2023-04-09 18:51:21 +02:00
Mattias Engdegård
6157e3e4bc Extend ignored-return-value warning to more functions (bug#61730)
Warn when the return value of certain functions is unused.  Previously
this was only done for side-effect-free functions, and for `mapcar`.

These are functions where the return value is important for correct
usage or where ignoring it is likely to indicate a mistake.  The exact
set of functions is tentative and will be modified as we gain a better
understanding of which ones to include.

The current set comprises higher order functions such as `mapcar`
which are not primarily called for the effects of their function
arguments, and list-mutating functions like `nreverse` whose return
value is essential.

* lisp/emacs-lisp/bytecomp.el (byte-compile-form): Add list of
functions to warn about when their value is ignored.
* etc/NEWS: Announce.
2023-04-09 18:23:05 +02:00
Mattias Engdegård
4f0849a9e6 Remove unused values in effect context
* lisp/net/eudcb-mab.el (eudc-mab-query-internal):
* lisp/org/ob-core.el (org-babel-insert-result):
* lisp/progmodes/prolog.el (prolog-smie-forward-token)
(prolog-smie-backward-token):
Silence ignored-return-value warnings about calls to side-effect-free
functions in the last clause of `cond` statements whose values are
unused.
2023-04-09 16:45:40 +02:00
Mattias Engdegård
48ff93ba18 Adjust side-effect-free declarations
* lisp/emacs-lisp/byte-opt.el (side-effect-and-error-free-fns):
Add `eql` here.
* lisp/emacs-lisp/cl-macs.el (eql, cl-subst, cl-sublis):
Don't set the `side-effect-free` property here.
`cl-subst` and `cl-sublis` are not side-effect-free.
* lisp/emacs-lisp/cl-extra.el (cl-revappend):
Declare side-effect-free.
* lisp/emacs-lisp/cl-lib.el (cl-copy-list):
Declare side-effect-free and error-free.
2023-04-09 16:45:40 +02:00
Michael Albinus
c9e13048bb Fix scoping error in Tramp
* lisp/net/tramp-sshfs.el (tramp-sshfs-handle-insert-file-contents):
Move result out of unwindform.
2023-04-09 16:18:41 +02:00
João Távora
57490fff6e ; Backport: Eglot: fix misplaced parenthesis in last commit to eglot-tests.el
* test/lisp/progmodes/eglot-tests.el
(eglot-test-eldoc-after-completions): Fix misplaced parenthesis.

(cherry picked from commit 3aedd5c920)
2023-04-09 15:36:08 +02:00
João Távora
2a62273f3b Backport: Eglot: no more tests based on Pylsp (bug#62694)
The functionality under test in eglot.el is exactly the same, but use
the clangd server only, as that is used in more tests, and it is much
easier to check if it misbehaves or not.

Tests pass with clangd version 15.

* test/lisp/progmodes/eglot-tests.el (python): Don't require it.
(eglot--call-with-fixture): Simplify.
(eglot--wait-for-clangd): New helper.
(eglot-test-basic-completions)
(eglot-test-non-unique-completions, eglot-test-basic-xref)
(eglot-test-snippet-completions)
(eglot-test-snippet-completions-with-company)
(eglot-test-eldoc-after-completions, eglot-test-multiline-eldoc):
Use clangd, not pylsp.
(eglot-test-formatting): Renamed from
eglot-test-python-autopep-formatting.
(eglot-test-python-yapf-formatting): Remove.

(cherry picked from commit fc8230f336)
2023-04-09 15:34:32 +02:00
Eli Zaretskii
5ef7ff0573 ; Start a new ChangeLog.4 file. 2023-04-09 07:50:01 -04:00
Mattias Engdegård
39a0b6cb02 ; * test/src/fns-tests.el: Strengthen tests of nreverse. 2023-04-09 13:16:53 +02:00
Mattias Engdegård
bb567e339a * lisp/emacs-lisp/cl-extra.el (cl-parse-integer): side-effect-free. 2023-04-09 10:45:43 +02:00
Andrew G Cohen
48ecbccaa3 Update gnus/nnselect marks only for current articles
* lisp/gnus/nnselect.el (nnselect-push-info): Restrict updating of
marked articles to those whose headers have been retrieved, taking
care to handle 'tuples.
2023-04-09 14:23:34 +08:00
Andrew G Cohen
859b94e338 Compute gnus/nnselect read articles from summary variables
* lisp/gnus/nnselect.el (nnselect-push-info): The current list of read
articles should be computed from the summary buffer local variables,
not from the group info.
2023-04-09 14:23:34 +08:00
Andrew G Cohen
a371be5257 Don't modify gnus group info when gnus-newsgroup-selection is nil
* lisp/gnus/nnselect.el (nnselect-push-info): Don't try to propagate
info to component groups if gnus-newsgroup-selection is nil.
* lisp/gnus/nnselect.el (nnselect-request-update-info): Don't update
the nnselect group info if gnus-newsgroup-selection is nil.
2023-04-09 14:23:34 +08:00
Andrew G Cohen
9545869aac Keep the gnus active range current while getting articles
* lisp/gnus/gnus-group.el (gnus-group-get-new-news-this-group):
* lisp/gnus/gnus-group.el (gnus-get-unread-articles-in-group): Update
the current value of the active range since it might have changed.
2023-04-09 14:23:34 +08:00
Andrew G Cohen
cf7860c383 * lisp/gnus/nnselect.el (nnselect-request-article): Check car of thread 2023-04-09 14:23:34 +08:00
Spencer Baugh
b26ccf488e project.el: Use project-name to calculate prefixed buffer name
* lisp/progmodes/project.el (project-prefixed-buffer-name):
Use project-name to calculate prefixed buffer name (bug#62548).
(project-compilation-buffer-name-function): Update doc.
2023-04-09 04:51:37 +03:00
João Távora
e33c0a5491 Eglot: more work on eglot--sig-info (bug#62687)
Simplify function and now also consider individual parameter
documentation strings, which typescript-language-server seems to
provide.

* lisp/progmodes/eglot.el (eglot--sig-info): Rework.
2023-04-08 23:28:03 +01:00
F. Jason Park
52c8d5371e * etc/ERC-NEWS: Add section for ERC 5.6. 2023-04-08 14:23:51 -07:00
F. Jason Park
0e4c07dc74 Allow erc-reuse-frames to favor connections
* lisp/erc/erc.el (erc-reuse-frames): Add alternate value to favor
existing frames already displaying buffers from the same connection.
(erc--setup-buffer-first-window, erc--display-buffer-use-some-frame):
Add helpers to support 'display' variant of `erc-resuse-frames'
* test/lisp/erc/erc-tests.el (erc-tests--run-in-term,
erc-tests--servars, erc-reuse-frames, erc-tests--erc-reuse-frames,
erc-tests--erc-reuse-frames--t, erc-resuse-frames--t,
erc-tests--erc-reuse-frames--displayed-single,
erc-reuse-frames--displayed-single, erc-tests--assert-server-split,
erc-tests--erc-reuse-frames--displayed-double,
erc-reuse-frames--displayed-double,
erc-tests--erc-reuse-frames--displayed-full,
erc-reuse-frames--displayed-full): Add test case and supporting
fixtures.  (Bug#55540.)
2023-04-08 14:23:51 -07:00
F. Jason Park
c104e90888 Make auth-source erc-services tests more readable
* lisp/erc/erc-common.el: (erc-with-server-buffer): Modify slightly to
use `buffer-local-value' when possible.
* test/lisp/erc/erc-services-tests.el
(erc-services-tests--auth-source-plstore-standard-entries,
erc-services-tests--auth-source-plstore-standard-secrets): Remove
unused variables.
(erc-services-tests--auth-source-plstore-standard-announced): Add new
var to hold common plstore document.
(erc--auth-source-search--plstore-standard,
erc--auth-source-search--plstore-announced,
erc--auth-source-search--plstore-overrides): Use string literals for
text-document content.
(erc-services-tests--auth-source-json-standard-entries): Remove unused
variable.
(erc-services-tests--auth-source-json-standard-announced): Add new
variable.
(erc--auth-source-search--json-standard,
erc--auth-source-search--json-announced,
erc--auth-source-search--json-overrides): Use string literals for
text-document content.
(erc-services-tests--secrets-search-items): Add new helper function.
(erc--auth-source-search--secrets-standard,
erc--auth-source-search--secrets-announced,
erc--auth-source-search--secrets-overrides): Use helper to mock
`secrets-search-items' instead of misleading lambda.
* lisp/erc/erc-tests.el (erc-with-server-buffer): Add test.
2023-04-08 14:23:51 -07:00
F. Jason Park
8184a815af Add erc-button helper for substituting command keys
* lisp/erc/erc-button.el (erc-button-mode, erc-button-enable): Warn if
`erc-button-alist' contains deprecated FORM field in `nicknames'
entry.
(erc-button-alist): Discourage arbitrary sexp form for third item of
entries and offer more useful bounds-modifying function in its place.
Mention that anything other than `erc-button-buttonize-nicks' is
deprecated as the FORM field in a `nicknames' entry.  Bump
package-version even though this doesn't introduce a visible change in
the default value.
(erc-button--maybe-warn-arbitrary-sexp): Add helper for validating
third `erc-button-alist' field.
(erc-button--check-nicknames-entry): Add helper to check for
deprecated items in `erc-button-alist'.
(erc-button--preserve-bounds): Add function to serve as default value
for `erc-button--modify-nick-function).
(erc-button--modify-nick-function): Add new variable to hold a
function that filters nickname bounds when buttonizing.
(erc-button--phantom-users, erc-button--add-phantom-speaker,
erc-button--phantom-users-mode): Add new internal minor mode for
treating unseen speakers of PRIVMSGs as known members of the server
for things like coloring nicks during buffer playback.
(erc-button--get-user-from-speaker-naive): Add temporary utility
function to scrape nick from speaker in narrowed buffer.  This will be
replaced by an account-aware version in next major ERC release.
(erc-button-add-nickname-buttons): Accommodate function variant for
"form" field of `erc-button-alist' entries.  Minor optimizations.
This function will likely become the primary juncture for applying
text properties that support nickname-related user-intelligence
features.
(erc-button-add-buttons-1): Show warning when arbitrary sexp for third
"form" field encountered.  Accommodate binary function instead.
(erc-button--substitute-command-keys-in-region): Add helper function
for applying key substitutions in ERC warning messages.
(erc-button--display-error-notice-with-keys): Add new helper function
for displaying ad hoc warnings that possibly require key substitution.
(erc-button--display-error-notice-with-keys-and-warn): Add variant of
`erc-button--display-error-notice-with-keys' that also emits warnings.
* lisp/erc/erc-networks.el (erc-networks--ensure-announced,
erc-networks--on-MOTD-end): Use new key-substitutions helper from
erc-button.
* test/lisp/erc/erc-tests.el
(erc-button--display-error-notice-with-keys): New test.
* test/lisp/erc/resources/base/assoc/bouncer-history/foonet.eld: Add
unknown speaker in channel for phantom store to handle.  Currently
requires manual intervention to leverage.  (Bug#60933.)
2023-04-08 14:23:51 -07:00
F. Jason Park
1f1cd467c6 Replace Info-goto-node with info in erc-button-alist
* lisp/erc/erc-button.el (erc-button-alist): Replace `Info-goto-node'
with plain `info', which is autoloaded.  Expand regexp to recognize
inline `info' function calls.
* lisp/erc/erc-networks.el (erc-networks--set-name,
erc-networks--warn-on-connect): Don't require `info'.  (Bug#60933.)
2023-04-08 14:23:51 -07:00
F. Jason Park
4b56739547 Add erc-fill style based on visual-line-mode
* lisp/erc/erc-fill.el (erc-fill-function): Add new value
`erc-fill-wrap'.
(erc-fill-static-center): Extend meaning of option to also affect
`erc-wrap-mode'.
(erc-fill--wrap-value, erc-fill--wrap-visual-keys): New variables to
support new local module.
(erc-fill-wrap-visual-keys): New option to control how and where
`visual-line-mode' keys are active.
(erc-fill-wrap-merge): Add option for omitting a speaker's name if
they just now spoke.  Enabled by default.
(erc-fill--wrap-move): New helper function for fill-wrap movement
commands.
(erc-fill--wrap-kill-line, erc-fill--wrap-beginning-of-line,
erc-fill--wrap-end-of-line): New movement commands.
(erc-fill-wrap-cycle-visual-movement): New command to cycle local
copy of `erc-fill-wrap-visual-keys'.
(erc-fill-wrap-mode-map): New keymap based on `visual-line-mode-map'.
(erc-fill--make-module-dependency-msg): Helper for
`erc-fill-wrap-enable'.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable): New
local module.
(erc-fill--wrap-length-function): Internal interface in the form of a
function variable for other modules to control the fill-wrap overhang.
(erc-fill--wrap-last-msg, erc-fill--wrap-max-lull,
erc-fill--wrap-continued-message-p): Add items to support hiding of
redundant speaker names in consecutive messages.
(erc-fill--wrap-stamp-insert-prefixed-date): New function to add
`line-prefix' property to inserted date stamp.
(erc-fill-wrap): New function implementing the
`erc-fill-function' (behavioral) interface.
(erc-fill--wrap-fix): New, possibly temporary function for other
modules to fix misalignment caused by fill-wrap.
(erc-fill-wrap-nudge, erc-fill--wrap-nudge): New command and helper
for growing and shrinking visual fill prefix.
* test/lisp/erc/erc-fill-tests.el: New file.  (Bug#60936.)
* test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: New file.
* test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: New file.
* test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: New file.
* test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: New file.
* test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: New file.
* test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: New file.
2023-04-08 14:23:51 -07:00
F. Jason Park
e3c4a648d1 Add variant for erc-match invisibility spec
* lisp/erc/erc-match.el (erc-match-mode, erc-match-enable,
erc-match-disable): Arrange for possibly adding or removing
`erc-match' from `buffer-invisibility-spec'.
(erc-match--hide-fools-offset-bounds): Add new variable to serve as
switch for activating invisibility on a modified interval that's
offset toward `point-min' by one character.
(erc-hide-fools): Optionally offset start and end of invisible region
by minus one.
(erc-match--modify-invisibility-spec): New housekeeping function to
set up and tear down offset spec.  (Bug#60936.)
2023-04-08 14:23:51 -07:00
F. Jason Park
0c3a069ae0 Convert erc-fill minor mode into a proper module
* lisp/erc/erc-fill.el (erc-fill-mode, erc-fill-enable,
erc-fill-disable): Use API to create these.
(erc-fill-static): Save restriction instead of caller's match
data.  (Bug#60936.)
2023-04-08 14:23:51 -07:00
F. Jason Park
9f6a9cef97 Put display properties to better use in erc-stamp
* lisp/erc/erc-log.el (erc-log-filter-function): Add new value
`erc-stamp-prefix-log-filter'.
* lisp/erc/erc-stamp.el (erc-timestamp-use-align-to): Enhance meaning
of option to accept numeric value for dynamically aligned right-hand
stamps.  Use `graphic-display-p' to determine default value even
though, as stated in the manual, terminal Emacs also supports the
"space" display spec.
(erc-stamp-right-margin-width): New option to determine width of right
margin when `erc-stamp--display-margin-mode' is active or
`erc-timestamp-use-align-to' is set to `margin'.
(erc-stamp--display-margin-force): Add new helper function for
`erc-stamp--display-margin-mode'.
(erc-stamp--adjust-right-margin): New function to adjust width of
right margin.
(erc-stamp-prefix-log-filter): New value for `erc-log-filter-function'
compatible with modules that activate
`erc-stamp--display-margin-mode'.
(erc-stamp--display-margin-mode): Add internal minor mode to help
other modules quickly ensure left-right, display-prop-oriented stamps
are showing correctly.  Does not support left-hand-only stamps.
(erc-insert-aligned): Deprecate function and remove from primary
client code path.
(erc-stamp--inherited-props): Add internal constant to hold properties
that should be inherited from any stamp-bearing message being
inserted.
(erc-insert-timestamp-right): Account for new display-related values
of `erc-timestamp-use-align-to'.
* test/lisp/erc/erc-stamp-tests.el (erc-timestamp-use-align-to--nil,
erc-timestamp-use-align-to--t): Adjust spacing for new default
right-hand stamp, `erc-format-timestamp', which lacks a leading space.
(erc-timestamp-use-align-to--integer,
erc-timestamp-use-align-to--margin): New tests.  (Bug#60936.)
2023-04-08 14:23:51 -07:00
F. Jason Park
379d35695b Make some erc-stamp functions more limber
* lisp/erc/erc-stamp.el (erc-timestamp-format-right): Deprecate option
and change meaning of its nil value to fall through to
`erc-timestamp-format'.  Do this to allow modules to predict what the
right-hand stamp's final width will be.  This also saves
`erc-insert-timestamp-left-and-right' from calling
`erc-format-timestamp' again for every inserted message.
(erc-stamp-mode, erc-stamp-enable, erc-stamp-disable): Add
`erc-stamp--recover-on-reconnect' to `erc-mode-hook'.
(erc-stamp--recover-on-reconnect): Add function to reuse last values
of `erc-timestamp-last-inserted' and friends to avoid reprinting
stamps when reconnecting.
(erc-stamp--current-time): Add new generic function and method to
return current time.  Default to calling `erc-current-time'.  Also add
new internal variable of the same name to hold time value used to
construct formatted stamps passed to `erc-insert-timestamp-function'.
(erc-add-timestamp): Bind `erc-stamp--current-time' when calling
`erc-insert-timestamp-function'.
(erc-stamp--insert-date-function): New variable for modules to tweak
date-insertion.
(erc-insert-timestamp-left-and-right): Use STRING parameter and favor
it over the now deprecated `erc-timestamp-format-right' to avoid
formatting twice.  Also extract current time from the variable
`erc-stamp--current-time' for similar reasons.  And defer to
`erc-stamp--insert-date-function' to insert left stamp.  (Bug#60936.)
(erc-stamp--tz): New internal variable.
(erc-format-timestamp): Pass `erc-stamp--tz' as time-zone to
`format-time-string'.
2023-04-08 14:23:51 -07:00
F. Jason Park
ad3dc74e07 Expose insertion time as text prop in erc-stamp
* lisp/erc/erc-stamp.el (erc-add-timestamp): Add new text property
`erc-timestamp' to store lisp time object formerly ensconced in a
closure.  Instead of creating a new lambda for the cursor-sensor
function of each message in a buffer, leave a gap between messages to
trip the sensor function.  The motivation behind this change is to
allow third parties access to valuable timestamp data already stored
by ERC anyway.  Of secondary importance is discouraging the reliance
on those lambdas as a means of detecting message bounds.  The gap now
serves a similar purpose.  Basically, the final character in a
message, a newline, will not have a timestamp or a sensor function.
In the rare instance the stamps module isn't loaded, the new
`erc-command' property can be used for this purpose instead.  Also,
instead of looking for the `invisible' text property at point, which
is normally `point-max' and thus outside the accessible portion of the
buffer, look at the beginning of the inserted message.  This allows
hook members running before this function to opt out of timestamps by
marking a message as invisible.
(erc-echo-timestamp): Make interactive and show timestamps even when
the variable `erc-echo-timestamps' is nil.
(erc--echo-ts-csf): Add new function to serve as value of
cursor-sensor function text properties.
* test/lisp/erc/erc-stamp-tests.el: New file.  (Bug#60936.)
2023-04-08 14:23:51 -07:00
F. Jason Park
8793874616 Adjust some old text properties in ERC buffers
* lisp/erc/erc.el (erc-display-message): Replace `rear-sticky' text
property, which has been around since 2002, with a more useful
`erc-command' property.  It records the current IRC command as a
symbol or a number, in the case of numerics.
(erc--own-property-names, erc--remove-text-properties) Add variable
and internal helper function for filtering values returned by
`filter-buffer-substring-function'.
(erc-display-prompt): Make the `field' text property more meaningful
to aid in searching, although this makes the `erc-prompt' property
somewhat redundant.
(erc-put-text-property, erc-list): Alias these to subr functions.
(erc-restore-text-properties): Don't forget tags when restoring.
(erc--get-eq-comparable-cmd): New function to extract commands for use
as more easily searchable text-property values.  (Bug#60936.)
2023-04-08 14:23:51 -07:00
F. Jason Park
d5435a0d82 Refactor marker initialization in erc-open
* lisp/erc/erc.el (erc--initialize-markers): New helper to ensure
prompt and its associated markers are set up correctly.
(erc-open): When determining whether a session is a logical
continuation, leverage the work already performed by the
`erc-networks' library to that effect.  Its verdicts are based on
network context and thus reliable even when a user dials anew from an
entry-point, which is not a simple reconnection because the user
expects a clean slate for everything except an existing buffer's
messages, meaning `erc--server-reconnecting' will be nil and
local-module state variables need resetting.  Also remove the check
for `erc-reuse-buffers' and instead trust that `erc-get-buffer-create'
always does the right thing.  Replace all code involving marker and
prompt setup by deferring to a new helper, `erc--initialize markers'.
* test/lisp/erc/erc-scenarios-base-local-module-modes.el: New file.
* test/lisp/erc/erc-scenarios-base-local-modules.el
(erc-scenarios-base-local-modules--mode-persistence): Move test to
separate file to help with parallel "-j" runs.
* test/lisp/erc/erc-tests.el (erc-tests--send-prep): Replace
redundant prompt-setup code.
(erc--initialize-markers): New test.  (Bug#60936.)
2023-04-08 14:23:51 -07:00
F. Jason Park
05f6fdb9e7 Preserve ERC prompt and its bounding markers
* lisp/erc/erc.el (erc--assert-input-bounds): Add possibly temporary
helper function to sync `process-mark' to `erc-insert-marker' in
server buffer.
(erc-display-line-1): Expect `erc-insert-marker' to always be
initialized.  Assert some essential invariants regarding insert
markers.
(erc-send-current-line): Delete typed input but not the prompt.
(erc-display-msg): Rework slightly to respect existing markers.
* test/lisp/erc/erc-dcc-tests.el
(erc-dcc-tests--dcc-handle-ctcp-send): Set insert marker.
* test/lisp/erc/erc-networks-tests.el
(erc-networks--rename-server-buffer--existing-live): Initialize
markers to appease `erc--assert-input-bounds'.
* test/lisp/erc/erc-tests.el (erc-ring-previous-command): Fix sloppy
mock.  (Bug#60936.)
2023-04-08 14:23:51 -07:00
F. Jason Park
e7992d2adb Add option to show visual erc-keep-place indicator
* lisp/erc/erc-goodies.el (erc-keep-place-indicator-style,
erc-keep-place-indicator-buffer-type,
erc-keep-place-indicator-follow): New options for anchoring kept place
visually.
(erc-keep-place-indicator-line, erc-keep-place-indicator-arrow): New
faces.
(erc--keep-place-indicator-overlay): New internal variable.
(erc--keep-place-indicator-on-window-configuration-change): New
function to subscribe to `window-configuration-change-hook' and maybe
update kept-place indicator.
(erc--keep-place-indicator-setup): New function to initialize buffer
for local module `keep-place-indicator'.
(erc-keep-place-indicator-mode, erc-keep-place-indicator-enable,
erc-keep-place-indicator-disable): New local ERC module.  Depends on
"parent" module `keep-place'.  Like `fill-wrap', this is (for now)
also deliberately left out of the widget menu for `erc-modules'.
(erc-keep-place-move, erc-keep-place-goto): Add new commands for
manually updating and jumping to keep-place indicator.
(erc-keep-place): Move `erc--keep-place-overlay' when applicable.
* test/lisp/erc/erc-goodies-tests.el (erc-keep-place-indicator-mode):
Add test.
(Bug#59943.)
2023-04-08 14:23:51 -07:00
F. Jason Park
ba7fe88b78 Optionally prompt for more ERC entry-point params
* doc/misc/erc.texi: Update statement about availability of `:user'
keyword param when entry points called interactively.
* lisp/erc/erc/compat.el: Don't require `url-parse' when compiling.
Add forward declaration for `url-type'.
* lisp/erc/erc.el: Don't require `url-parse' when compiling.  Add
forward declarations for accessors of `url' struct from `url-parse'
library.
(erc-select-read-args): Allow optionally calling entry points with a
prefix arg to access params `user' and `:full-name'.
(erc-tls): Update doc string.
* test/lisp/erc/erc-tests.el (erc-select-read-args): Add test for
extra args.  (Bug#60428.)
2023-04-08 14:23:51 -07:00
F. Jason Park
3a012d1db2 Add display option for interactive ERC invocations
* lisp/erc/erc.el (erc-buffer-display, erc-receive-query-display):
Add aliases for `erc-join-buffer' and `erc-auto-query'.
(erc-interactive-display): Add new option to control display of server
buffers during interactive entry-point invocations.
(erc-select-read-args): Pass `erc-interactive-display' to entry
points.
* test/lisp/erc/erc-tests.el (erc-select-read-args): Expect
buffer-display values from `erc-interactive-display'.
(erc-tls, erc--interactive): Also check `erc-join-buffer' in
environment when `erc-open' called.  (Bug#60428.)
2023-04-08 14:23:51 -07:00
F. Jason Park
0f7fc5cfdf Be smarter about switching to TLS from M-x erc
* lisp/erc/erc.el (erc--warn-unencrypted): Remove unused internal
function.
(erc-select-read-args): Offer to use TLS when user runs M-x erc and
opts for default server and port or provides the well-known IANA TLS
port or enters an ircs:// URL at the server prompt.  For the last two,
do this immediately instead of calling `erc-tls' interactively and
imposing a review of just-chosen values.  Also remove error warnings
and ensure `erc-tls' still works by setting
`erc-server-connect-function' to `erc-open-tls-stream' when
appropriate.  Include the word "URL" in server prompt.
(erc--with-entrypoint-environment): Add new macro for empowering an
entry point's interactive form to bind special variables in their
command's body without shadowing them in the lambda list.
(erc, erc-tls): Add internal keyword argument for interactive use, but
don't make it `keywordp' or advertise its presence.  Also use new
helper macro, `erc--with-entrypoint-environment', to temporarily bind
special vars given by interactive helper `erc-select-read-args'.
* test/lisp/erc/erc-tests.el (erc--with-entrypoint-environment): Add
new test.
(erc-select-read-args): Modify return values to expect additional
internal keyword argument where appropriate.
(erc-tls): Make assertions about environment.
(erc--interactive): New test.  (Bug#60428.)
2023-04-08 14:23:51 -07:00
F. Jason Park
8dd209eea4 Ignore killed buffers when switching in erc-track
* lisp/erc/erc-track.el (erc-track--switch-buffer): If the chosen
buffer has been killed, remove it from `erc-modified-channels-alist'
and try again.
* test/lisp/erc/erc-scenarios-misc.el
(erc-scenarios-base-kill-server-track): New test.  (Bug#60560.)
2023-04-08 14:23:51 -07:00
F. Jason Park
39d4f32fc9 Fill doc strings for ERC modules
* lisp/erc/erc-common.el (erc--fill-module-docstring): Add helper to
fill doc strings.
(erc--assemble-toggle, define-erc-module): Use helper to fill doc
string.
* test/lisp/erc/erc-tests.el (define-minor-mode--global,
define-minor-mode--local): Adjust expected output for generated doc
strings.  (Bug#60935.)
2023-04-08 14:23:51 -07:00
F. Jason Park
9c65ac7365 Warn when customizing minor-mode vars for ERC modules
* lisp/erc/erc-common.el: (erc--inside-mode-toggle-p): Add global var
to inhibit mode toggles from being run by `erc-update-modules'.  It
must be non-nil inside custom-set functions for mode toggles created
by `define-erc-module'.
(erc--favor-changed-reverted-modules-state): Add new helper to show a
"SET" Custom state for `erc-modules' except when reverting to the
default value because \"STANDARD\" always takes precedence, as
explained somewhat in bug#12864.
(erc--assemble-toggle): Don't modify `erc-modules' when run from
custom-set function.
(erc--neuter-custom-variable-state): Add new function to serve as a
phony getter that deceives Customize into thinking the variable is
always set to its standard value.  The justification for this is that
toggling a module's minor mode in Customize has never worked and has
only sewn confusion in new users.  Without this hack, mode widgets
show a state of "CHANGED outside Customize", which alone is probably
preferable, except that they all end up toggled open, bringing them
unwanted attention and distracting the user.
(erc--tick-module-checkbox): Add helper to toggle the appropriate
checkbox in the `erc-modules' widget when a user interactively toggles
a minor-mode state variable.
(erc--prepare-custom-module-type): Create spec for minor-mode Custom
`:type', deferring various aspects until module-definition time.
(define-erc-module): Add `:get' and `:type' keywords to be passed to
`defcustom' definition for global modules.
* lisp/erc/erc.el (erc-modules): Inhibit `erc-update-modules' when run
from a minor-mode toggle's custom-set function.
* test/lisp/erc/erc-tests.el (define-erc-module--global,
define-erc-module--local): Update `erc-modules' mutations with
`erc--inside-mode-toggle-p' guard conditions.  (Bug#60935.)
2023-04-08 14:23:51 -07:00
F. Jason Park
0d3ccdbde4 Don't associate ERC modules with undefined groups
* lisp/erc/erc-capab.el: Add property crutch to help ERC find module's
Custom group.
* lisp/erc/erc-common.el (erc--find-group): Add new function, a helper
for finding an existing ERC module's Custom group based on
`define-erc-module' params.  Prefer `group-documentation' as a
sentinel over symbol properties owned by Customize because they might
not be present if the group isn't yet associated with any custom
variables.
(define-erc-module): Set `:group' keyword value more accurately,
falling back to `erc' when no associated group has been defined.
* test/lisp/erc/erc-tests.el (erc--find-group, erc--find-group--real):
New tests.
(define-erc-module--global, define-erc-module--local): Expect the
`:group' keyword to be the unevaluated `erc--find-group'
form.  (Bug#60935.)
2023-04-08 14:23:51 -07:00
F. Jason Park
2d876a4ca9 Convert ERC's Imenu integration into proper module
* lisp/erc/erc-goodies.el: Don't add Imenu hooks to `erc-mode-hook' at
top level.  Remove autoload for `erc-create-imenu-index' because it
already exists in the `erc-imenu' library.
(erc-imenu-setup): Move to the erc-imenu library.
* lisp/erc/erc-imenu.el (erc-unfill-notice): Allow modifications to
read-only text.  Thanks to Yusef Aslam for reporting this bug.
(erc-imenu-setup): Move here from goodies.
(erc-imenu--create-index-function): New helper var to hold previous
local value of `imenu-create-index-function'.  Perhaps advice should
be used instead, but a cursory search of the Emacs code base reveals
no such usage.
(erc-imenu-mode, erc-imenu-enable, erc-imenu-disable): Create "new"
ERC module for Imenu integration.
* lisp/erc/erc.el (erc-modules): Add `imenu' to default value and
create widget menu item.  Update package-version.
* test/lisp/erc/erc-tests.el (erc-tests--modules): Add
`imenu'.  (Bug#60954)
2023-04-08 14:23:51 -07:00
F. Jason Park
22104de5da Add missing colors to erc-irccontrols-mode
* lisp/erc/erc-goodies.el (erc-spoiler-face): Add new face.
(erc--controls-additional-colors): Add remaining 16-99 colors.
(erc-get-bg-color-face, erc-get-fg-color-face): Look up extended
colors in table.
(erc-controls-remove-regexp, erc-controls-highlight-regexp): Convert
to `rx' forms and move above first use to eliminate intra-file forward
declarations.
(erc-controls-propertize): Support spoilers.
* test/lisp/erc/erc-goodies-tests.el: New file.  (Bug#60954.)
2023-04-08 14:23:51 -07:00
F. Jason Park
9aa2806fdc Modify erc-mode-map in module definitions
* lisp/erc/erc-button.el (erc-button-mode, erc-button-enable,
erc-button-disable): Replace call to `erc-button-setup' with one to
`erc--modify-local-map'.  This means `erc-button-setup' is now dead
code from a client perspective.
* lisp/erc/erc-goodies.el (erc-irccontrols-enable,
erc-irccontrols-disable, erc-irccontrols-mode): Bind
`erc-toggle-interpret-controls' in module definition so it's only
available when the module is active.
* lisp/erc/erc-log.el (erc-log-mode, erc-log-enable, erc-log-disable):
Move top-level `define-key' into module definition.
* lisp/erc/erc-match.el (erc-match-mode, erc-match-enable,
erc-match-disable): Move top-level `define-key' into module
definition.
* lisp/erc/erc.el (erc-mode-map): Remove C-c C-c binding for
`erc-toggle-interpret-controls'.
(erc--modify-local-map): Add helper for global modules to use when
modifying `erc-mode-map'.
* test/lisp/erc/erc-tests.el (erc--modify-local-map): Add test.
Ensure modifications to `erc-mode-map' on loading `erc' and via
`erc-mode-hook' still work.  (Bug#60954.)
2023-04-08 14:23:51 -07:00
F. Jason Park
5011554529 Don't require erc-goodies in erc.el
* lisp/erc/erc-goodies.el: Obviate the need for forward declarations
by requiring `erc'.  Add minor-mode autoloads for `scrolltobottom',
`readonly', `move-to-prompt', `keep-place', `noncommands',
`irccontrols', `smiley', and `unmorse'.  Add Local variables footer
with `generated-autoload-file'.
(erc-controls-strip): Autoload this function.
* lisp/erc/erc-ibuffer.el: Require `erc-goodies' for
`erc-control-interpret'.  The justification for the blanket `require'
is this module isn't a member of `erc-modules' by default.
* lisp/erc/erc-page.el: (erc-ctcp-query-PAGE): Require `erc-goodies'
and put forward declaration for `erc-control-interpret' atop file.
* lisp/erc/erc-speedbar.el: Require `erc-goodies' for the same reason
as erc-ibuffer.el.
* lisp/erc/erc.el: Remove `require' for `erc-goodies' at end of file
and `pp' at top of file because `pp-to-string' is autoloaded on Emacs
27.  Also remove `require's for `thingatpt', `time-date', and
`iso8601'.  They're all used sparingly and the latter two have only
been around for one major release, so their removal likely won't cause
much churn.  And `thingatpt' already has a call-site `require', so the
top-level one is redundant, but autoload `word-at-point' anyway for
the benefit of third-party libraries like `hl-nicks'.  Also wrap local
loaddefs `require' call in `eval-and-compile'.
(erc--read-time-period): Require dependencies.  (Bug#60954.)
2023-04-08 14:23:51 -07:00
F. Jason Park
3d81ecf0a9 Leverage loaddefs for migrating ERC modules
* lisp/erc/erc-common.el (erc--features-to-modules,
erc--modules-to-features, erc--module-name-migrations): Remove unused
internal functions.
(erc--normalize-module-symbol): Make aware of new migration scheme
based on symbol properties.
* lisp/erc/erc-page.el: Add autoload cookie for module migration.
* lisp/erc/erc-pcomplete.el: Add autoload cookies for module
migration.
* lisp/erc/erc-services.el: Add autoload cookie for module migration.
* lisp/erc/erc-sound.el: Add autoload cookie for module migration.
* lisp/erc/erc-stamp.el: Add autoload cookie for module migration.
* lisp/erc/erc.el (erc-modules): Reorder default value, sorted by
`string<' so that Customize does not consider the value to have been
edited.  Remove non-existent module `hecomplete' from lineup and swap
a couple more to maintain sorted order.  Change `:initialize' function
to tag all symbols for built-in modules with an `erc--module'
property.  In the `:set' function, ensure third-party modules appear
after the sorted and normalized built-ins, but in user-defined order.
Do this to prevent all modules, built-ins included, from ending up as
populated form fields for the "other" checkbox in the Customize
interface.
(erc--find-mode): Add helper function for `erc--update-modules'.
(erc--update-modules): Always resolve module names and only
conditionally attempt to require corresponding features.
* test/lisp/erc/erc-tests.el (erc-tests--modules): Add manifest for
asserting built-in modules and features.  This is easier to verify
visually than looking at the custom-type set for `erc-modules'.
(erc-modules--initialize): New test.
(erc-modules--internal-property): Add test.
(erc--normalize-module-symbol): New test.
(erc--find-mode): New test.
(erc--update-modules) Adapt to new paradigm and make more
comprehensive.  (Bug#60954.)
2023-04-08 14:23:50 -07:00
F. Jason Park
89815631f2 Copy over upstream Compat macros to erc-compat
* lisp/erc/erc-backend: (erc--get-isupport-entry): Replace call to
`erc-compat--with-memoization' with the built-in `with-memoization'.
* lisp/erc/erc-compat.el: (erc-compat-function, erc-compat-call): Add
new macros from Compat 29.1.2.0.
(erc-compat--with-memoization): Remove because it's now provided by
Compat.  (Bug#60954.)
2023-04-08 14:23:50 -07:00
F. Jason Park
e69bd59ec5 Honor arbitrary CHANTYPES in ERC
* lisp/erc/erc.el (erc-channel-p): Favor "CHANTYPES" ISUPPORT item
before falling back to well known prefixes.
* test/lisp/erc/erc-tests.el (erc-channel-p): Add test.  Arbitrarily
bundled with bug#60954.
2023-04-08 14:23:50 -07:00
F. Jason Park
8c0c982684 Add hook to regain nickname in ERC
* lisp/erc/erc-backend.el (erc-server-reconnect-timeout): Mention
`erc-nickname-in-use-functions' in doc string.
* lisp/erc/erc.el (erc-nickname-in-use-functions,
erc-regain-nick-on-connect): Add abnormal hook and possible value to
handle stale connections preventing a desired nick from being reissued
by the server.  Follows directly from bug#62044.
(erc-nickname-in-use): Call `erc-nickname-in-use-functions'.
* test/lisp/erc/erc-scenarios-base-renick.el
(erc-scenarios-base-renick-auto-regain): New test.
* test/lisp/erc/resources/base/renick/regain/normal-again.eld: New file.
* test/lisp/erc/resources/base/renick/regain/normal.eld: New file.
2023-04-08 14:23:50 -07:00
F. Jason Park
03eddc9924 Add probing erc-server-reconnect-function variant
* lisp/erc/erc-backend.el (erc-server-reconnect-timeout): Replace
questionable claim with recommendation for alternate value when
experiencing nick rejections.
(erc-server-reconnect-function): Add new, somewhat experimental value
`erc-server-delayed-check-reconnect'.
(erc--server-connect-function): Add variable for process-dialing
monitor, a function.
(erc--server-propagate-failed-connection): Add function to serve as
default monitor to run on process creation and maybe execute failure
handlers.
(erc-server-connect): Run `erc--server-connect-function' for async
processes one second after creation.
(erc--server-reconnect-timeout, erc--server-reconnect-timeout-check,
erc--server-reconnect-timeout-scale-function,
erc--server-reconnect-timeout-double): Add supporting variables and
functions for `erc-server-delayed-check-reconnect'.
(erc-server-delayed-check-reconnect): Add possible alternate value for
option `erc-server-reconnect-function' that only attempts to reconnect
after hearing back from the server.
(erc-schedule-reconnect): Ensure previous `erc-server-process' is
deleted.
* test/lisp/erc/erc-scenarios-base-auto-recon.el: New file.
* test/lisp/erc/resources/base/reconnect/just-eof.eld: New file.
* test/lisp/erc/resources/base/reconnect/just-ping.eld: New file.
* test/lisp/erc/resources/base/reconnect/ping-pong.eld: New file.
* test/lisp/erc/resources/base/reconnect/unexpected-disconnect.eld:
New file.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common--make-bindings): Shadow
`timer-list'.  (Bug#62044.)
2023-04-08 14:23:50 -07:00
F. Jason Park
4da7d24988 Add MOTD command to ERC
* lisp/erc/erc-backend.el (erc-server-402, erc-server-402-functions):
Add new response handler and hook.
* lisp/erc/erc.el (erc-cmd-MOTD): New function to shield erc-network
from handling post-connection MOTD replies.  Thanks to Emanuel Berg
for reporting this (bug#62151).
(erc-message-english-s402): Define new ERR_NOSUCHSERVER message
template.
* test/lisp/erc/erc-scenarios-base-misc-regressions.el: New file.
* test/lisp/erc/resources/base/commands/motd.eld: New file.
2023-04-08 14:23:50 -07:00
F. Jason Park
61ed0b43cd Split overlong outgoing messages in erc-sasl
* lisp/erc/erc-sasl.el: (erc-server-AUTHENTICATE): Account for
client messages exceeding 400 bytes.  (Bug#62421.)
* test/lisp/erc/erc-scenarios-sasl.el
(erc-scenarios-sasl--plain-overlong-split,
erc-scenarios-sasl--plain-overlong-aligned): Add tests.
* test/lisp/erc/resources/sasl/plain-overlong-aligned.eld: New file.
* test/lisp/erc/resources/sasl/plain-overlong-split.eld: New file.
2023-04-08 14:23:50 -07:00
Daniel Pettersson
cf83f9a082 Fix DCC GET flag parsing in erc-dcc
* lisp/erc/erc-dcc.el (erc-cmd-DCC): Tokenize raw input line but also
accommodate legacy invocation.
(pcomplete/erc-mode/DCC): Quote file names when suggesting.  Account
for double-hyphen "end-of-options"-like separator.
(erc-dcc-do-GET-command): Simplify signature, subsuming NICK in
variadic args, now ARGS instead of FILE, which changes the arity
from (2 . many) to (1 . many).  Explain usage in doc string.  Honor an
optional separator, "--", if present.  (Bug#62444.)
* test/lisp/erc/erc-dcc-tests.el (erc-dcc-do-GET-command): Call new
parameterized helper with various flag/file combinations.
(erc-dcc-tests--erc-dcc-do-GET-command): New fixture function.
(pcomplete/erc-mode/DCC--get-quoted,
pcomplete/erc-mode/DCC--get-sep): New tests.
2023-04-08 14:23:50 -07:00
F. Jason Park
2d3ae5d5e6 Add subcommand erc-cmd-HELP handler to erc-dcc
* lisp/erc/erc-compat.el (erc-compat--28-split-string-shell-command,
erc-compat--split-string-shell-command): New functions introduced in
Emacs 28 for splitting pcomplete input.
* lisp/erc/erc-dcc.el (erc-cmd-DCC): Elect to tokenize line specially.
(erc-dcc--cmd-help): Add help handler.  (Bug#62444.)
2023-04-08 14:23:50 -07:00
F. Jason Park
b1007516cd Add subcommand dispatch facility to erc-cmd-HELP
* lisp/erc/erc.el (erc-cmd-HELP): Change signature by adding &rest
parameter.  Look for symbol property `erc--cmd-help' and, if found,
assume it's a function and call it with &rest args after attempting to
autoload the primary command symbol.  (Bug#62444.)
2023-04-08 14:23:50 -07:00
F. Jason Park
dfaeeba97c Change ERC version to 5.6-git
* lisp/erc/erc.el: Update main Version header and bump required Compat
to latest release in Package-Requires header.  Also update entry in
`customize-package-emacs-version-alist', mapping ERC 5.6 to Emacs
30.1.
(erc-version): Move to 5.6-git.
2023-04-08 14:23:50 -07:00
João Távora
685435cb52 Eglot: simplify eglot--sig-info and fix edge cases (bug#62687)
The documentation of each signature was rarely rendered because of
obsolete logic that skipped MarkupContent objects.

The new function follows the principle that echo are gets as little as
possible, while the *eldoc* buffer gets as much as possible (except,
for the individual parameter documentation, as I couldn't find a
single server that uses it).

Tested with clangd, pylsp, jdtls, gopls, rust-analyzer, zls.

* lisp/progmodes/eglot.el (eglot--sig-info): Simplify.
2023-04-08 20:41:38 +01:00
Mattias Engdegård
aef996cd34 Consolidate existing warnings about unused return values
Move the warning about unused return values from calls to
side-effect-free functions from the source-level optimiser to the code
generator, where it can be unified with the special-purpose warning
about unused values from `mapcar`.  This change also cures spurious
duplicate warnings about the same code, makes the warnings amenable to
suppression through `with-suppressed-warnings`, and now warns about
some unused values that weren't caught before.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Move warning away from here.
* lisp/emacs-lisp/byte-run.el (with-suppressed-warnings):
* lisp/emacs-lisp/bytecomp.el (byte-compile-warnings):
Doc string updates.
(byte-compile-form): Put the new warnings here.
(byte-compile-normal-call): Move mapcar warning away from here.
* lisp/emacs-lisp/bytecomp.el (byte-compile-ignore):
Compile args to `ignore` for value to avoid unused-value warnings, and
then discard the generated values immediately thereafter.  Mostly this
does not affect the generated code but in rare cases it might result
in slightly worse code.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-test--with-suppressed-warnings): Adapt test.
2023-04-08 19:34:30 +02:00
Eli Zaretskii
11126c6d30 Fix 'C-h k' for "Paste from Kill Menu" in context menus
* lisp/mouse.el (context-menu-region): Make the entries be
symbols, not just integers, to prevent "C-h c" from interpreting
them as character keys.  (Bug#62626)
2023-04-08 20:10:49 +03:00
Eli Zaretskii
74ddfe811f ; * doc/misc/calc.texi (Rewrites Tutorial): Fix a typo (bug#62658). 2023-04-08 19:14:15 +03:00
Eli Zaretskii
08cda286c3 Improve the documentation of the XDS support
* doc/lispref/frames.texi (Drag and Drop): Rephrase and rearrange
the documentation of XDS support.  Add indexing.  Document
'x-dnd-save-direct' and 'x-dnd-save-direct-immediately'.  Original
patch from Po Lu <luangruo@yahoo.com>.

* lisp/x-dnd.el (x-dnd-types-alist, x-dnd-test-function)
(x-dnd-default-test-function, x-dnd-direct-save-function): Doc
fixes.
(x-dnd-save-direct, x-dnd-save-direct-immediately): Rename the
second argument to FILENAME.  Doc fix.
2023-04-08 18:36:23 +03:00
Eli Zaretskii
14d1c00e80 Allow reindentation of images inserted by 'mm-inline-image'
* lisp/gnus/mm-view.el (mm-inline-image): Use "x" as text on which
to put the image 'display' property, so that indentation commands
don't destroy the image inadvertently.  (Bug#62637)
2023-04-08 16:00:29 +03:00
Eli Zaretskii
b63a9eda01 Fix "C-h k" and "C-h c" with Paste from Kill Menu
* lisp/subr.el (event-basic-type, event-modifiers): Return nil if
EVENT is a string.  (Bug#62626)
2023-04-08 15:36:44 +03:00
Daniel Martín
b36c21e27d Change cursor color on NS port when it matches the face background
* src/macfont.m (CG_SET_FILL_COLOR_WITH_FRAME_CURSOR): New macro.
(CG_SET_FILL_COLOR_WITH_FRAME_BACKGROUND): New macro.
(macfont_draw): When the cursor's color matches the face background,
set the fill color of the cursor to the face foreground.
* src/nsterm.m (ns_maybe_dumpglyphs_background): When dumping the
background of a glyph string, apply the logic mentioned
above.  (Bug#62573)
2023-04-08 14:35:30 +03:00
Eli Zaretskii
96714c106b Improve documentation of image-related commands
* lisp/image.el (image-map): Make it inherit from
'image-slice-map' instead of repeating the bindings.

* doc/emacs/files.texi (Image Mode): Document the key bindings set
by 'insert-image'.  Add indexing.

* doc/lispref/display.texi (Showing Images): Make the description
of user commands more concise.  Add index entries and
cross-reference to the Emacs manual.

* etc/NEWS: Rearrange entries relevant to image commands.
2023-04-08 14:33:06 +03:00
Basil L. Contovounesios
10b58633b5 Improve ibuffer-diff-with-file
* lisp/ibuf-ext.el (ibuffer-diff-with-file): Link to diff-command in
docstring.  Make Diff buffer read-only from outset and inhibit as
needed to avoid surprises.  Check whether diff-command
supports --label.  Leave point at BOB and clean up any excess
newline inserted by ibuffer-diff-buffer-with-file-1.  Prefer
pop-to-buffer-same-window over switch-to-buffer.

(ibuffer-diff-buffer-with-file-1): Add docstring.  Remove unused
unwind-protect and copypasta from diff-no-select (bug#62599).  Use
diff-file-local-copy, string-join, and redisplay in place of
analogues.  Condition --label use on availability, and label buffers
consistently with diff-no-select.  Leave empty line between runs.
Let diff-sentinel delete temporary files.  Leave point at EOB for
next run.
2023-04-08 11:51:43 +01:00
Eli Zaretskii
6a2863ca01 Fix handling of sliced images
* lisp/image.el (image-slice-map): New keymap, without some
bindings that make no sense with sliced images.
(insert-image, insert-sliced-image): Use it.
(insert-sliced-image): Make the 'keymap' property rear-nonsticky,
to prevent calling image commands when point is to the right of
the slice.  (Bug#62679)

* lisp/image/image-crop.el (image-cut, image-crop): Doc fixes.
(image-crop): Don't try using stock MS-Widows convert.exe
program.  Use 'image--get-image' to support sliced images.
2023-04-08 12:43:34 +03:00
Eli Zaretskii
5be79fd05a ; * etc/NEWS: Announce 'cyrillic-mongolian' IM. 2023-04-08 10:55:26 +03:00
Eli Zaretskii
ca1a0fda98 ; Fix last change. 2023-04-08 10:52:35 +03:00
garid3000
ce63462dbd Add cyrillic-mongolian input method
* lisp/leim/quail/cyrillic.el (cyrillic-mongolian): New input
method.  (Bug#56617)
2023-04-08 10:50:34 +03:00
Eli Zaretskii
5880179270 ; Minor addition to the Emacs FAQ
* doc/misc/efaq.texi (Fullscreen mode on MS-Windows): Tell how to
avoid the initial screen changing size on display without using
the Registry.  Suggested by David Hedlund <public@beloved.name>.
2023-04-08 10:41:53 +03:00
João Távora
9848ae1716 Eglot: fix problems after changes to eglot-imenu (bug#62718)
* lisp/progmodes/eglot.el (eglot--imenu-SymbolInformation)
(eglot--imenu-DocumentSymbol): Fix.
2023-04-07 23:00:44 +01:00
João Távora
cc288a0e33 Eglot: version strings must start with numbers (bug#62718)
Even though Eglot is a :core ELPA package and as such is on a
different release cycle than Emacs proper, the version strings used in
'defcustom' and 'make-obsolete' must still follow the numeric format.

* lisp/progmodes/eglot.el (eglot-report-progress): Adjust :version.
(eglot-lsp-abiding-column)
(eglot-current-column)
(eglot-current-column-function)
(eglot-move-to-current-column)
(eglot-move-to-lsp-abiding-column)
(eglot-move-to-column-function)
(eglot-ignored-server-capabilites)
(eglot-manual)
(eglot--managed-mode-hook): Update "obsolete" spec.
2023-04-07 22:47:15 +01:00
João Távora
621e732ade Eglot: use Eglot versions, not Emacs's in obsolete specs
* lisp/progmodes/eglot.el (eglot-report-progress): Adjust :version.
(eglot-lsp-abiding-column)
(eglot-current-column)
(eglot-current-column-function)
(eglot-move-to-current-column)
(eglot-move-to-lsp-abiding-column)
(eglot-move-to-column-function)
(eglot-ignored-server-capabilites)
(eglot-manual)
(eglot--managed-mode-hook): Update "obsolete" spec.
2023-04-07 19:54:57 +01:00
João Távora
6cc5fe7724 Eglot: require optional text-property-search.el
Originally reported in
https://github.com/joaotavora/eglot/discussions/1201.

Also check for text-property-search-forward before using it, so we
won't break on Emacs 26.3.  At this point, better start relying on
compat.el, I guess.

* lisp/progmodes/eglot.el (eglot--format-markup): Check for
text-property-search-forward.
2023-04-07 19:45:28 +01:00
João Távora
7239098ad4 Eglot: be careful about gfm-view-mode read-only buffers
Although in most situations this doesn't error, it's only because of
the very wide binding of inhibit-read-only in jsonrpc--process-filter.
That binding will soon be narrowed, so better not rely on it.

Originally reported in
https://github.com/joaotavora/eglot/discussions/1202.

* lisp/progmodes/eglot.el (eglot--format-markup): Inhibit
read-only before touching buffer potentially in gfm-view-mode.
2023-04-07 19:40:27 +01:00
João Távora
88847dee12 Jsonrpc: don't bind inhibit-read-only to t so early
Related to https://github.com/joaotavora/eglot/discussions/1202, where
because of this very wide binding to inhibit-read-only to t, Eglot was
managing to write into read-only buffers from the response handlers
that ran from within the stack of the jsonrpc.el process filter.

This is of course illegal and dangerous, but Eglot wasn't made aware
because of the binding.

* lisp/jsonrpc.el (jsonrpc--process-filter): Don't bind
inhibit-read-only so early.
2023-04-07 19:33:12 +01:00
João Távora
3aedd5c920 ; Eglot: fix misplaced parenthesis in last commit to eglot-tests.el
* test/lisp/progmodes/eglot-tests.el
(eglot-test-eldoc-after-completions): Fix misplaced parenthesis.
2023-04-07 18:52:24 +01:00
Mattias Engdegård
4489d89783 ; * test/src/comp-tests.el (61917-1): Underscore unused parameter. 2023-04-07 19:19:58 +02:00
Mattias Engdegård
7c0c2b1bb5 Remove useless unwind-protect forms, or make them useful as intended
* lisp/imenu.el (imenu--generic-function):
* lisp/mail/yenc.el (yenc-decode-region):
* lisp/textmodes/table.el (table-recognize-region):
* test/lisp/dired-tests.el (dired-test-directory-files):
* test/lisp/hl-line-tests.el (hl-line-tests-sticky):
Fix unwind-protect bracketing mistakes that caused the unwind code to
be misplaced.
* lisp/strokes.el (strokes-read-stroke): Fix a bracketing mistake that
misplaced the unwind code, and another one that misplaced the
else-clause of an `if` form.
* test/lisp/gnus/mml-sec-tests.el (mml-secure-test-fixture): Fix a
bracketing mistake that misplaced the unwind code, and remove
superfluous condition-case.

* lisp/mwheel.el (mouse-wheel-global-text-scale):
* lisp/speedbar.el (speedbar-stealthy-updates)
(speedbar-fetch-dynamic-etags):
* lisp/emacs-lisp/edebug.el (edebug--recursive-edit):
* lisp/emacs-lisp/package.el (package--read-pkg-desc):
* lisp/cedet/semantic.el (semantic-refresh-tags-safe):
* lisp/emulation/viper-cmd.el (viper-escape-to-state):
* lisp/emulation/viper-cmd.el (viper-file-add-suffix):
* lisp/gnus/mail-source.el (mail-source-movemail):
* lisp/mail/feedmail.el (feedmail-send-it-immediately)
(feedmail-deduce-address-list):
* lisp/mail/mailclient.el (mailclient-send-it):
* lisp/mail/smtpmail.el (smtpmail-deduce-address-list):
* lisp/mh-e/mh-print.el (mh-ps-print-range):
* lisp/textmodes/reftex-index.el (reftex-index-this-phrase):
* test/lisp/emacs-lisp/ert-tests.el (ert-test-run-tests-batch):
(ert-test-run-tests-batch-expensive):
Remove unwind-protect forms that are apparently useless, some since a
prior edit that removed their purpose, some since their first
appearance.

* test/lisp/subr-tests.el (subr-test--frames-2):
Insert dummy unwind form in backtrace test code.
2023-04-07 19:08:33 +02:00
Eli Zaretskii
cb8c87a423 Allow active region when IM is used
* lisp/international/quail.el (quail-minibuffer-message): Bind
deactivate-mark to allow setting active region in the minibuffer
when an input method is used.  (Bug#62709)
2023-04-07 18:31:42 +03:00
Michael Albinus
211618293d * test/infra/Dockerfile.emba (emacs-eglot): Adapt software selection. 2023-04-07 17:08:46 +02:00
João Távora
fc8230f336 Eglot: no more tests based on Pylsp (bug#62694)
The functionality under test in eglot.el is exactly the same, but use
the clangd server only, as that is used in more tests, and it is much
easier to check if it misbehaves or not.

Tests pass with clangd version 15.

* test/lisp/progmodes/eglot-tests.el (python): Don't require it.
(eglot--call-with-fixture): Simplify.
(eglot--wait-for-clangd): New helper.
(eglot-test-basic-completions)
(eglot-test-non-unique-completions, eglot-test-basic-xref)
(eglot-test-snippet-completions)
(eglot-test-snippet-completions-with-company)
(eglot-test-eldoc-after-completions, eglot-test-multiline-eldoc):
Use clangd, not pylsp.
(eglot-test-formatting): Renamed from
eglot-test-python-autopep-formatting.
(eglot-test-python-yapf-formatting): Remove.
2023-04-07 14:55:09 +01:00
João Távora
b1f8d98a11 Eglot: rework eglot-imenu
Most newer servers return a vector of 'DocumentSymbol' as a response
to 'textDocument/documentSymbol'.  It's not worth trying to dumb this
down to imenu format of 'SymbolInformation' vectors.

This lays groundwork for the forthcoming "breadcrumb" feature of
bug#58431.

* lisp/progmodes/eglot.el
(eglot--imenu-SymbolInformation, eglot--imenu-DocumentSymbol): New
helpers.
(eglot-imenu): Rework.
2023-04-07 12:57:59 +01:00
Eli Zaretskii
5e5f5b28e9 Avoid failing the build when org-version.el is updated
* lisp/Makefile.in: Force recompilation of all Org files when
org-version.el is updated with a new Org version.
2023-04-06 22:14:59 +03:00
Eli Zaretskii
2d1a96e878 Merge from origin/emacs-29
305246d972 Add emoji-zoom-reset
470d269ec1 Make emoji-zoom-{increase,decrease} set text properties c...
63d4a86f8d Fix transforming sliced images
5e1953a8f8 ; * etc/NEWS: Minor copyedits of entry for 'keymap-*' fun...
6b9f9df945 ; Improve documentation of 'declare-function'
81d1f46d0f ; Avoid compiler warning in eglot.el.
38cdfcb212 ; Fix description of new 'keymap-*' functions
257090b872 Adapt EMBA scripts.
90c07d3fdd Another terminology fix in ELisp reference manual
a832bc7090 Correct terminology in Elisp Reference Manual
db308233cb Comment out GNUSTEP jobs on EMBA (again)
8c1b102243 ; * lisp/image.el (put-image): Doc fix.
eda88c63ad ; * doc/emacs/trouble.texi (Checklist): Minor grammar fix.
728bc09cf3 Fix regexp string escaping mistake in vhdl-mode.el (bug#6...
479626dbac Update to Org 9.6.3-2-gf2949d
5a1c9aace7 ; Add a bit more docstring to tsx-ts-mode (bug#62429)
86cf9fd932 Eglot: don't watch directories that don't exist
82d0b6c64e ; * lisp/subr.el (use-dialog-box-p): Fix last change.
3619663f98 Preserve peer information for web page in eww-readable
cb8d6ab648 * lisp/subr.el (use-dialog-box-p): Fix conditions for GUI...
fb2c440920 ; * lisp/progmodes/c-ts-mode.el (c++-ts-mode): Add some n...

# Conflicts:
#	etc/NEWS
2023-04-06 14:38:20 -04:00
Eli Zaretskii
f7e8586104 ; Merge from origin/emacs-29
The following commit was skipped:

89e337c3fc ; Make sure 'eshell-command' tests don't prompt the user
2023-04-06 14:38:16 -04:00
Eli Zaretskii
40860b61ee Merge from origin/emacs-29
b39c3cd112 ; * etc/NEWS: Fix typos.
89ac5ba11c Fix ModelSim error regexp in vhdl-mode
24ed9c7ae7 ; * doc/emacs/trouble.texi (Checklist): Minor copyedits (...
d1d39a0f09 Document enhancements in handling of echo-area messages

# Conflicts:
#	etc/NEWS
2023-04-06 14:38:13 -04:00
Eli Zaretskii
c755463f04 ; Merge from origin/emacs-29
The following commits were skipped:

46209b2453 ; Fix last change
21a4ee209c Fix new Eshell tests on MS-Windows
e2ebf3995d ; Auto-commit of loaddefs files.
6419d78fa6 Fix using background commands in 'eshell-command'
2023-04-06 14:38:04 -04:00
Michael Albinus
5ae0c16732 Describe how to run Emba tests locally
* admin/notes/emba: Describe how to run Emba tests locally.

* test/infra/Dockerfile.emba (emacs-eglot):  Adapt software selection.
2023-04-06 16:31:49 +02:00
Robert Pluim
305246d972 Add emoji-zoom-reset
* lisp/international/emoji.el (emoji-zoom-map): Add emoji-zoom-reset.
(emoji-zoom-reset): New function, it resets the zoom level.
* lisp/international/mule-cmds.el (ctl-x-map): Add emoji-zoom-reset.
* etc/NEWS: Announce new command.
2023-04-06 13:36:11 +02:00
Robert Pluim
470d269ec1 Make emoji-zoom-{increase,decrease} set text properties correctly
* lisp/international/emoji.el (emoji-zoom-increase): Ensure that we're
increasing the :height of the anonymous face at point, rather than
having two :height properties, which appeared to work by
accident, and don't error at eob.  (Bug#62675)
2023-04-06 13:36:11 +02:00
Liu Hui
27a21709c1 Restore positions reliably for abbreviated file names in saveplace.el
* lisp/saveplace.el (save-place-abbreviate-file-names): Add setter
function for rewriting `save-place-alist'.  Update docstring.
(save-place-to-alist): Save Abbreviated dired-filename.
(save-place-load-alist-from-file): Move this function above
`save-place-abbreviate-file-names' since it is used in the :set
function.
(save-place-find-file-hook):
(save-place-dired-hook): Use abbreviated file name when
`save-place-abbreviate-file-names' is non-nil.
(Bug#62413)
2023-04-06 13:25:54 +03:00
Wilhelm H Kirschbaum
0563dbf95d Handle electric heredocs pairs in elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--electric-pair-string-delimiter): New helper.
(elixir-ts-mode): Add post-self-insert-hook.  (Bug#62536)
2023-04-06 13:05:39 +03:00
Wilhelm H Kirschbaum
c6bbc20c38 Propertize heredocs in elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--syntax-propertize-query): New variable.
(elixir-ts--syntax-propertize): New helper.
(elixir-ts-mode): Set syntax-propertize-function.  (Bug#62536)
2023-04-06 13:04:54 +03:00
Eli Zaretskii
63d4a86f8d Fix transforming sliced images
* lisp/image.el (image--get-image): Support sliced images
(bug#62679).  Doc fix.
(image-mouse-decrease-size, image-mouse-increase-size)
(image-decrease-size, image-increase-size): Doc fixes.
2023-04-06 12:35:17 +03:00
Alan Mackenzie
e579c9cc33 CC Mode: Miscellaneous coding fixes in c-forward-type
This fixes bug #62339.

* lisp/progmodes/cc-engine.el (c-forward-type): In the implicit int handling,
respect the setting of the parameter stop-at-end.  In the case "normal
identifier", insert a missing (c-forward-syntactic-ws); this fixes the bug.
Here, correct the wrong return value `prefix' to t.
2023-04-06 09:14:56 +00:00
Eli Zaretskii
5e1953a8f8 ; * etc/NEWS: Minor copyedits of entry for 'keymap-*' functions. 2023-04-05 16:50:58 +03:00
Eli Zaretskii
6b9f9df945 ; Improve documentation of 'declare-function'
* doc/lispref/functions.texi (Declaring Functions):
* lisp/subr.el (declare-function): Document explicitly that
ARGLIST argument, if provided, should include the parentheses.
2023-04-05 12:31:01 +03:00
Eli Zaretskii
81d1f46d0f ; Avoid compiler warning in eglot.el. 2023-04-05 12:23:54 +03:00
Eli Zaretskii
38cdfcb212 ; Fix description of new 'keymap-*' functions
* doc/lispref/keymaps.texi (Prefix Keys): Fix example (bug#62673).
(Functions for Key Lookup): Clarify the possible values of KEYMAP
argument of 'keymap-lookup'.
(Active Keymaps): Fix typo in function name; add cross-reference.
2023-04-05 11:31:15 +03:00
Michael Albinus
257090b872 Adapt EMBA scripts.
* test/infra/Dockerfile.emba (emacs-gnustep): Add zlib1g-dev.
Remove make instrumentation.

* test/infra/gitlab-ci.yml (build-image-gnustep, test-gnustep): Uncomment.
2023-04-04 20:01:19 +02:00
Eli Zaretskii
90c07d3fdd Another terminology fix in ELisp reference manual
* doc/lispref/frames.texi (Mouse Tracking):
* doc/lispref/commands.texi (Motion Events, Event Examples):
'track-mouse' is a macro, not a special form.
2023-04-04 14:22:56 +03:00
Shynur
a832bc7090 Correct terminology in Elisp Reference Manual
* doc/lispref/functions.texi (Function Names): 'defun' is a macro, not
a special form.  (Bug#62661)

Copyright-paperwork-exempt: yes
2023-04-04 14:16:23 +03:00
Michael Albinus
db308233cb Comment out GNUSTEP jobs on EMBA (again)
* test/infra/gitlab-ci.yml (build-image-gnustep, test-gnustep):
Comment out jobs due to bug#62210.
2023-04-04 13:00:51 +02:00
Eli Zaretskii
8c1b102243 ; * lisp/image.el (put-image): Doc fix. 2023-04-03 19:32:46 +03:00
Robert Pluim
eda88c63ad ; * doc/emacs/trouble.texi (Checklist): Minor grammar fix. 2023-04-03 14:42:54 +02:00
Mattias Engdegård
728bc09cf3 Fix regexp string escaping mistake in vhdl-mode.el (bug#62508)
* lisp/progmodes/vhdl-mode.el (vhdl-compiler-alist): Quote brackets
correctly.
2023-04-03 12:57:54 +02:00
Kyle Meyer
479626dbac Update to Org 9.6.3-2-gf2949d 2023-04-02 23:03:32 -04:00
Yuan Fu
5a1c9aace7
; Add a bit more docstring to tsx-ts-mode (bug#62429)
* lisp/progmodes/typescript-ts-mode.el:
(tsx-ts-mode): Explain a bit more.
2023-04-02 15:10:38 -07:00
João Távora
86cf9fd932 Eglot: don't watch directories that don't exist
project-files isn't guaranteed to return existing files, so better
check if they exist because placing a watcher on them.

Originally reported at:
https://github.com/joaotavora/eglot/issues/1198

* lisp/progmodes/eglot.el (eglot-register-capability
workspace/didChangeWatchedFiles): Check if directories exist.
2023-04-02 23:02:38 +01:00
Eli Zaretskii
82d0b6c64e ; * lisp/subr.el (use-dialog-box-p): Fix last change. 2023-04-02 11:42:43 +03:00
Eshel Yaron
3619663f98 Preserve peer information for web page in eww-readable
The :peer property in eww-data affects the face of the page title
in 'header-line-format' as set by 'eww-update-header-line-format'.
Preserving this property in eww-readable avoids having the header
line's appearance change when this command is called.
* lisp/net/eww.el (eww-readable): Preserve eww-data's :peer
property.  (Bug#62574)
2023-04-02 10:38:44 +03:00
Eli Zaretskii
cb8d6ab648 * lisp/subr.el (use-dialog-box-p): Fix conditions for GUI dialogs. 2023-04-02 10:34:43 +03:00
Yuan Fu
fb2c440920
; * lisp/progmodes/c-ts-mode.el (c++-ts-mode): Add some notice. 2023-04-01 23:14:45 -07:00
Jim Porter
89e337c3fc ; Make sure 'eshell-command' tests don't prompt the user
* test/lisp/eshell/eshell-tests.el
(eshell-test/eshell-command/background)
(eshell-test/eshell-command/background-pipeline): Wait for the process
to finish.
2023-04-01 10:28:02 -07:00
Michael Albinus
b39c3cd112 ; * etc/NEWS: Fix typos. 2023-04-01 17:04:50 +02:00
Eli Zaretskii
89ac5ba11c Fix ModelSim error regexp in vhdl-mode
* lisp/progmodes/vhdl-mode.el (vhdl-compiler-alist): Fix ModelSim
error regexp.  Suggested by Reto Zimmermann <reto@gnu.org>.
(Bug#62508)
2023-04-01 13:07:42 +03:00
Eli Zaretskii
24ed9c7ae7 ; * doc/emacs/trouble.texi (Checklist): Minor copyedits (bug#62320). 2023-04-01 13:00:36 +03:00
Eli Zaretskii
d1d39a0f09 Document enhancements in handling of echo-area messages
* etc/NEWS:
* doc/lispref/display.texi (Displaying Messages):
* lisp/minibuffer.el (inhibit-message-regexps)
(set-message-functions, inhibit-message, set-multi-message):
Improve the documentation of functions dealing with display of
echo-area messages.
2023-04-01 12:49:18 +03:00
Eli Zaretskii
46209b2453 ; Fix last change
* test/lisp/eshell/eshell-tests.el
(eshell-test/eshell-command/background-pipeline): Fix last change.
2023-04-01 09:55:29 +03:00
Eli Zaretskii
21a4ee209c Fix new Eshell tests on MS-Windows
* test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/background)
(eshell-test/eshell-command/background-pipeline): Allow for ".exe"
in the program's name.  This fixes these tests on MS-Windows.
2023-04-01 09:24:38 +03:00
Stefan Kangas
e2ebf3995d ; Auto-commit of loaddefs files. 2023-04-01 05:10:47 +02:00
Jim Porter
6419d78fa6 Fix using background commands in 'eshell-command'
Do not merge to master.

This regressed due to the patch for bug#53715, which changed how
Eshell pipelines return the processes in the pipeline (bug#62556).

* lisp/eshell/esh-cmd.el (eshell-eval-command): Allow process-pairs.

* test/lisp/eshell/eshell-tests.el (eshell-test/eshell-command/simple)
(eshell-test/eshell-command/pipeline)
(eshell-test/eshell-command/background)
(eshell-test/eshell-command/background-pipeline): New tests.
2023-03-31 13:07:36 -07:00
350 changed files with 130166 additions and 7878 deletions

View file

@ -21,6 +21,9 @@
(electric-quote-comment . nil)
(electric-quote-string . nil)
(mode . bug-reference-prog)))
(c-ts-mode . ((c-ts-mode-indent-style . gnu)
(indent-tabs-mode . t)
(mode . bug-reference-prog)))
(log-edit-mode . ((log-edit-font-lock-gnu-style . t)
(log-edit-setup-add-author . t)
(vc-git-log-edit-summary-target-len . 50)))

View file

@ -321,7 +321,7 @@ them right the first time, so here are guidelines for formatting them:
** Committing your changes.
When you commit changes, Git invokes several scripts that test the
commit for validity, and may abort the commit of some of the tests
commit for validity, and may abort the commit if some of the tests
fail. These scripts live in the '.git/hooks/' subdirectory of the
top-level directory of the repository, and they perform the following
tests:

View file

@ -1,8 +1,3 @@
2023-04-06 Po Lu <luangruo@yahoo.com>
* configure.ac: Detect what is necessary to start incremental
GC.
2022-02-18 Stefan Kangas <stefankangas@gmail.com>
* Version 28.3 released.

114348
ChangeLog.4 Normal file

File diff suppressed because it is too large Load diff

View file

@ -417,9 +417,9 @@ advice-on-failure:
sanity-check:
@[ -f .no-advice-on-failure ] && exit 0; true
@v=$$(src/emacs${EXEEXT} --batch --eval \
@v=`src/emacs${EXEEXT} --batch --eval \
'(progn (defun f (n) (if (= 0 n) 1 (* n (f (- n 1))))) (princ (f 10)))' \
2> /dev/null); \
2> /dev/null`; \
[ "X$$v" = "X3628800" ] && exit 0; \
echo >&2 '***'; \
echo >&2 '*** '"\"make ${make-target}\" succeeded, but Emacs is not functional."; \
@ -1030,6 +1030,9 @@ $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),distclean)
distclean: $(distclean_dirs:=_distclean) clean-gsettings-schemas
${top_distclean}
ifeq ($(HAVE_NATIVE_COMP),yes)
rm -rf native-lisp
endif
### 'bootstrap-clean'
### Delete everything that can be reconstructed by 'make' and that
@ -1284,7 +1287,7 @@ PREFERRED_BRANCH = emacs-28
preferred-branch-is-current:
git branch | grep -q '^\* $(PREFERRED_BRANCH)$$'
unchanged-history-files:
x=$$(git diff-files --name-only $(CHANGELOG_N) $(emacslog)) && \
x=`git diff-files --name-only $(CHANGELOG_N) $(emacslog)` && \
test -z "$$x"
# Regular expression that matches the newest commit covered by a ChangeLog.

View file

@ -182,7 +182,7 @@ files.")
("Philip Kaludercic" "Philip K\\." "Philip K")
("Philipp Stephani" "Philipp .*phst@google")
("Piotr Zieliński" "Piotr Zielinski")
("Po Lu" "Po Lu Via") ; looks like a mistake
("Po Lu" "Po Lu Via" "Your Name") ; looks like a mistake
("Przemysław Wojnowski" "Przemyslaw Wojnowski")
("R. Bernstein" "rb@dustyfeet.com")
("Rainer Schöpf" "Rainer Schoepf")

View file

@ -181,7 +181,7 @@ ${charsetdir}/GB180304.map: ${charsetdir}/GB180302.map ${gb180304}
${AM_V_GEN}$(AWK) -f ${gb180304} < $< > $@
${charsetdir}/JISX0201.map: ${GLIBC_CHARMAPS}/JIS_X0201.gz ${mapconv} ${compact}
${AM_V_GEN}(${mapconv} $< '/^<.*[ ]\/x[0-9]/' GLIBC-1 ${compact} && \
${AM_V_GEN}(${run_mapconv} $< '/^<.*[ ]\/x[0-9]/' GLIBC-1 ${compact} && \
echo "# Generated by hand" && \
echo "0xA1-0xDF 0xFF61" ) > $@

View file

@ -38,7 +38,8 @@
## So that eg [A-F] as used by KANJI-DATABASE branch below works as expected.
## Otherwise with LANG=en_US.utf8, CNS-6.map was generated with a
## bogus entry. By experiment, LC_COLLATE=C was not enough.
export LC_ALL=C
LC_ALL=C
export LC_ALL
BASE=`expr "$1" : '.*/\(.*\)' '|' "$1"` # basename
FILE="admin/charsets/mapfiles/$BASE"

View file

@ -68,16 +68,25 @@ General steps (for each step, check for possible errors):
PREFERRED_BRANCH = emacs-NN
where NN is the version on the release branch from which you are
producing the tarball. If NN is incorrect, update Makefile.in and
re-run 'configure' to update Makefile.
producing the tarball. If NN is incorrect (which it usually is
when starting a pretest of a new major release), update
Makefile.in and re-run 'configure' to update Makefile.
If the versioned ChangeLog.N file is too large, start a new one
by bumping N, and also update the line in top-level Makefile.in
which says
For the first pretest of a new major release, consider starting a
new top-level ChangeLog.N file if the last versioned ChangeLog.N
file is too large. A good point to start a new ChangeLog.N file
is when the last one gets larger than 1.5 MiB. If so, start a new
one by bumping N, and also update the line in top-level
Makefile.in which says
CHANGELOG_HISTORY_INDEX_MAX = N
by incrementing the value of N by 1; then regenerate Makefile.
After bumping N, you need to actually create and commit
ChangeLog.N with the updated N, otherwise "M-x authors" below will
fail. The easiest way of creating the new ChangeLog.N is to
rename the file ChangeLog (without the .N suffix) left over from
the last major release (it is usually unversioned) and commit it.
Now:
@ -99,11 +108,12 @@ General steps (for each step, check for possible errors):
the relevant entry. If a file was deleted or renamed, consider
adding an appropriate entry to variables authors-ignored-files,
authors-valid-file-names, or authors-renamed-files-alist in
authors.el.
authors.el. If some authors are "ignored", consider adding
entries to the author-aliases variable.
If necessary, repeat 'C-u M-x authors' after making those changes.
Save the "*Authors*" buffer as etc/AUTHORS.
Check the diff looks reasonable. Maybe add entries to
Check the diff looks reasonable. Maybe add more entries to
authors-ambiguous-files or authors-aliases, and repeat.
Commit any fixes to authors.el.
@ -169,7 +179,13 @@ General steps (for each step, check for possible errors):
messages from TeX, but those seem to be harmless, as the result
looks just fine.)
5. Copy lisp/loaddefs.el to lisp/ldefs-boot.el.
5. Copy lisp/loaddefs.el to lisp/ldefs-boot.el. After copying, edit
ldefs-boot.el to add
;; no-byte-compile: t
to its file-local variables section, otherwise make-dist will
complain.
Commit ChangeLog.N, etc/AUTHORS, lisp/ldefs-boot.el, and the files
changed by M-x set-version. Note that the set-version changes

View file

@ -83,6 +83,46 @@ Lisp packages, Makefiles, scripts, and other software could determine
whether they run on emba by checking for the environment variable
EMACS_EMBA_CI.
* Running Emba tests locally
As usual in GitLab, the tests run in containers, which could be
applied also locally. Unfortunately, the Emba container registry,
emba.gnu.org:5050, is not accessible publicly. Instead, the container
images must be build locally. Change the current directory to a
recent Emacs branch, and apply the command
docker build --target emacs-inotify --tag emacs-inotify \
-f test/infra/Dockerfile.emba .
This creates the Debian-based image emacs-inotify, based on the
instructions in the file Dockerfile.emba. This image is good for the
majority of tests. However, there are also other image build
instructions like emacs-filenotify-gio, emacs-eglot, emacs-gnustep and
emacs-native-comp-speed{0,1,2}. Use the appropriate one.
The image contains a directory "/checkout", which is a copy of your
local Emacs git repository. Emacs has been built in this directory
via "make bootstrap". In order to use the image, start a container
like
docker run --interactive --env EMACS_EMBA_CI=1 --name emacs-inotify \
emacs-inotify /bin/sh -i
In this container, change the current directory to "/checkout". Now
you can apply all commands known for Emacs, like
cd /checkout
make -C test files-tests.log
While this container runs, you can also access its filesystem from
your local Emacs via Tramp. For example, in order to see the result
of the above test run, open the log file in your local Emacs with
C-x C-f /docker:emacs-inotify:/checkout/test/lisp/files-tests.log
Note: On local Red Hat-based systems, use "podman" instead of "docker"
in the shell commands and Tramp file names.
This file is part of GNU Emacs.

View file

@ -340,7 +340,8 @@ git_config diff.texinfo.xfuncname \
tailored_hooks=
sample_hooks=
for hook in commit-msg pre-commit prepare-commit-msg; do
for hook in commit-msg pre-commit prepare-commit-msg post-commit \
pre-push commit-msg-files.awk; do
cmp -- build-aux/git-hooks/$hook "$hooks/$hook" >/dev/null 2>&1 ||
tailored_hooks="$tailored_hooks $hook"
done

View file

@ -0,0 +1,128 @@
# Check the file list of GNU Emacs change log entries for each commit SHA.
# Copyright 2023 Free Software Foundation, Inc.
# This file is part of GNU Emacs.
# GNU Emacs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
### Commentary:
# This script accepts a list of (unabbreviated) Git commit SHAs, and
# will then iterate over them to check that any files mentioned in the
# commit message are actually present in the commit's diff. If not,
# it will print out the incorrect file names and return 1.
# You can also pass "-v reason=pre-push", which will add more-verbose
# output, indicating the abbreviated commit SHA and first line of the
# commit message for any improper commits.
### Code:
function get_commit_changes(commit_sha, changes, cmd, i, j, len, \
bits, filename) {
# Collect all the files touched in the specified commit.
cmd = ("git show --name-status --first-parent --format= " commit_sha)
while ((cmd | getline) > 0) {
for (i = 2; i <= NF; i++) {
len = split($i, bits, "/")
for (j = 1; j <= len; j++) {
if (j == 1)
filename = bits[j]
else
filename = filename "/" bits[j]
changes[filename] = 1
}
}
}
close(cmd)
}
function check_commit_msg_files(commit_sha, verbose, changes, good, \
cmd, msg, filenames_str, filenames, i) {
get_commit_changes(commit_sha, changes)
good = 1
cmd = ("git log -1 --format=%B " commit_sha)
while ((cmd | getline) > 0) {
if (verbose && ! msg)
msg = $0
# Find file entries in the commit message. We look at any line
# starting with "*" (possibly prefixed by "; ") followed by a ":",
# possibly on a different line. If we encounter a blank line
# without seeing a ":", then we don't treat that as a file entry.
# Accumulate the contents of a (possible) file entry.
if (/^[ \t]*$/)
filenames_str = ""
else if (/^(; )?\*[ \t]+[[:alnum:]]/)
filenames_str = $0
else if (filenames_str)
filenames_str = (filenames_str $0)
# We have a file entry; analyze it.
if (filenames_str && /:/) {
# Delete the leading "*" and any trailing information.
sub(/^(; )?\*[ \t]+/, "", filenames_str)
sub(/[ \t]*[[(<:].*$/, "", filenames_str)
# There might be multiple files listed in this entry, separated
# by spaces (and possibly a comma). Iterate over each of them.
split(filenames_str, filenames, ",[ \t]+")
for (i in filenames) {
# Remove trailing slashes from any directory entries.
sub(/\/$/, "", filenames[i])
if (length(filenames[i]) && ! (filenames[i] in changes)) {
if (good) {
# Print a header describing the error.
if (verbose)
printf("In commit %s \"%s\"...\n", substr(commit_sha, 1, 10), msg)
printf("Files listed in commit message, but not in diff:\n")
}
printf(" %s\n", filenames[i])
good = 0
}
}
filenames_str = ""
}
}
close(cmd)
return good
}
BEGIN {
if (reason == "pre-push")
verbose = 1
}
/^[a-z0-9]{40}$/ {
if (! check_commit_msg_files($0, verbose)) {
status = 1
}
}
END {
if (status != 0) {
if (reason == "pre-push")
error_msg = "Push aborted"
else
error_msg = "Bad commit message"
printf("%s; please see the file 'CONTRIBUTE'\n", error_msg)
}
exit status
}

47
build-aux/git-hooks/post-commit Executable file
View file

@ -0,0 +1,47 @@
#!/bin/sh
# Check the file list of GNU Emacs change log entries after committing.
# Copyright 2023 Free Software Foundation, Inc.
# This file is part of GNU Emacs.
# GNU Emacs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
### Commentary:
# This hook runs after a commit is finalized and checks that the files
# mentioned in the commit message match the diff. We perform this in
# the post-commit phase so that we can be sure we properly detect all
# the files in the diff (this is difficult during the commit-msg hook,
# since there's no cross-platform way to detect when a commit is being
# amended).
# However, since this is a post-commit hook, it's too late to error
# out and abort the commit: it's already done! As a result, this hook
# is purely advisory, and instead we error out when trying to push
# (see "pre-push" in this directory).
### Code:
HOOKS_DIR=`dirname "$0"`
# Prefer gawk if available, as it handles NUL bytes properly.
if type gawk >/dev/null 2>&1; then
awk="gawk"
else
awk="awk"
fi
git rev-parse HEAD | $awk -v reason=post-commit \
-f "$HOOKS_DIR"/commit-msg-files.awk

88
build-aux/git-hooks/pre-push Executable file
View file

@ -0,0 +1,88 @@
#!/bin/sh
# Check the file list of GNU Emacs change log entries before pushing.
# Copyright 2023 Free Software Foundation, Inc.
# This file is part of GNU Emacs.
# GNU Emacs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
### Commentary:
# This hook runs before pushing a series of commits and checks that
# the files mentioned in each commit message match the diffs. This
# helps ensure that the resulting change logs are correct, which
# should prevent errors when generating etc/AUTHORS.
# These checks also happen in the "post-commit" hook (which see), but
# that hook can't abort a commit; it just advises the committer to fix
# the commit so that this hook runs without errors.
### Code:
HOOKS_DIR=`dirname "$0"`
# Prefer gawk if available, as it handles NUL bytes properly.
if type gawk >/dev/null 2>&1; then
awk="gawk"
else
awk="awk"
fi
# Standard input receives lines of the form:
# <local ref> SP <local sha> SP <remote ref> SP <remote sha> LF
$awk -v origin_name="$1" '
# If the local SHA is all zeroes, ignore it.
$2 ~ /^0{40}$/ {
next
}
# Check any lines with a valid local SHA and whose remote ref is
# master or an emacs-NN release branch. (We want to avoid checking
# feature or scratch branches here.)
$2 ~ /^[a-z0-9]{40}$/ && $3 ~ /^refs\/heads\/(master|emacs-[0-9]+)$/ {
newref = $2
# If the remote SHA is all zeroes, this is a new object to be
# pushed (likely a branch)...
if ($4 ~ /^0{40}$/) {
back = 0
# ... Go backwards until we find a SHA on an origin branch.
# Stop trying after 1000 commits, just in case...
for (back = 0; back < 1000; back++) {
cmd = ("git branch -r -l '\''" origin_name "/*'\''" \
" --contains " newref "~" back)
rv = (cmd | getline)
close(cmd)
if (rv > 0)
break;
}
cmd = ("git rev-parse " newref "~" back)
cmd | getline oldref
if (!(oldref ~ /^[a-z0-9]{40}$/)) {
# The SHA is misformatted! Skip this line.
next
}
close(cmd)
} else if ($4 ~ /^[a-z0-9]{40}$/) {
oldref = $4
} else {
# The SHA is misformatted! Skip this line.
next
}
# Print every SHA after oldref, up to (and including) newref.
system("git rev-list --first-parent --reverse " oldref ".." newref)
}
' | $awk -v reason=pre-push -f "$HOOKS_DIR"/commit-msg-files.awk

View file

@ -527,9 +527,6 @@ OPTION_DEFAULT_OFF([be-app],
OPTION_DEFAULT_OFF([be-cairo],
[enable use of cairo under Haiku's Application Kit])
OPTION_DEFAULT_OFF([incremental-gc],
[enable incremental garbage collector])
## Makefile.in needs the cache file name.
AC_SUBST([cache_file])
@ -1004,7 +1001,7 @@ AC_ARG_ENABLE([gcc-warnings],
# however, if there is also a .tarball-version file it is probably
# just a release imported into Git for patch management.
gl_gcc_warnings=no
if test -e "$srcdir"/.git && test ! -f "$srcdir"/.tarball-version; then
if test -d "$srcdir"/.git && test ! -f "$srcdir"/.tarball-version; then
# Clang typically identifies itself as GCC 4.2 or something similar
# even if it is recent enough to accept the warnings we enable.
AS_IF([test "$emacs_cv_clang" = yes],
@ -1646,7 +1643,8 @@ case "$opsys" in
## Motif needs -lgen.
unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
haiku) LIBS_SYSTEM="-lnetwork" ;;
# Haiku needs -lbsd for cfsetspeed.
haiku) LIBS_SYSTEM="-lnetwork -lbsd" ;;
esac
AC_SUBST([LIBS_SYSTEM])
@ -2036,31 +2034,23 @@ if test "${with_ns}" != no; then
ns_appresdir=${ns_appdir}/Contents/Resources
ns_appsrc=Cocoa/Emacs.base
ns_fontfile=macfont.o
elif flags=$( (gnustep-config --objc-flags) 2>/dev/null); then
elif flags=`(gnustep-config --objc-flags) 2>/dev/null`; then
NS_IMPL_GNUSTEP=yes
NS_GNUSTEP_CONFIG=yes
GNU_OBJC_CFLAGS="$flags"
LIBS_GNUSTEP=$(gnustep-config --gui-libs) || exit
LIBS_GNUSTEP=`gnustep-config --gui-libs || exit`
elif test -f $GNUSTEP_CONFIG_FILE; then
NS_IMPL_GNUSTEP=yes
dnl FIXME sourcing this several times in subshells seems inefficient.
GNUSTEP_SYSTEM_HEADERS=$(
. $GNUSTEP_CONFIG_FILE
AS_ECHO(["$GNUSTEP_SYSTEM_HEADERS"])
)
GNUSTEP_SYSTEM_LIBRARIES=$(
. $GNUSTEP_CONFIG_FILE
AS_ECHO(["$GNUSTEP_SYSTEM_LIBRARIES"])
)
GNUSTEP_SYSTEM_HEADERS=`. $GNUSTEP_CONFIG_FILE \
&& AS_ECHO(["$GNUSTEP_SYSTEM_HEADERS"])`
GNUSTEP_SYSTEM_LIBRARIES=` . $GNUSTEP_CONFIG_FILE \
&& AS_ECHO(["$GNUSTEP_SYSTEM_LIBRARIES"])`
dnl I seemed to need these as well with GNUstep-startup 0.25.
GNUSTEP_LOCAL_HEADERS=$(
. $GNUSTEP_CONFIG_FILE
AS_ECHO(["$GNUSTEP_LOCAL_HEADERS"])
)
GNUSTEP_LOCAL_LIBRARIES=$(
. $GNUSTEP_CONFIG_FILE
AS_ECHO(["$GNUSTEP_LOCAL_LIBRARIES"])
)
GNUSTEP_LOCAL_HEADERS=`. $GNUSTEP_CONFIG_FILE \
&& AS_ECHO(["$GNUSTEP_LOCAL_HEADERS"])`
GNUSTEP_LOCAL_LIBRARIES=`. $GNUSTEP_CONFIG_FILE \
&& AS_ECHO(["$GNUSTEP_LOCAL_LIBRARIES"])`
test "x${GNUSTEP_LOCAL_HEADERS}" != "x" && \
GNUSTEP_LOCAL_HEADERS="-I${GNUSTEP_LOCAL_HEADERS}"
test "x${GNUSTEP_LOCAL_LIBRARIES}" != "x" && \
@ -3783,7 +3773,7 @@ if test "${HAVE_X11}" = "yes"; then
AC_DEFINE([HAVE_OTF_GET_VARIATION_GLYPHS], [1],
[Define to 1 if libotf has OTF_get_variation_glyphs.])
fi
if ! $PKG_CONFIG --atleast-version=0.9.16 libotf; then
if $PKG_CONFIG --atleast-version=0.9.16 libotf; then :; else
AC_DEFINE([HAVE_OTF_KANNADA_BUG], [1],
[Define to 1 if libotf is affected by https://debbugs.gnu.org/28110.])
fi
@ -3891,7 +3881,7 @@ if test "${HAVE_BE_APP}" = "yes"; then
AC_DEFINE([HAVE_OTF_GET_VARIATION_GLYPHS], [1],
[Define to 1 if libotf has OTF_get_variation_glyphs.])
fi
if ! $PKG_CONFIG --atleast-version=0.9.16 libotf; then
if $PKG_CONFIG --atleast-version=0.9.16 libotf; then :; else
AC_DEFINE([HAVE_OTF_KANNADA_BUG], [1],
[Define to 1 if libotf is affected by https://debbugs.gnu.org/28110.])
fi
@ -4209,7 +4199,7 @@ module_env_snippet_27="$srcdir/src/module-env-27.h"
module_env_snippet_28="$srcdir/src/module-env-28.h"
module_env_snippet_29="$srcdir/src/module-env-29.h"
module_env_snippet_30="$srcdir/src/module-env-30.h"
emacs_major_version="${PACKAGE_VERSION%%.*}"
emacs_major_version=`AS_ECHO([$PACKAGE_VERSION]) | sed 's/[[.]].*//'`
AC_SUBST([emacs_major_version])
### Emacs Lisp native compiler support
@ -4319,14 +4309,16 @@ if test "${with_native_compilation}" != "no"; then
# available. (We filter out the gcc4 packages, because they
# don't support jit, and they have names like "gcc49" that
# sort later than "gcc11".)
PORT_PACKAGE=$(port installed active | grep '^ *gcc@<:@0-9@:>@* ' | \
PORT_PACKAGE=`port installed active | grep '^ *gcc@<:@0-9@:>@* ' | \
awk '{ print $1; }' | grep -v 'gcc4@<:@0-9@:>@' | \
sort -V | tail -n 1)
sort -V | tail -n 1`
if test -n "$PORT_PACKAGE"; then
MAC_CFLAGS="-I$(dirname $(port contents $PORT_PACKAGE | \
grep libgccjit.h))"
MAC_LIBS="-L$(dirname $(port contents $PORT_PACKAGE | \
grep libgccjit.dylib))"
emacs_val=`port contents $PORT_PACKAGE | grep libgccjit.h`
emacs_val=`dirname $emacs_val`
MAC_CFLAGS="-I$emacs_val"
emacs_val=`port contents $PORT_PACKAGE | grep libgccjit.dylib`
emacs_val=`dirname $emacs_val`
MAC_LIBS="-L$emacs_val"
fi
fi
@ -4996,7 +4988,7 @@ gai_strerror sync \
getpwent endpwent getgrent endgrent \
renameat2 \
cfmakeraw cfsetspeed __executable_start log2 pthread_setname_np \
pthread_set_name_np sysconf])
pthread_set_name_np])
LIBS=$OLD_LIBS
if test "$ac_cv_func_pthread_setname_np" = "yes"; then
@ -6538,174 +6530,6 @@ fi
AC_SUBST([WINDOW_SYSTEM_OBJ])
AC_DEFUN([emacs_PAGE_SIZE],
[
AC_CACHE_CHECK([for the page size, in bytes],
[emacs_cv_page_size],
[AS_IF([test "x$ac_cv_func_sysconf" = "xyes"],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([
AC_INCLUDES_DEFAULT
[#include <stdio.h>
]],[[
FILE *file;
long pagesize;
file = fopen ("conftest.out", "w");
if (!file)
exit (1);
#ifdef _SC_PAGESIZE
pagesize = sysconf (_SC_PAGESIZE);
#else /* !_SC_PAGESIZE */
pagesize = sysconf (_SC_PAGE_SIZE);
#endif
if (pagesize < 0)
exit (1);
fprintf (file, "%ld\n", pagesize);
fflush (file);
fclose (file);
exit (0);
]])], [emacs_cv_page_size=`cat conftest.out`],
[AC_MSG_ERROR([Could not determine the page size])])],
[AS_IF([test "x$ac_cv_func_getpagesize" = "xyes"],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([
AC_INCLUDES_DEFAULT
[#include <stdio.h>
]],[[
FILE *file;
long pagesize;
file = fopen ("conftest.out", "w");
if (!file)
exit (1);
pagesize = getpagesize ();
if (pagesize < 0)
exit (1);
fprintf (file, "%ld\n", pagesize);
fflush (file);
fclose (file);
exit (0);
]])], [emacs_cv_page_size=`cat conftest.out`],
[AC_MSG_ERROR([Could not determine the page size])])])])])
AC_DEFINE_UNQUOTED([EMACS_PAGE_SIZE], [$emacs_cv_page_size],
[Define to the system page size, in bytes.])
])
AC_DEFUN([emacs_WRITE_FAULT_SIGNAL],
[
AC_CHECK_FUNCS([posix_memalign aligned_alloc valloc memalign])
AS_CASE(["$ac_cv_func_posix_memalign$ac_cv_func_aligned_alloc\
$ac_cv_func_valloc$ac_cv_func_memalign"], [*yes*], [],
[AC_MSG_ERROR([Cannot find a way to allocate page aligned memory])])
AC_CACHE_CHECK([for signal sent upon writing to protected memory],
[emacs_cv_protection_fault_signal],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([
AC_INCLUDES_DEFAULT
[
#include <sys/mman.h>
#if defined HAVE_VALLOC || defined HAVE_MEMALIGN
#include <malloc.h>
#endif /* HAVE_VALLOC || HAVE_MEMALIGN */
#include <stdio.h>
#include <signal.h>
#include <setjmp.h>
static volatile int sentsig;
static jmp_buf env;
static void
handlesigbus (signal)
int signal;
{
sentsig = SIGBUS;
longjmp (env, 1);
}
static void
handlesigsegv (signal)
int signal;
{
sentsig = SIGSEGV;
longjmp (env, 1);
}
]], [[
char *mem;
FILE *file;
signal (SIGBUS, handlesigbus);
signal (SIGSEGV, handlesigsegv);
#ifdef HAVE_ALIGNED_ALLOC
mem = aligned_alloc (EMACS_PAGE_SIZE, EMACS_PAGE_SIZE);
if (!mem)
exit (1);
#elif defined HAVE_POSIX_MEMALIGN
if (posix_memalign (&mem, EMACS_PAGE_SIZE,
EMACS_PAGE_SIZE))
exit (1);
#elif defined HAVE_MEMALIGN
mem = memalign (EMACS_PAGE_SIZE, EMACS_PAGE_SIZE);
if (!mem)
exit (1);
#elif defined HAVE_VALLOC
mem = valloc (EMACS_PAGE_SIZE);
if (!mem)
exit (1);
#endif
mprotect (mem, EMACS_PAGE_SIZE, PROT_READ);
if (!setjmp (env))
*mem = 1;
if (!sentsig)
exit (1);
file = fopen ("conftest.out", "w");
if (sentsig == SIGBUS)
{
fputs ("SIGBUS\n", file);
fflush (file);
fclose (file);
}
else
{
fputs ("SIGSEGV\n", file);
fflush (file);
fclose (file);
}
exit (0);
]])],
[emacs_cv_protection_fault_signal=`cat conftest.out`],
[AC_MSG_ERROR([Could not determine whether to use SIGBUS])])])
AC_DEFINE_UNQUOTED([WRITE_PROTECT_SIGNAL],
[$emacs_cv_protection_fault_signal],
[Signal sent upon a write protection fault.])
])
dnl Incremental GC setup.
dnl Determine the page size of the system.
dnl Then determine the signal raised during write
dnl protection faults.
AS_IF([test x"$with_incremental_gc" = x"yes"],
# Look for mprotect.
[AC_CHECK_FUNC([mprotect], [],
[AC_MSG_ERROR([mprotect not found.])])
# Determine the page size.
emacs_PAGE_SIZE
# Determine the signal raised due to a memory protection faults.
emacs_WRITE_FAULT_SIGNAL
# Finally, enable the incremental garbage collector.
AC_DEFINE([USE_INCREMENTAL_GC], [1],
[Define to 1 if garbage collection should run incrementally])])
AH_TOP([/* GNU Emacs site configuration template file.
Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2021

View file

@ -1245,6 +1245,7 @@ Manual}.
These four keywords are not really variables; setting them in any
other context has no special meaning.
@cindex fallback modes
If you're editing a file across Emacs versions, and a new mode has
been introduced to handle a file in a newer Emacs version, you can use
several @code{mode} entries to use the new mode (called

View file

@ -2289,10 +2289,15 @@ behavior by using the options @code{image-auto-resize} and
@code{image-auto-resize-on-window-resize}.
@findex image-transform-fit-to-window
@kindex s w (Image mode)
@findex image-transform-set-percent
@kindex s p (Image mode)
@findex image-transform-set-scale
@kindex s s (Image mode)
@findex image-transform-reset-to-initial
@kindex s 0 (Image mode)
@findex image-transform-reset-to-original
@kindex s o (Image mode)
To resize the image manually you can use the command
@code{image-transform-fit-to-window} bound to @kbd{s w} that fits the
image to both the window height and width. To scale the image to a
@ -2353,6 +2358,94 @@ frames at once. You can go to a specific frame with @kbd{F}
(@code{image-reverse-speed}) reverses it. The command @kbd{a 0}
(@code{image-reset-speed}) resets the speed to the original value.
In addition to the above key bindings, which are specific to Image
mode, images shown in any Emacs buffer have special key bindings when
point is at or inside the image:
@table @kbd
@cindex resize images
@cindex image resize
@findex image-increase-size
@kindex i + (Image mode)
@item i +
Increase the image size (@code{image-increase-size}) by 20%. Prefix
numeric argument controls the increment; the value of @var{n} means to
multiply the size by the factor of @w{@code{1 + @var{n} / 10}}, so
@w{@kbd{C-u 5 i +}} means to increase the size by 50%.
@findex image-decrease-size
@kindex i - (Image mode)
@item i -
Decrease the image size (@code{image-increase-size}) by 20%. Prefix
numeric argument controls the decrement; the value of @var{n} means to
multiply the size by the factor of @w{@code{1 - @var{n} / 10}}, so
@w{@kbd{C-u 3 i -}} means to decrease the size by 30%.
@cindex rotating images
@cindex image rotation
@findex image-rotate
@kindex i r (Image mode)
@item i r
Rotate the image by 90 degrees clockwise (@code{image-rotate}).
With the prefix argument, rotate by 90 degrees counter-clockwise instead.
Note that this command is not available for sliced images.
@findex image-flip-horizontally
@kindex i h (Image mode)
@item i h
Flip the image horizontally (@code{image-flip-horizontally}). This
presents the image as if reflected in a vertical mirror.
Note that this command is not available for sliced images.
@findex image-flip-vertically
@kindex i v (Image mode)
@item i v
Flip the image vertically (@code{image-flip-vertically}). This
presents the image as if reflected in a horizontal mirror.
Note that this command is not available for sliced images.
@findex image-save
@kindex i o (Image mode)
@item i o
Save the image to a file (@code{image-save}). This command prompts
you for the name of the file to save the image.
@cindex cropping images
@vindex image-crop-crop-command
@findex image-crop
@kindex i c (Image mode)
@item i c
Crop the image (@code{image-crop}). This command is available only if
your system has an external program installed that can be used for
cropping and cutting of images; the user option
@code{image-crop-crop-command} determines what program to use, and
defaults to the ImageMagick's @command{convert} program. The command
displays the image with a rectangular frame superimposed on it, and
lets you use the mouse to move and resize the frame. Type @kbd{m} to
cause mouse movements to move the frame instead of resizing it; type
@kbd{s} to move a square frame instead. When you are satisfied with
the position and size of the cropping frame, type @kbd{@key{RET}} to
actually crop the part under the frame; or type @kbd{q} to exit
without cropping. You can then save the cropped image using @w{@kbd{i
o}} or @w{@kbd{M-x image-save}}.
@findex image-cut
@kindex i x (Image mode)
@vindex image-cut-color
@vindex image-crop-cut-command
@item i x
Cut a rectangle from the image (@code{image-cut}). This works the
same as @code{image-crop} (and also requires an external program,
defined by the variable @code{image-crop-cut-command}, to perform the
image cut), but instead of cropping the image, it removes the part
inside the frame and fills that part with the color specified by
@code{image-cut-color}. With prefix argument, the command prompts for
the color to use.
@end table
The size and rotation commands are ``repeating'', which means that you
can continue adjusting the image without using the @kbd{i} prefix.
@cindex ImageMagick support
@vindex imagemagick-enabled-types
@vindex imagemagick-types-inhibit

View file

@ -313,19 +313,27 @@ may be defined in your Emacs session. For example, if a command
called @code{authorize-me} was defined, Emacs could only complete
as far as @samp{aut}.)
If you type @key{TAB} again immediately, it cannot determine the
next character; it could be @samp{-}, @samp{a}, or @samp{c}. So it
does not add any characters; instead, @key{TAB} displays a list of all
possible completions in another window.
If you type @kbd{@key{TAB}} again immediately, it cannot determine
the next character; it could be @samp{-}, @samp{a}, or @samp{c}. So
it does not add any characters; instead, @key{TAB} displays a list of
all possible completions in another window.
Next, type @kbd{-f}. The minibuffer now contains @samp{auto-f}, and
the only command name that starts with this is @code{auto-fill-mode}.
If you now type @key{TAB}, completion fills in the rest of the
If you now type @kbd{@key{TAB}}, completion fills in the rest of the
argument @samp{auto-fill-mode} into the minibuffer.
Hence, typing just @kbd{a u @key{TAB} - f @key{TAB}} allows you to
enter @samp{auto-fill-mode}.
@key{TAB} also works while point is not at the end of the
minibuffer. In that case, it will fill in text both at point and at
the end of the minibuffer. If you type @kbd{M-x autocm}, then press
@kbd{C-b} to move point before the @samp{m}, you can type
@kbd{@key{TAB}} to insert the text @samp{onf-} at point and @samp{ode}
at the end of the minibuffer, so that the minibuffer contains
@samp{autoconf-mode}.
@node Completion Commands
@subsection Completion Commands

View file

@ -329,15 +329,15 @@ version of the package, a newer version is also installed.
@section Package Installation
@findex package-install
@findex package-update
@findex package-update-all
@findex package-upgrade
@findex package-upgrade-all
Packages are most conveniently installed using the package menu
(@pxref{Package Menu}), but you can also use the command @kbd{M-x
package-install}. This prompts for the name of a package with the
@samp{available} status, then downloads and installs it. Similarly,
if you want to update a package, you can use the @kbd{M-x
package-update} command, and if you just want to update all the
packages, you can use the @kbd{M-x package-update-all} command.
if you want to upgrade a package, you can use the @kbd{M-x
package-upgrade} command, and if you want to upgrade all the packages,
you can use the @kbd{M-x package-upgrade-all} command.
@cindex package requirements
A package may @dfn{require} certain other packages to be installed,
@ -551,8 +551,8 @@ bugs.
source code for a package directly from source. The command will also
automatically ensure that all files are byte-compiled and auto-loaded,
just like with a regular package. Packages installed this way behave
just like any other package. You can update them using
@code{package-update} or @code{package-update-all} and delete them
just like any other package. You can upgrade them using
@code{package-upgrade} or @code{package-upgrade-all} and delete them
again using @code{package-delete}. They are even displayed in the
regular package listing. If you just wish to clone the source of a
package, without adding it to the package list, use
@ -578,3 +578,80 @@ from the package directory (@pxref{Package Files}) to your checkout
and initializes the code. Note that you might have to use
@code{package-vc-refresh} to repeat the initialization and update the
autoloads.
@subsection Specifying Package Sources
@cindex package specification
@cindex specification, for source packages
To install a package from source, Emacs must know where to get the
package's source code (such as a code repository) and basic
information about the structure of the code (such as the main file in
a multi-file package). A @dfn{package specification} describes these
properties.
When supported by a package archive (@pxref{Package
Archives,,,elisp, The Emacs Lisp Reference Manual}), Emacs can
automatically download a package's specification from said archive.
If the first argument passed to @code{package-vc-install} is a symbol
naming a package, then Emacs will use the specification provided by
the archive for that package.
@example
@group
;; Emacs will download BBDB's specification from GNU ELPA:
(package-vc-install 'bbdb)
@end group
@end example
The first argument to @code{package-vc-install} may also be a
package specification. This allows you to install source packages
from locations other than the known archives listed in the user option
@code{package-archives}. A package specification is a list of the
form @code{(@var{name} . @var{spec})}, in which @var{spec} should be a
property list using any of the keys in the table below.
For definitions of basic terms for working with code repositories and
version control systems, see @ref{VCS Concepts,,,emacs, The GNU Emacs
Manual}.
@table @code
@item :url
A string providing the URL that specifies the repository from which to
fetch the package's source code.
@item :branch
A string providing the revision of the code to install. Do not
confuse this with a package's version number.
@item :lisp-dir
A string providing the repository-relative name of the directory to
use for loading the Lisp sources, which defaults to the root directory
of the repository.
@item :main-file
A string providing the main file of the project, from which to gather
package metadata. If not given, the default is the package name with
".el" appended to it.
@item :doc
A string providing the repository-relative name of the documentation
file from which to build an Info file. This can be a Texinfo file or
an Org file.
@item :vc-backend
A symbol naming the VC backend to use for downloading a copy of the
package's repository (@pxref{Version Control Systems,,,emacs, The GNU
Emacs Manual}). If omitted, Emacs will attempt to make a guess based
on the provided URL, or, failing that, the process will fall back onto
the value of @code{package-vc-default-backend}.
@end table
@example
@group
;; Specifying information manually:
(package-vc-install
'(bbdb :url "https://git.savannah.nongnu.org/git/bbdb.git"
:lisp-dir "lisp"
:doc "doc/bbdb.texi"))
@end group
@end example

View file

@ -856,7 +856,7 @@ customizations.
@cindex dribble file
@cindex logging keystrokes
One way to record the input to Emacs precisely is to write a dribble
file. To start the file, use the @kbd{M-x open-dribble-file} command.
file. To start the file, use the command @w{@kbd{M-x open-dribble-file}}.
From then on, Emacs copies all your input to the specified dribble
file until the Emacs process is killed. Be aware that sensitive
information (such as passwords) may end up recorded in the dribble
@ -1071,9 +1071,13 @@ backtrace for the error. To make a backtrace for the error, use
say, you must give that command and then make the bug happen). This
causes the error to start the Lisp debugger, which shows you a
backtrace. Copy the text of the debugger's backtrace into the bug
report. @xref{Edebug,, Edebug, elisp, the Emacs Lisp Reference
Manual}, for information on debugging Emacs Lisp programs with the
Edebug package.
report. (The backtrace is more detailed if you load the relevant Lisp
@file{*.el} source files before triggering the error, so do that if
you know how to find and load those files.)
To debug the error, we suggest using Edebug. @xref{Edebug,, Edebug,
elisp, the Emacs Lisp Reference Manual}, for information on debugging
Emacs Lisp programs with the Edebug package.
This use of the debugger is possible only if you know how to make the
bug happen again. If you can't make it happen again, at least copy

View file

@ -6604,10 +6604,11 @@ works. You will probably need to use @kbd{C-h f}
(@code{describe-function}). The newer version uses a conditional to
determine whether the buffer has been narrowed.
(Also, it uses @code{line-number-at-pos}, which among other simple
expressions, such as @code{(goto-char (point-min))}, moves point to
the beginning of the current line with @code{(forward-line 0)} rather
than @code{beginning-of-line}.)
Also, the modern version of @code{what-line} uses
@code{line-number-at-pos}, which among other simple expressions, such
as @code{(goto-char (point-min))}, moves point to the beginning of the
current line with @code{(forward-line 0)} rather than
@code{beginning-of-line}.)
The @code{what-line} function as shown here has a documentation line
and is interactive, as you would expect. The next two lines use the

View file

@ -959,9 +959,9 @@ infinite recursion.
@defun buffer-match-p condition buffer-or-name &optional arg
This function checks if a buffer designated by @code{buffer-or-name}
satisfies a @code{condition}. Optional third argument @var{arg} is
passed to the predicate function in @var{condition}. A condition can
be one of the following:
satisfies the specified @code{condition}. Optional third argument
@var{arg} is passed to the predicate function in @var{condition}. A
valid @var{condition} can be one of the following:
@itemize @bullet{}
@item
A string, interpreted as a regular expression. The buffer
@ -990,21 +990,23 @@ Satisfied if @emph{all} the conditions in @var{conds} satisfy
Satisfied if the buffer's major mode derives from @var{expr}.
@item major-mode
Satisfied if the buffer's major mode is equal to @var{expr}. Prefer
using @code{derived-mode} instead when both can work.
using @code{derived-mode} instead, when both can work.
@end table
@item t
Satisfied by any buffer. A convenient alternative to @code{""} (empty
string), @code{(and)} (empty conjunction) or @code{always}.
string) or @code{(and)} (empty conjunction).
@end itemize
@end defun
@defun match-buffers condition &optional buffer-list arg
This function returns a list of all buffers that satisfy a
@code{condition}, as defined for @code{buffer-match-p}. By default
all buffers are considered, but this can be restricted via the second
optional @code{buffer-list} argument. Optional third argument
@var{arg} will be used by @var{condition} in the same way as
@code{buffer-match-p} does.
This function returns a list of all buffers that satisfy the
@code{condition}. If no buffers match, the function returns
@code{nil}. The argument @var{condition} is as defined in
@code{buffer-match-p} above. By default, all the buffers are
considered, but this can be restricted via the optional argument
@code{buffer-list}, which should be a list of buffers to consider.
Optional third argument @var{arg} will be passed to @var{condition} in
the same way as @code{buffer-match-p} does.
@end defun
@node Creating Buffers

View file

@ -1960,8 +1960,8 @@ end-position of a drag event, this position list may represent a
location outside the boundaries of the initially selected frame, in
which case the list contains that frame in place of a window.
The special form @code{track-mouse} enables generation of motion
events within its body. Outside of @code{track-mouse} forms, Emacs
The @code{track-mouse} macro enables generation of motion
events within its body. Outside of @code{track-mouse} body, Emacs
does not generate events for mere motion of the mouse, and these
events do not appear. @xref{Mouse Tracking}.
@ -2395,6 +2395,17 @@ as @code{set-language-environment}), use the
;; Get the full localized name of the language
(w32-get-locale-info language-id t)
@end smallexample
@cindex @code{end-session} event
@item end-session
This event is generated on MS-Windows when the operating system
informs Emacs that the user terminated the interactive session, or
that the system is shutting down. The standard definition of this
event is to invoke the @code{kill-emacs} command (@pxref{Killing
Emacs}) so as to shut down Emacs in an orderly fashion; if there are
unsaved changes, this will produce auto-save files
(@pxref{Auto-Saving}) that the user can use after restarting the
session to restore the unsaved edits.
@end table
If one of these events arrives in the middle of a key sequence---that
@ -2443,7 +2454,7 @@ into another window. That produces a pair of events like these:
The frame with input focus might not take up the entire screen, and
the user might move the mouse outside the scope of the frame. Inside
the @code{track-mouse} special form, that produces an event like this:
the @code{track-mouse} macro, that produces an event like this:
@smallexample
(mouse-movement (#<frame *ielm* 0x102849a30> nil (563 . 205) 532301936))

View file

@ -1809,6 +1809,9 @@ wish the program to continue execution despite an error in a subroutine.
In these cases, you would use @code{condition-case} to establish
@dfn{error handlers} to recover control in case of error.
For reporting problems without terminating the execution of the
current command, consider issuing a warning instead. @xref{Warnings}.
Resist the temptation to use error handling to transfer control from
one part of the program to another; use @code{catch} and @code{throw}
instead. @xref{Catch and Throw}.

View file

@ -264,11 +264,12 @@ have any number of prefixes.
@end table
@cindex @code{custom-group} property
The variables and subgroups of a group are stored in the
The variables, faces, and subgroups of a group are stored in the
@code{custom-group} property of the group's symbol. @xref{Symbol
Plists}. The value of that property is a list of pairs whose
@code{car} is the variable or subgroup symbol and the @code{cdr} is
either @code{custom-variable} or @code{custom-group}.
@code{car} is the symbol of the variable or the face or the subgroup,
and the @code{cdr} is one of the corresponding symbols
@code{custom-variable}, @code{custom-face}, or @code{custom-group}.
@end defmac
@defopt custom-unlispify-remove-prefixes

View file

@ -310,29 +310,29 @@ reformatted, with undesirable results. Instead, use @code{(message
"%s" @var{string})}.
@end defun
The following facilities allow users and Lisp programs to control how
echo-area messages are displayed.
@defvar set-message-function
If this variable is non-@code{nil}, it should be a function of one
argument, the text of a message to display in the echo area. This
argument, the text of a message to display in the echo area. That
function will be called by @code{message} and related functions. If
the function returns @code{nil}, the message is displayed in the echo
area as usual. If this function returns a string, that string is
displayed in the echo area instead of the original one. If this
function returns other non-@code{nil} values, that means the message
was already handled, so @code{message} will not display anything in
the echo area. See also @code{clear-message-function} that can be
used to clear the message displayed by this function.
area as usual. If the function returns a string, that string is
displayed in the echo area @emph{instead} of the original message. If
the function returns any other non-@code{nil} value, that means the
message was already handled, so @code{message} will not display
anything in the echo area.
The default value is the function that displays the message at the end
of the minibuffer when the minibuffer is active. However, if the text
shown in the active minibuffer has the @code{minibuffer-message} text
property (@pxref{Special Properties}) on some character, the message
will be displayed before the first character having that property.
The default value calls @code{set-minibuffer-message}, described
below.
@end defvar
@defvar clear-message-function
If this variable is non-@code{nil}, @code{message} and related
functions call it with no arguments when their argument message is
@code{nil} or the empty string.
If this variable is non-@code{nil}, it should be a function of no
arguments; @code{message} and related functions call it when their
argument message is @code{nil} or the empty string, to clear the echo
area.
Usually this function is called when the next input event arrives
after displaying an echo-area message. The function is expected to
@ -358,11 +358,51 @@ with the same text; if the last function in the list returns
function returns a non-@code{nil} value that is not a string, the
message is considered to be handled, and no further functions in the
list are called.
The three useful functions to be put in the list that is the value of
this option are described below.
@end defopt
@defun set-minibuffer-message message
This function displays @var{message} in the echo-area when the
minibuffer is not active, and at the end of the minibuffer when the
minibuffer is active. However, if the text shown in the active
minibuffer has the @code{minibuffer-message} text property
(@pxref{Special Properties}) on some character, the message will be
displayed before the first character having that property.
This function is by default the only member of the list in
@code{set-message-functions}.
@end defun
@vindex inhibit-message-regexps
@defun inhibit-message message
If an echo-area @var{message} matches any regexp in the list that is
the value of the user option @code{inhibit-message-regexps}, this
function suppresses the display of that message and returns a
non-@code{nil} value that is not a string. Thus, if this function is
in the list @code{set-message-functions}, the rest of the functions in
the list will not be called when @var{message} matches the regexps in
@code{inhibit-message-regexps}. To ensure a matching @var{message}
will never be displayed, make this function be the first element of
the list in @code{set-message-functions}.
@end defun
@vindex multi-message-max
@vindex multi-message-timeout
@defun set-multi-message message
This function accumulates several echo-area messages emitted one after
another, and returns them as a single string in which individual
messages are separated by newlines. Up to @code{multi-message-max}
recent messages can be accumulated. The accumulated messages are
discarded when more than @code{multi-message-timeout} seconds have
elapsed since the time the first message was emitted.
@end defun
@defvar inhibit-message
When this variable is non-@code{nil}, @code{message} and related functions
will not use the Echo Area to display messages.
will not display any messages in the Echo Area. Echo-area messages
are still logged in the @file{*Messages*} buffer, though.
@end defvar
@defmac with-temp-message message &rest body
@ -712,7 +752,8 @@ echo area (which is really a special use of the minibuffer window;
@cindex warnings
@dfn{Warnings} are a facility for a program to inform the user of a
possible problem, but continue running.
possible problem, but continue running (as opposed to signaling an
error, @pxref{Errors}).
@menu
* Warning Basics:: Warnings concepts and functions to report them.
@ -725,69 +766,74 @@ possible problem, but continue running.
@subsection Warning Basics
@cindex severity level
Every warning has a textual message, which explains the problem for
the user, and a @dfn{severity level} which is a symbol. Here are the
possible severity levels, in order of decreasing severity, and their
meanings:
Every warning is a textual message, which explains the problem for
the user, with the associated @dfn{severity level} which is a symbol.
Here are the supported severity levels, in order of decreasing
severity, and their meanings:
@table @code
@item :emergency
A problem that will seriously impair Emacs operation soon
if you do not attend to it promptly.
if the user does not attend to it promptly.
@item :error
A report of data or circumstances that are inherently wrong.
A report about data or circumstances that are inherently wrong.
@item :warning
A report of data or circumstances that are not inherently wrong, but
raise suspicion of a possible problem.
A report about data or circumstances that are not inherently wrong,
but raise suspicion of a possible problem.
@item :debug
A report of information that may be useful if you are debugging.
A report of information that may be useful if the user is currently
debugging the Lisp program which issues the warning.
@end table
When your program encounters invalid input data, it can either
signal a Lisp error by calling @code{error} or @code{signal} or report
a warning with severity @code{:error}. Signaling a Lisp error is the
easiest thing to do, but it means the program cannot continue
processing. If you want to take the trouble to implement a way to
continue processing despite the bad data, then reporting a warning of
severity @code{:error} is the right way to inform the user of the
problem. For instance, the Emacs Lisp byte compiler can report an
error that way and continue compiling other functions. (If the
program signals a Lisp error and then handles it with
@code{condition-case}, the user won't see the error message; it could
show the message to the user by reporting it as a warning.)
signal a Lisp error by calling @code{error} or @code{signal}
(@pxref{Signaling Errors}) or report a warning with severity
@code{:error}. Signaling a Lisp error is the easiest thing to do, but
it means the signaling program cannot continue execution. If you want
to take the trouble of implementing a way to continue processing
despite the invalid data, then reporting a warning of severity
@code{:error} is the right way of informing the user of the problem.
For instance, the Emacs Lisp byte compiler can report an error that
way and continue compiling other functions. (If the program signals a
Lisp error and then handles it with @code{condition-case}, the user
won't see the error message; reporting that as a warning instead
avoids that problem.)
@c FIXME: Why use "(bytecomp)" instead of "'bytecomp" or simply
@c "bytecomp" here? The parens are part of warning-type-format but
@c not part of the warning type. --xfq
@cindex warning type
Each warning has a @dfn{warning type} to classify it. The type is a
list of symbols. The first symbol should be the custom group that you
use for the program's user options. For example, byte compiler
warnings use the warning type @code{(bytecomp)}. You can also
subcategorize the warnings, if you wish, by using more symbols in the
list.
In addition to severity level, each warning has a @dfn{warning type}
to classify it. The warning type is either a symbol or a list of
symbols. If it is a symbol, it should be the custom group that you
use for the program's user options; if it is a list, the first element
of the list should be that custom group. For example, byte compiler
warnings use the warning type @code{(bytecomp)}. If the warning type
is a list, the elements of the list after the first one, which should
be arbitrary symbols, represent subcategories of the warning: they
will be displayed to the user to better explain the nature of the
warning.
@defun display-warning type message &optional level buffer-name
This function reports a warning, using @var{message} as the message
and @var{type} as the warning type. @var{level} should be the
severity level, with @code{:warning} being the default.
This function reports a warning, using the string @var{message} as the
warning text and @var{type} as the warning type. @var{level} should
be the severity level, and defaults to @code{:warning} if omitted or
@code{nil}.
@var{buffer-name}, if non-@code{nil}, specifies the name of the buffer
for logging the warning. By default, it is @file{*Warnings*}.
for logging the warning message. By default, it is @file{*Warnings*}.
@end defun
@defun lwarn type level message &rest args
This function reports a warning using the value of @code{(format-message
@var{message} @var{args}...)} as the message in the @file{*Warnings*}
buffer. In other respects it is equivalent to @code{display-warning}.
This function reports a warning using the value returned by
@w{@code{(format-message @var{message} @var{args}@dots{})}} as the
message text in the @file{*Warnings*} buffer. In other respects it is
equivalent to @code{display-warning}.
@end defun
@defun warn message &rest args
This function reports a warning using the value of @code{(format-message
@var{message} @var{args}...)} as the message, @code{(emacs)} as the
type, and @code{:warning} as the severity level. It exists for
compatibility only; we recommend not using it, because you should
specify a specific warning type.
This function reports a warning using the value returned by
@w{@code{(format-message @var{message} @var{args}@dots{})}} as the
message text, @code{emacs} as the warning type, and @code{:warning} as
the severity level. It exists for compatibility only; we recommend
not using it, because you should specify a specific warning type.
@end defun
@node Warning Variables
@ -802,15 +848,16 @@ This list defines the meaning and severity order of the warning
severity levels. Each element defines one severity level,
and they are arranged in order of decreasing severity.
Each element has the form @code{(@var{level} @var{string}
@var{function})}, where @var{level} is the severity level it defines.
@var{string} specifies the textual description of this level.
@var{string} should use @samp{%s} to specify where to put the warning
type information, or it can omit the @samp{%s} so as not to include
that information.
Each element has the form @w{@code{(@var{level} @var{string}
[@var{function}])}}, where @var{level} is the severity level it
defines. @var{string} specifies the textual description of this
level. @var{string} should use @samp{%s} to specify where to put the
warning type information, or it can omit the @samp{%s} so as not to
include that information.
The optional @var{function}, if non-@code{nil}, is a function to call
with no arguments, to get the user's attention.
with no arguments, to get the user's attention. A notable example is
@code{ding} (@pxref{Beeping}).
Normally you should not change the value of this variable.
@end defvar
@ -819,18 +866,19 @@ Normally you should not change the value of this variable.
If non-@code{nil}, the value is a function to generate prefix text for
warnings. Programs can bind the variable to a suitable function.
@code{display-warning} calls this function with the warnings buffer
current, and the function can insert text in it. That text becomes
the beginning of the warning message.
the current buffer, and the function can insert text into it. That
text becomes the beginning of the warning message.
The function is called with two arguments, the severity level and its
entry in @code{warning-levels}. It should return a list to use as the
entry (this value need not be an actual member of
@code{warning-levels}). By constructing this value, the function can
change the severity of the warning, or specify different handling for
a given severity level.
entry in @code{warning-levels}. It should return a list to use
@emph{instead} of that entry (the value need not be an actual member
of @code{warning-levels}, but it must have the same structure). By
constructing this value, the function can change the severity of the
warning, or specify different handling for a given severity level.
If the variable's value is @code{nil} then there is no function
to call.
If the variable's value is @code{nil}, there's no prefix text, before
the warning is displayed, starting with the @var{string} part of the
entry in @code{warning-levels} corresponding to the warning's level.
@end defvar
@defvar warning-series
@ -838,17 +886,18 @@ Programs can bind this variable to @code{t} to say that the next
warning should begin a series. When several warnings form a series,
that means to leave point on the first warning of the series, rather
than keep moving it for each warning so that it appears on the last one.
The series ends when the local binding is unbound and
The series ends when the local binding of this variable is unbound and
@code{warning-series} becomes @code{nil} again.
The value can also be a symbol with a function definition. That is
equivalent to @code{t}, except that the next warning will also call
the function with no arguments with the warnings buffer current. The
function can insert text which will serve as a header for the series
of warnings.
the function with no arguments with the warnings buffer the current
buffer. The function can, for example, insert text which will serve
as a header for the series of warnings.
Once a series has begun, the value is a marker which points to the
buffer position in the warnings buffer of the start of the series.
Once a series has begun, the value of this variable is a marker which
points to the buffer position in the warnings buffer of the start of
the series.
The variable's normal value is @code{nil}, which means to handle
each warning separately.
@ -856,7 +905,7 @@ each warning separately.
@defvar warning-fill-prefix
When this variable is non-@code{nil}, it specifies a fill prefix to
use for filling each warning's text.
use for filling the text of each warning.
@end defvar
@defvar warning-fill-column
@ -865,11 +914,11 @@ The column at which to fill warnings.
@defvar warning-type-format
This variable specifies the format for displaying the warning type
in the warning message. The result of formatting the type this way
in the warning text. The result of formatting the type this way
gets included in the message under the control of the string in the
entry in @code{warning-levels}. The default value is @code{" (%s)"}.
If you bind it to @code{""} then the warning type won't appear at
all.
If you bind it to the empty string @code{""} then the warning type
won't appear at all.
@end defvar
@node Warning Options
@ -881,38 +930,71 @@ when a Lisp program reports a warning.
@defopt warning-minimum-level
This user option specifies the minimum severity level that should be
shown immediately to the user. The default is @code{:warning}, which
means to immediately display all warnings except @code{:debug}
warnings.
shown immediately to the user, by popping the warnings buffer in some
window. The default is @code{:warning}, which means to show the
warning buffer for any warning severity except @code{:debug}. The
warnings of lower severity levels will still be written into the
warnings buffer, but the buffer will not be forced onto display.
@end defopt
@defopt warning-minimum-log-level
This user option specifies the minimum severity level that should be
logged in the warnings buffer. The default is @code{:warning}, which
means to log all warnings except @code{:debug} warnings.
logged in the warnings buffer. Warnings of lower severity will be
completely ignored: not written to the warnings buffer and not
displayed. The default is @code{:warning}, which means to log
warnings of any severity except @code{:debug}.
@end defopt
@defopt warning-suppress-types
This list specifies which warning types should not be displayed
immediately for the user. Each element of the list should be a list
of symbols. If its elements match the first elements in a warning
type, then that warning is not displayed immediately.
immediately when they occur. Each element of the list should be a
list of symbols. If an element of this list has the same elements as
the first elements in a warning type, then the warning of that type
will not be shown on display by popping the warnings buffer in some
window (the warning will still be logged in the warnings buffer).
For example, if the value of this variable is a list like this:
@lisp
((foo) (bar subtype))
@end lisp
@noindent
then warnings whose types are @code{foo} or @code{(foo)} or
@w{@code{(foo something)}} or @w{@code{(bar subtype other)}} will not
be shown to the user.
@end defopt
@defopt warning-suppress-log-types
This list specifies which warning types should not be logged in the
warnings buffer. Each element of the list should be a list of
symbols. If it matches the first few elements in a warning type, then
that warning is not logged.
This list specifies which warning types should be ignored: not logged
in the warnings buffer and not shown to the user. The structure and
the matching of warning types are the same as for
@code{warning-suppress-types} above.
@end defopt
@cindex warnings, suppressing during startup
@cindex prevent warnings in init files
During startup, Emacs delays showing any warnings until after it
loads and processes the site-wide and user's init files
(@pxref{Startup Summary}). Let-binding (@pxref{Local Variables}) the
values of these options around some code in your init files which
might emit a warning will therefore not work, because it will not be
in effect by the time the warning is actually processed. Thus, if you
want to suppress some warnings during startup, change the values of
the above options in your init file early enough, or put those
let-binding forms in your @code{after-init-hook} or
@code{emacs-startup-hook} functions. @xref{Init File}.
@node Delayed Warnings
@subsection Delayed Warnings
@cindex delayed warnings
@cindex warnings, delayed
Sometimes, you may wish to avoid showing a warning while a command is
running, and only show it only after the end of the command. You can
use the function @code{delay-warning} for this.
use the function @code{delay-warning} for this. Emacs automatically
delays any warnings emitted during the early stages of startup, and
shows them only after the init files are processed.
@defun delay-warning type message &optional level buffer-name
This function is the delayed counterpart to @code{display-warning}
@ -933,7 +1015,7 @@ with the same form, and the same meanings, as the argument list of
@code{display-warning}. Immediately after running
@code{post-command-hook} (@pxref{Command Overview}), the Emacs
command loop displays all the warnings specified by this variable,
then resets it to @code{nil}.
then resets the variable to @code{nil}.
@end defvar
Programs which need to further customize the delayed warnings
@ -942,7 +1024,9 @@ mechanism can change the variable @code{delayed-warnings-hook}:
@defvar delayed-warnings-hook
This is a normal hook which is run by the Emacs command loop, after
@code{post-command-hook}, in order to process and display delayed
warnings.
warnings. Emacs also runs this hook during startup, after loading the
site-start and user init files (@pxref{Startup Summary}), because
warnings emitted before that are automatically delayed.
Its default value is a list of two functions:
@ -6836,7 +6920,7 @@ This function puts image @var{image} in front of @var{pos} in the
current buffer. The argument @var{pos} should be an integer or a
marker. It specifies the buffer position where the image should appear.
The argument @var{string} specifies the text that should hold the image
as an alternative to the default.
as an alternative to the default @samp{x}.
The argument @var{image} must be an image descriptor, perhaps returned
by @code{create-image} or stored by @code{defimage}.
@ -6849,7 +6933,7 @@ buffer's text.
Internally, this function creates an overlay, and gives it a
@code{before-string} property containing text that has a @code{display}
property whose value is the image. (Whew!)
property whose value is the image. (Whew! that was a mouthful@dots{})
@end defun
@defun remove-images start end &optional buffer
@ -6896,41 +6980,47 @@ This function returns @code{t} if point is on an image, and @code{nil}
otherwise.
@end defun
@cindex operations on images
Images inserted with the insertion functions above also get a local
keymap installed in the text properties (or overlays) that span the
displayed image. This keymap defines the following commands:
@table @kbd
@findex image-increase-size
@item i +
Increase the image size (@code{image-increase-size}). A prefix value
of @samp{4} means to increase the size by 40%. The default is 20%.
Increase the image size (@code{image-increase-size})
@findex image-decrease-size
@item i -
Decrease the image size (@code{image-increase-size}). A prefix value
of @samp{4} means to decrease the size by 40%. The default is 20%.
Decrease the image size (@code{image-decrease-size}).
@findex image-rotate
@item i r
Rotate the image by 90 degrees clockwise (@code{image-rotate}).
A prefix means to rotate by 90 degrees counter-clockwise instead.
Rotate the image (@code{image-rotate}).
@findex image-flip-horizontally
@item i h
Flip the image horizontally (@code{image-flip-horizontally}).
@findex image-flip-vertically
@item i v
Flip the image vertically (@code{image-flip-vertically}).
@findex image-save
@item i o
Save the image to a file (@code{image-save}).
@findex image-crop
@item i c
Crop the image interactively (@code{image-crop}).
Interactively crop the image (@code{image-crop}).
@findex image-cut
@item i x
Cut a rectangle from the image interactively (@code{image-cut}).
Interactively cut a rectangle from the image (@code{image-cut}).
@end table
The size and rotation commands are ``repeating'', which means that you
can continue adjusting the image without using the @kbd{i} prefix.
@xref{Image Mode,,, emacs, The GNU Emacs Manual}, for more details
about these image-specific key bindings.
@node Multi-Frame Images
@subsection Multi-Frame Images

View file

@ -3390,7 +3390,7 @@ first, before handlers for jobs such as remote file access.
@code{file-directory-p},
@code{file-equal-p},
@code{file-executable-p}, @code{file-exists-p},
@code{file-in-directory-p},
@code{file-group-gid}, @code{file-in-directory-p},
@code{file-local-copy}, @code{file-locked-p},
@code{file-modes}, @code{file-name-all-completions},
@code{file-name-as-directory},
@ -3452,7 +3452,7 @@ first, before handlers for jobs such as remote file access.
@code{file-direc@discretionary{}{}{}tory-p},
@code{file-equal-p},
@code{file-executable-p}, @code{file-exists-p},
@code{file-in-directory-p},
@code{file-group-gid}, @code{file-in-directory-p},
@code{file-local-copy}, @code{file-locked-p},
@code{file-modes}, @code{file-name-all-completions},
@code{file-name-as-directory},

View file

@ -3577,7 +3577,7 @@ the mouse position list will be @code{nil} if the value is
@code{drag-source}. This is useful to determine if a frame is not
directly visible underneath the mouse pointer.
The @code{track-mouse} form causes Emacs to generate mouse motion
The @code{track-mouse} macro causes Emacs to generate mouse motion
events by binding the variable @code{track-mouse} to a
non-@code{nil} value. If that variable has the special value
@code{dragging}, it additionally instructs the display engine to
@ -4112,7 +4112,7 @@ has the same meaning as the @var{action} argument to
Emacs implements receiving text and URLs individually for each
window system, and does not by default support receiving other kinds
of data as drops. To support receiving other kinds of data, use the
X-specific interface described below:
X-specific interface described below.
@vindex x-dnd-test-function
@vindex x-dnd-known-types
@ -4141,29 +4141,71 @@ depending on the specific drag-and-drop protocol being used. For
example, the data type used for plain text may be either
@code{"STRING"} or @code{"text/plain"}.
@cindex XDS
@cindex direct save protocol
@vindex x-dnd-direct-save-function
@c FIXME: This description is overly-complicated and confusing. In
@c particular, the two calls to the function basically sound
@c identical, so it is unclear how should the function distinguish
@c between the first and the second one. The description of who asks
@c whom to do what is also very hard to understand. Needs rewording,
@c and needs shorter sentences. Perhaps examples could help.
However, @code{x-dnd-types-alist} does not handle a special kind of
drop sent by a program that wants Emacs to tell it where to save a
file in a specific location determined by the user. These drops are
instead handled by a function that is the value of the variable
@code{x-dnd-direct-save-function}. This function should accept two arguments.
If the first argument is non-@code{nil}, then the second argument is a
file name to save (with leading directories) that the other
program recommends, and the
function should return the full file name under which it should be
saved. After the function completes, Emacs will ask the other program
to save the file under the name that was returned, and if the file was
successfully saved, call the function again with the first argument
set to a non-@code{nil} value and the second argument set to the file
name that was returned. The function should then perform whatever
action is appropriate (i.e., opening the file or refreshing a
directory listing.)
When Emacs runs on X window system, it supports the X Direct Save
(@acronym{XDS}) protocol, which allows users to save a file by
dragging and dropping it onto an Emacs window, such as a Dired window.
To comply with the unique requirements of @acronym{XDS}, these
drag-and-drop requests are processed specially: instead of being
handled according to @code{x-dnd-types-alist}, they are handled by the
@dfn{direct-save function} that is the value of the variable
@code{x-dnd-direct-save-function}. The value should be a function of
two arguments, @var{need-name} and @var{filename}. The @acronym{XDS}
protocol uses a two-step procedure for dragging files:
@enumerate 1
@item
The application from which the file is dragged asks Emacs to provide
the full file name under which to save the file. For this purpose,
the direct-save function is called with its first argument
@var{need-name} non-@code{nil}, and the second argument @var{filename}
set to the basename of the file to be saved. It should return the
fully-expanded absolute file name under which to save the file. For
example, if a file is dragged to a Dired window, the natural directory
for the file is the directory of the file shown at location of the
drop. If saving the file is not possible for some reason, the
function should return @code{nil}, which will cancel the drag-and-drop
operation.
@item
The application from which the file is dragged saves the file under
the name returned by the first call to the direct-save function. If
it succeeds in saving the file, the direct-save function is called
again, this time with the first argument @var{need-name} set to
@code{nil} and the second argument @var{filename} set to the full
absolute name of the saved file. The function is then expected to do
whatever is needed given the fact that file was saved. For example,
Dired should update the directory on display by showing the new file
there.
@end enumerate
The default value of @code{x-dnd-direct-save-function} is
@code{x-dnd-save-direct}.
@defun x-dnd-save-direct need-name filename
When called with the @var{need-name} argument non-@code{nil}, this
function prompts the user for the absolute file name under which it
should be saved. If the specified file already exists, it
additionally asks the user whether to overwrite it, and returns the
absolute file name only if the user confirms the overwriting.
When called with the @var{need-name} argument @code{nil}, it reverts
the Dired listing if the current buffer is in Dired mode or one of its
descendants, and otherwise visits the file by calling @code{find-file}
(@pxref{Visiting Functions}).
@end defun
@defun x-dnd-save-direct-immediately need-name filename
This function works like @code{x-dnd-save-direct}, but when called
with its @var{need-name} argument non-@code{nil}, it doesn't prompt
the user for the full name of the file to be saved; instead, it
returns its argument @var{filename} expanded against the current
buffer's default directory (@pxref{File Name Expansion}). (It still
asks for confirmation if a file by that name already exists in the
default directory.)
@end defun
@cindex initiating drag-and-drop
On capable window systems, Emacs also supports dragging contents

View file

@ -593,8 +593,8 @@ symbol a function definition, its function cell is said to be
In practice, nearly all functions have names, and are referred to by
their names. You can create a named Lisp function by defining a
lambda expression and putting it in a function cell (@pxref{Function
Cells}). However, it is more common to use the @code{defun} special
form, described in the next section.
Cells}). However, it is more common to use the @code{defun} macro,
described in the next section.
@ifnottex
@xref{Defining Functions}.
@end ifnottex
@ -2631,6 +2631,12 @@ so the byte compiler can ignore calls whose value is ignored. This is
the same as the @code{side-effect-free} property of the function's
symbol, @pxref{Standard Properties}.
@item (important-return-value @var{val})
If @var{val} is non-@code{nil}, the byte compiler will warn about
calls to this function that do not use the returned value. This is the
same as the @code{important-return-value} property of the function's
symbol, @pxref{Standard Properties}.
@item (speed @var{n})
Specify the value of @code{native-comp-speed} in effect for native
compilation of this function (@pxref{Native-Compilation Variables}).
@ -2693,13 +2699,14 @@ byte compiler can check that the calls match the declaration.
Tell the byte compiler to assume that @var{function} is defined in the
file @var{file}. The optional third argument @var{arglist} is either
@code{t}, meaning the argument list is unspecified, or a list of
formal parameters in the same style as @code{defun}. An omitted
@var{arglist} defaults to @code{t}, not @code{nil}; this is atypical
behavior for omitted arguments, and it means that to supply a fourth
but not third argument one must specify @code{t} for the third-argument
placeholder instead of the usual @code{nil}. The optional fourth
argument @var{fileonly} non-@code{nil} means check only that
@var{file} exists, not that it actually defines @var{function}.
formal parameters in the same style as @code{defun} (including the
parentheses). An omitted @var{arglist} defaults to @code{t}, not
@code{nil}; this is atypical behavior for omitted arguments, and it
means that to supply a fourth but not third argument one must specify
@code{t} for the third-argument placeholder instead of the usual
@code{nil}. The optional fourth argument @var{fileonly}
non-@code{nil} means check only that @var{file} exists, not that it
actually defines @var{function}.
@end defmac
@findex check-declare-file

View file

@ -768,8 +768,8 @@ prefix definition, and then by those from the global map.
In the following example, we make @kbd{C-p} a prefix key in the local
keymap, in such a way that @kbd{C-p} is identical to @kbd{C-x}. Then
the binding for @kbd{C-p C-f} is the function @code{find-file}, just
like @kbd{C-x C-f}. The key sequence @kbd{C-p 6} is not found in any
active keymap.
like @kbd{C-x C-f}. By contrast, the key sequence @kbd{C-p 9} is not
found in any active keymap.
@example
@group
@ -778,15 +778,14 @@ active keymap.
@end group
@group
(keymap-local-set "C-p" ctl-x-map)
@result{} nil
@result{} (keymap #^[nil nil keymap @dots{}
@end group
@group
(keymap-binding "C-p C-f")
(keymap-lookup nil "C-p C-f")
@result{} find-file
@end group
@group
(keymap-binding "C-p 6")
(keymap-lookup nil "C-p 9")
@result{} nil
@end group
@end example
@ -883,7 +882,7 @@ Normally it ignores @code{overriding-local-map} and
then it pays attention to them. @var{position} can optionally be either
an event position as returned by @code{event-start} or a buffer
position, and may change the keymaps as described for
@code{keymap-binding}.
@code{keymap-lookup} (@pxref{Functions for Key Lookup, keymap-lookup}).
@end defun
@node Searching Keymaps
@ -1308,7 +1307,11 @@ the second example.
@end group
@end example
The @var{keymap} argument can also be a list of keymaps.
The @var{keymap} argument can be @code{nil}, meaning to look up
@var{key} in the current keymaps (as returned by
@code{current-active-maps}, @pxref{Active Keymaps}); or it can be a
keymap or a list of keymaps, meaning to look up @var{key} only in the
specified keymaps.
Unlike @code{read-key-sequence}, this function does not modify the
specified events in ways that discard information (@pxref{Key Sequence

View file

@ -1224,7 +1224,15 @@ x
@end example
However, the other arguments (all but the last) should be mutable
lists.
lists. They can be dotted lists, whose last @sc{cdr}s are then
replaced with the next argument:
@example
@group
(nconc (cons 1 2) (cons 3 (cons 4 5)) 'z)
@result{} (1 3 4 . z)
@end group
@end example
A common pitfall is to use a constant list as a non-last argument to
@code{nconc}. If you do this, the resulting behavior is undefined

View file

@ -1338,7 +1338,7 @@ specified @var{file} and perform the necessary initialization of the
module. This is the primitive which makes sure the module exports the
@code{plugin_is_GPL_compatible} symbol, calls the module's
@code{emacs_module_init} function, and signals an error if that
function returns an error indication, or if the use typed @kbd{C-g}
function returns an error indication, or if the user typed @kbd{C-g}
during the initialization. If the initialization succeeds,
@code{module-load} returns @code{t}. Note that @var{file} must
already have the proper file-name extension, as this function doesn't

View file

@ -4155,7 +4155,7 @@ Other keywords are optional:
@end multitable
Lisp programs mark patterns in @var{query} with capture names (names
that starts with @code{@@}), and tree-sitter will return matched nodes
that start with @code{@@}), and tree-sitter will return matched nodes
tagged with those same capture names. For the purpose of
fontification, capture names in @var{query} should be face names like
@code{font-lock-keyword-face}. The captured node will be fontified

View file

@ -219,17 +219,25 @@ creates huge integers.
@cindex @acronym{IEEE} floating point
Floating-point numbers are useful for representing numbers that are
not integral. The range of floating-point numbers is
the same as the range of the C data type @code{double} on the machine
you are using. On all computers supported by Emacs, this is
@acronym{IEEE} binary64 floating point format, which is standardized by
@url{https://standards.ieee.org/standard/754-2019.html,,IEEE Std 754-2019}
and is discussed further in David Goldberg's paper
not integral. The range of floating-point numbers is the same as the
range of the C data type @code{double} on the machine you are using.
On almost all computers supported by Emacs, this is @acronym{IEEE}
binary64 floating point format, which is standardized by
@url{https://standards.ieee.org/standard/754-2019.html,,IEEE Std
754-2019} and is discussed further in David Goldberg's paper
``@url{https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html,
What Every Computer Scientist Should Know About Floating-Point Arithmetic}''.
On modern platforms, floating-point operations follow the IEEE-754
standard closely; however, results are not always rounded correctly on
some obsolescent platforms, notably 32-bit x86.
What Every Computer Scientist Should Know About Floating-Point
Arithmetic}''. On modern platforms, floating-point operations follow
the IEEE-754 standard closely; however, results are not always rounded
correctly on some systems, notably 32-bit x86.
On some old computer systems, Emacs may not use IEEE floating-point.
We know of one such system on which Emacs runs correctly, but does not
follow IEEE-754: the VAX running NetBSD using GCC 10.4.0, where the
VAX @samp{D_Floating} format is used instead. IBM System/370-derived
mainframes and their XL/C compiler are also capable of utilizing a
hexadecimal floating point format, but Emacs has not yet been built in
such a configuration.
The read syntax for floating-point numbers requires either a decimal
point, an exponent, or both. Optional signs (@samp{+} or @samp{-})
@ -262,6 +270,10 @@ two NaNs as equal when their
signs and significands agree. Significands of NaNs are
machine-dependent, as are the digits in their string representation.
NaNs are not available on systems which do not use IEEE
floating-point arithmetic; if the read syntax for a NaN is used on a
VAX, for example, the reader signals an error.
When NaNs and signed zeros are involved, non-numeric functions like
@code{eql}, @code{equal}, @code{sxhash-eql}, @code{sxhash-equal} and
@code{gethash} determine whether values are indistinguishable, not
@ -742,9 +754,10 @@ by rounding the quotient towards zero after each division.
@cindex @code{arith-error} in division
If you divide an integer by the integer 0, Emacs signals an
@code{arith-error} error (@pxref{Errors}). Floating-point division of
a nonzero number by zero yields either positive or negative infinity
(@pxref{Float Basics}).
@code{arith-error} error (@pxref{Errors}). On systems using IEEE-754
floating-point, floating-point division of a nonzero number by zero
yields either positive or negative infinity (@pxref{Float Basics});
otherwise, an @code{arith-error} is signaled as usual.
@end defun
@defun % dividend divisor

View file

@ -182,7 +182,9 @@ is over, and, together with @code{before-init-time}, provides the
measurement of how long it took.
@item
It runs the normal hook @code{after-init-hook}.
It runs the normal hooks @code{after-init-hook} and
@code{delayed-warnings-hook}. The latter shows any warnings emitted
during previous stages of startup, which are automatically delayed.
@item
If the buffer @file{*scratch*} exists and is still in Fundamental mode
@ -1288,12 +1290,22 @@ the remote connection has no associated user, it will instead return
@end defun
@cindex GID
@defun group-real-gid
This function returns the real @acronym{GID} of the Emacs process.
@end defun
@defun group-gid
This function returns the effective @acronym{GID} of the Emacs process.
@end defun
@defun group-real-gid
This function returns the real @acronym{GID} of the Emacs process.
@defun file-group-gid
This function returns the connection-local value for the user's
effective @acronym{GID}. Similar to @code{file-user-uid}, if
@code{default-directory} is local, this is equivalent to
@code{group-gid}, but for remote files (@pxref{Remote Files, , ,
emacs, The GNU Emacs Manual}), it will return the @acronym{GID} for
the user associated with that remote connection; if the remote
connection has no associated user, it will instead return -1.
@end defun
@defun system-users

View file

@ -1755,7 +1755,9 @@ caught automatically, so that it doesn't stop the execution of whatever
program was running when the filter function was started. However, if
@code{debug-on-error} is non-@code{nil}, errors are not caught.
This makes it possible to use the Lisp debugger to debug filter
functions. @xref{Debugger}.
functions. @xref{Debugger}. If an error is caught, Emacs pauses for
@code{process-error-pause-time} seconds so that the user sees the
error. @xref{Asynchronous Processes}
Many filter functions sometimes (or always) insert the output in the
process's buffer, mimicking the actions of the default filter.
@ -2159,7 +2161,9 @@ automatically, so that it doesn't stop the execution of whatever
programs was running when the sentinel was started. However, if
@code{debug-on-error} is non-@code{nil}, errors are not caught.
This makes it possible to use the Lisp debugger to debug the
sentinel. @xref{Debugger}.
sentinel. @xref{Debugger}. If an error is caught, Emacs pauses for
@code{process-error-pause-time} seconds so that the user sees the
error. @xref{Asynchronous Processes}
While a sentinel is running, the process sentinel is temporarily
set to @code{nil} so that the sentinel won't run recursively.

View file

@ -376,45 +376,43 @@ is less than @var{c}, then @var{a} must be less than @var{c}. If you
use a comparison function which does not meet these requirements, the
result of @code{sort} is unpredictable.
The destructive aspect of @code{sort} for lists is that it rearranges the
cons cells forming @var{sequence} by changing @sc{cdr}s. A nondestructive
sort function would create new cons cells to store the elements in their
sorted order. If you wish to make a sorted copy without destroying the
original, copy it first with @code{copy-sequence} and then sort.
Sorting does not change the @sc{car}s of the cons cells in @var{sequence};
the cons cell that originally contained the element @code{a} in
@var{sequence} still has @code{a} in its @sc{car} after sorting, but it now
appears in a different position in the list due to the change of
@sc{cdr}s. For example:
The destructive aspect of @code{sort} for lists is that it reuses the
cons cells forming @var{sequence} by changing their contents, possibly
rearranging them in a different order. This means that the value of
the input list is undefined after sorting; only the list returned by
@code{sort} has a well-defined value. Example:
@example
@group
(setq nums (list 1 3 2 6 5 4 0))
@result{} (1 3 2 6 5 4 0)
@end group
@group
(setq nums (list 2 1 4 3 0))
(sort nums #'<)
@result{} (0 1 2 3 4 5 6)
@end group
@group
nums
@result{} (1 2 3 4 5 6)
@result{} (0 1 2 3 4)
; nums is unpredictable at this point
@end group
@end example
@noindent
@strong{Warning}: Note that the list in @code{nums} no longer contains
0; this is the same cons cell that it was before, but it is no longer
the first one in the list. Don't assume a variable that formerly held
the argument now holds the entire sorted list! Instead, save the result
of @code{sort} and use that. Most often we store the result back into
the variable that held the original list:
Most often we store the result back into the variable that held the
original list:
@example
(setq nums (sort nums #'<))
@end example
If you wish to make a sorted copy without destroying the original,
copy it first and then sort:
@example
@group
(setq nums (list 2 1 4 3 0))
(sort (copy-sequence nums) #'<)
@result{} (0 1 2 3 4)
@end group
@group
nums
@result{} (2 1 4 3 0)
@end group
@end example
For the better understanding of what stable sort is, consider the following
vector example. After sorting, all items whose @code{car} is 8 are grouped
at the beginning of @code{vector}, but their relative order is preserved.

View file

@ -643,6 +643,12 @@ ignore a call whose value is unused. If the property's value is
calls. In addition to byte compiler optimizations, this property is
also used for determining function safety (@pxref{Function Safety}).
@item important-return-value
@cindex @code{important-return-value} property
A non-@code{nil} value makes the byte compiler warn about code that
calls the named function without using its returned value. This is
useful for functions where doing so is likely to be a mistake.
@item undo-inhibit-region
If non-@code{nil}, the named function prevents the @code{undo} operation
from being restricted to the active region, if @code{undo} is invoked

View file

@ -5510,7 +5510,7 @@ contents of an SQLite database.
@section Parsing HTML and XML
@cindex parsing html
Emacs can be compiled with built-in libxml2 support.
Emacs can be compiled with built-in @file{libxml2} support.
@defun libxml-available-p
This function returns non-@code{nil} if built-in libxml2 support is
@ -5529,8 +5529,10 @@ mistakes.
If @var{start} or @var{end} are @code{nil}, they default to the values
from @code{point-min} and @code{point-max}, respectively.
The optional argument @var{base-url}, if non-@code{nil}, should be a
string specifying the base URL for relative URLs occurring in links.
The optional argument @var{base-url}, if non-@code{nil}, should be
used for warnings and errors reported by the @file{libxml2} library,
but Emacs currently calls the library with errors and warnings
disabled, so this argument is not used.
If the optional argument @var{discard-comments} is non-@code{nil},
any top-level comment is discarded. (This argument is obsolete and

View file

@ -1183,13 +1183,16 @@ wants the current value of a variable, it looks first in the lexical
environment; if the variable is not specified in there, it looks in
the symbol's value cell, where the dynamic value is stored.
(Internally, the lexical environment is an alist of symbol-value
pairs, with the final element in the alist being the symbol @code{t}
rather than a cons cell. Such an alist can be passed as the second
argument to the @code{eval} function, in order to specify a lexical
environment in which to evaluate a form. @xref{Eval}. Most Emacs
Lisp programs, however, should not interact directly with lexical
environments in this way; only specialized programs like debuggers.)
(Internally, the lexical environment is a list whose members are
usually cons cells that are symbol-value pairs, but some of its
members can be symbols rather than cons cells. A symbol in the list
means the lexical environment declared that symbol's variable as
locally considered to be dynamically bound. This list can be passed
as the second argument to the @code{eval} function, in order to
specify a lexical environment in which to evaluate a form.
@xref{Eval}. Most Emacs Lisp programs, however, should not interact
directly with lexical environments in this way; only specialized
programs like debuggers.)
@cindex closures, example of using
Lexical bindings have indefinite extent. Even after a binding
@ -2558,6 +2561,9 @@ documentation as @var{base-variable} has, if any, unless
the documentation of the variable at the end of the chain of aliases.
This function returns @var{base-variable}.
If the resulting variable definition chain would be circular, then
Emacs will signal a @code{cyclic-variable-indirection} error.
@end defun
Variable aliases are convenient for replacing an old name for a
@ -2606,9 +2612,6 @@ look like:
This function returns the variable at the end of the chain of aliases
of @var{variable}. If @var{variable} is not a symbol, or if @var{variable} is
not defined as an alias, the function returns @var{variable}.
This function signals a @code{cyclic-variable-indirection} error if
there is a loop in the chain of symbols.
@end defun
@example

View file

@ -3216,7 +3216,7 @@ any window it creates as dedicated to its buffer (@pxref{Dedicated
Windows}). It does that by calling @code{set-window-dedicated-p} with
the chosen window as first argument and the entry's value as second.
Side windows are by default dedicated with the value @code{side}
((@pxref{Side Window Options and Functions}).
(@pxref{Side Window Options and Functions}).
@vindex preserve-size@r{, a buffer display action alist entry}
@item preserve-size

View file

@ -5394,7 +5394,7 @@ a variable containing a vector of rules.
1: [merge, secsqr] 1: [a/x + b/x := (a + b)/x, ... ]
. .
' [merge,sinsqr] @key{RET} =
' [merge,secsqr] @key{RET} =
@end group
@end smallexample

View file

@ -330,6 +330,7 @@ Syntactic Symbols
* Multiline Macro Symbols::
* Objective-C Method Symbols::
* Java Symbols::
* Constraint Symbols::
* Statement Block Symbols::
* K&R Symbols::
@ -4234,6 +4235,9 @@ The first line in a ``topmost'' definition. @ref{Function Symbols}.
Topmost definition continuation lines. This is only used in the parts
that aren't covered by other symbols such as @code{func-decl-cont} and
@code{knr-argdecl}. @ref{Function Symbols}.
@item constraint-cont
Continuation line of a topmost C++20 concept or requires clause.
@ref{Constraint Symbols}.
@item annotation-top-cont
Topmost definition continuation lines where all previous items are
annotations. @ref{Java Symbols}.
@ -4397,6 +4401,7 @@ Java. @ref{Java Symbols}.
* Multiline Macro Symbols::
* Objective-C Method Symbols::
* Java Symbols::
* Constraint Symbols::
* Statement Block Symbols::
* K&R Symbols::
@end menu
@ -5070,6 +5075,39 @@ the current line. Similarly, line 4 is assigned the @code{annotation-var-cont}
syntax due to it being a continuation of a variable declaration where preceding
the declaration is an annotation.
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Constraint Symbols
@subsection C++ Constraint Symbols
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The C++20 standard introduced the notion of @dfn{concepts} and
@dfn{requirements}, a typical instance of which looks something like
this:
@example
1: template <typename T>
2: requires
3: requires (T t) @{
4: @{ ++t; @}
5: @}
6: && std::is_integral<T>
7: int foo();
@end example
@ssindex constraint-cont
Line 1 is assigned the familiar @code{topmost-intro}. Line 2 gets
@code{topmost-intro-cont}, being the keyword which introduces a
@dfn{requires clause}. Lines 3, 6, and 7 are assigned the syntax
@code{constraint-cont}, being continuations of the requires clause
started on line 2. Lines 4 and 5 get the syntaxes
@code{defun-block-intro} and @code{defun-close}, being analyzed as
though part of a function.
Note that the @code{requires} on Line 3 begins a @dfn{requires
expression}, not a a requires clause, hence its components are not
assigned @code{constraint-cont}. See
@url{https://en.cppreference.com/w/cpp/language/requires}.
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Statement Block Symbols
@subsection Statement Block Symbols

View file

@ -3133,13 +3133,23 @@ example, you can put the following in your init file:
To avoid the slightly distracting visual effect of Emacs starting with
its default frame size and then growing to fullscreen, you can add an
@samp{Emacs.Geometry} entry to the Windows registry settings.
@xref{X Resources,,, emacs, The GNU Emacs Manual}.
To compute the correct values for width and height, first maximize the
Emacs frame and then evaluate @code{(frame-height)} and
@samp{Emacs.Geometry} entry to the Windows Registry settings. @xref{X
Resources,,, emacs, The GNU Emacs Manual}. To compute the correct
values for width and height you use in the Registry settings, first
maximize the Emacs frame and then evaluate @code{(frame-height)} and
@code{(frame-width)} with @kbd{M-:}.
Alternatively, you can avoid the visual effect of Emacs changing its
frame size entirely in your init file (i.e., without using the
Registry), like this:
@lisp
(setq frame-resize-pixelwise t)
(set-frame-position nil 0 0)
(set-frame-size nil (display-pixel-width) (display-pixel-height) t)
@end lisp
@node Emacs in a Linux console
@section How can I alleviate the limitations of the Linux console?
@cindex Console, Linux console, TTY, fbterm

View file

@ -1265,7 +1265,7 @@ is serialized by Eglot to the following JSON text:
@chapter Troubleshooting Eglot
@cindex troubleshooting Eglot
This section documents commands and variables that can be used to
This chapter documents commands and variables that can be used to
troubleshoot Eglot problems. It also provides guidelines for
reporting Eglot bugs in a way that facilitates their resolution.
@ -1275,7 +1275,15 @@ pop up special buffers that can be used to inspect the communications
between the Eglot and language server. In many cases, this will
indicate the problems or at least provide a hint.
@cindex performance
@menu
* Performance::
* Getting the latest version::
* Reporting bugs::
@end menu
@node Performance
@section Performance
@cindex performance problems, with Eglot
A common and easy-to-fix cause of performance problems is the length
of the Eglot events buffer because it represent additional work that
Eglot must do. After verifying Eglot is operating correctly but
@ -1289,6 +1297,33 @@ techniques to improve their performance. Often, this can be tweaked
by changing the server configuration (@pxref{Advanced server
configuration}).
@node Getting the latest version
@section Getting the latest version
@cindex upgrading Eglot
To install the latest Eglot in an Emacs version that does not bundle
Eglot, use @kbd{M-x package-install}.
Often, a newer Eglot version exists that has fixed a longstanding bug,
has more LSP features, or just better supports a particular language
server. Recent Eglot versions can self-update via the command
@kbd{M-x eglot-upgrade-eglot}. This will replace any currently
installed version with the newest one available from the ELPA archives
configured in @code{package-archives}.
You can also update Eglot through other methods, such as
@code{use-package} (@pxref{Installing packages,,, use-package,
use-package User Manual}), @code{package-install},
@code{list-packages} or the newer @code{package-upgrade}
(@pxref{Packages,,, emacs, GNU Emacs Manual}). However, do read the
docstrings of the command you intend to use before you use it, as some
of them may not work in exactly the same way across Emacs versions,
meaning your configuration may be not portable.
@node Reporting bugs
@section Reporting bugs
@cindex bug reports
If you think you have found a bug, we want to hear about it. Before
reporting a bug, keep in mind that interaction with language servers
represents a large quantity of unknown variables. Therefore, it is
@ -1332,6 +1367,10 @@ public Git repository.
Include versions of the software used. The Emacs version can be
obtained with @kbd{M-x emacs-version}.
We welcome bug reports about all Eglot versions, but it is helpful to
first check if the problem isn't already fixed in the latest version
(@pxref{Getting the latest version}).
It's also essential to include the version of ELPA packages that are
explicitly or implicitly loaded. The optional but popular Company or
Markdown packages are distributed as GNU ELPA packages, not to mention

View file

@ -952,7 +952,7 @@ Here, ``password'' refers to your account password, which is usually
your @samp{NickServ} password. To make this work, customize
@code{erc-sasl-user} and @code{erc-sasl-password} or specify the
@code{:user} and @code{:password} keyword arguments when invoking
@code{erc-tls}. Note that @code{:user} cannot be given interactively.
@code{erc-tls}.
@item @code{external} (via Client TLS Certificate)
This works in conjunction with the @code{:client-certificate} keyword
@ -1477,10 +1477,30 @@ questions. You can also try the relatively quiet @samp{#erc}, on the
same network, for more involved questions.
@item
@anchor{Upgrading}
You can check GNU ELPA between Emacs releases to see if a newer
version is available that might contain a fix for your issue:
@uref{https://elpa.gnu.org/packages/erc.html}.
To upgrade, run @kbd{M-x list-packages @key{RET}}. In the
@file{*Packages*} (@code{package-menu-mode}) buffer, click the
@samp{erc} package link for the desired version. If unsure, or if the
version column is too narrow to tell, try the bottom-most candidate.
In the resulting @code{help-mode} buffer, confirm the version and
click @samp{Install}. Make sure to restart Emacs before reconnecting
to IRC, and don't forget that you can roll back to the previous
version by running @kbd{M-x package-delete @key{RET}}.
@xref{Packages,,,emacs, the Emacs manual} for more information.
In the rare instance you need an emergency fix or have volunteered to
test an edge feature between ERC releases, you can try adding
@samp{("devel" . "https://elpa.gnu.org/devel/")} to
@code{package-archives} prior to performing the steps above. For
this, you'll want to instead select a ``snapshot'' version from the
menu. Please be aware that when going this route, the latest changes
may not yet be available and you run the risk of incurring other bugs
and encountering unstable features.
@item
To report a bug in ERC, use @kbd{M-x erc-bug}.

View file

@ -602,6 +602,8 @@ disabled by default.
@cmindex egrep
@itemx fgrep
@cmindex fgrep
@itemx rgrep
@cmindex rgrep
@itemx glimpse
@cmindex glimpse
The @command{grep} commands are compatible with GNU @command{grep},

View file

@ -1,8 +1,8 @@
\input texinfo @c -*- mode: texinfo; coding: utf-8 -*-
@comment %**start of header
@setfilename ../../info/flymake.info
@set VERSION 1.2.2
@set UPDATED November 2021
@set VERSION 1.3.4
@set UPDATED April 2023
@settitle GNU Flymake @value{VERSION}
@include docstyle.texi
@syncodeindex pg cp
@ -142,6 +142,12 @@ highlighted regions to learn what the specific problem
is. Alternatively, place point on the highlighted regions and use the
commands @code{eldoc} or @code{display-local-help}.
Another easy way to get instant access to the diagnostic text is to
set @code{flymake-show-diagnostics-at-end-of-line} to a non-@code{nil}
value. This makes the diagnostic messages appear at the end of the
line where the regular annotation is located (@pxref{Customizable
variables})
@cindex next and previous diagnostic
If the diagnostics are outside the visible region of the buffer,
@code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are
@ -314,6 +320,22 @@ Which fringe (if any) should show the warning/error bitmaps.
@item flymake-wrap-around
If non-@code{nil}, moving to errors with @code{flymake-goto-next-error} and
@code{flymake-goto-prev-error} wraps around buffer boundaries.
@item flymake-show-diagnostics-at-end-of-line
If non-@code{nil}, show summarized descriptions of diagnostics at the
end of the line. Depending on your preference, this can either be
distracting and easily confused with actual code, or a significant
early aid that relieves you from moving around or reaching for the
mouse to consult an error message.
@item flymake-error-eol
A custom face for summarizing diagnostic error messages.
@item flymake-warning-eol
A custom face for summarizing diagnostic warning messages.
@item flymake-note-eol
A custom face for summarizing diagnostic notes.
@end vtable
@node Extending Flymake
@ -394,7 +416,7 @@ its @code{flymake-overlay-control} property:
@item
@cindex severity of diagnostic
@code{flymake-severity} is a non-negative integer specifying the
@code{severity} is a non-negative integer specifying the
diagnostic's severity. The higher the value, the more serious is the
error. If the overlay property @code{priority} is not specified in
@code{flymake-overlay-control}, @code{flymake-severity} is used to set
@ -409,6 +431,17 @@ type, in case the name of the symbol associated with it is very long.
@vindex flymake-category
@code{flymake-category} is a symbol whose property list is considered
the default for missing values of any other properties.
@item
@cindex mode-line appearance of a diagnostic
@code{mode-line-face} is a face specifier controlling the appearance
of the indicator of this type of diagnostic in the mode line.
@item
@cindex summarized appearance of a diagnostic
@code{echo-face} is a face specifier controlling the appearance of the
summarized description of this diagnostic when reading diagnostic
messages (@pxref{Finding diagnostics}).
@end itemize
@cindex predefined diagnostic types

View file

@ -10528,9 +10528,9 @@ article (@code{gnus-summary-refer-references}).
@kindex A T @r{(Summary)}
Display the full thread where the current article appears
(@code{gnus-summary-refer-thread}). By default this command looks for
articles only in the current group. Some backends (currently only
@code{nnimap}) know how to find articles in the thread directly. In
other cases each header in the current group must be fetched and
articles only in the current group. If the group belongs to a backend
that has an associated search engine, articles are found by searching.
In other cases each header in the current group must be fetched and
examined, so it usually takes a while. If you do it often, you may
consider setting @code{gnus-fetch-old-headers} to @code{invisible}
(@pxref{Filling In Threads}). This won't have any visible effects
@ -10538,19 +10538,22 @@ normally, but it'll make this command work a whole lot faster. Of
course, it'll make group entry somewhat slow.
@vindex gnus-refer-thread-use-search
If @code{gnus-refer-thread-use-search} is non-@code{nil} then those backends
that know how to find threads directly will search not just in the
current group but all groups on the same server.
If @code{gnus-refer-thread-use-search} is @code{nil} (the default)
then thread-referral only looks for articles in the current group. If
this variable is @code{t} the server to which the current group
belongs is searched (provided that searching is available for the
server's backend). If this variable is a list of servers, each server
in the list is searched.
@vindex gnus-refer-thread-limit
The @code{gnus-refer-thread-limit} variable says how many old (i.e.,
articles before the first displayed in the current group) headers to
fetch when doing this command. The default is 200. If @code{t}, all
the available headers will be fetched. This variable can be overridden
by giving the @kbd{A T} command a numerical prefix.
fetch when referring a thread. The default is 500. If @code{t}, all
the available headers will be fetched. This variable can be
overridden by giving the @kbd{A T} command a numerical prefix.
@vindex gnus-refer-thread-limit-to-thread
In most cases @code{gnus-refer-thread} adds any articles it finds to
@code{gnus-summary-refer-thread} tries to add any articles it finds to
the current summary buffer. (When @code{gnus-refer-thread-use-search}
is true and the initial referral starts from a summary buffer for a
non-virtual group this may not be possible. In this case a new

View file

@ -1948,11 +1948,9 @@ requires the @acronym{POP}-before-@acronym{SMTP} authentication.
@cindex X-Message-SMTP-Method
If you have a complex @acronym{SMTP} setup, and want some messages to
go via one mail server, and other messages to go through another, you
can use the @samp{X-Message-SMTP-Method} header. These are the
supported values:
@table @samp
@item smtpmail
can use the @samp{X-Message-SMTP-Method} header to override the
default by using the keyword @samp{smtp} followed by the server
information:
@example
X-Message-SMTP-Method: smtp smtp.fsf.org 587
@ -1968,16 +1966,19 @@ This is the same as the above, but uses @samp{other-user} as the user
name when authenticating. This is handy if you have several
@acronym{SMTP} accounts on the same server.
@item sendmail
This header may also be used to specify an alternative MTA by using a
@samp{mailer} keyword, where @samp{mailer} is the name of an MTA with
a corresponding @code{message-send-mail-with-'mailer'} function. For
example:
@example
X-Message-SMTP-Method: sendmail
@end example
This will send the message via the locally installed sendmail/exim/etc
installation.
will send the message via the locally installed sendmail program. The
recognized values of @samp{mailer} are sendmail, qmail, mh, and
mailclient.
@end table
@item message-mh-deletable-headers
@vindex message-mh-deletable-headers

View file

@ -5958,8 +5958,9 @@ the agenda (see [[*Weekly/daily agenda]]). We distinguish:
#+findex: org-block
For more complex date specifications, Org mode supports using the
special expression diary entries implemented in the Emacs Calendar
package[fn:20]. For example, with optional time:
special expression diary entries implemented in the
[[info:emacs#Special Diary Entries][Emacs Calendar package]][fn:20].
For example, with optional time:
#+begin_example
,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month

View file

@ -938,6 +938,16 @@ be used.
This method does not support user names.
@item @option{flatpak}
@cindex method @option{flatpak}
@cindex @option{flatpak} method
Integration of Flatpak sandboxes. The host name may be either an
application ID, a sandbox instance ID, or a PID, as returned by
@samp{flatpak ps}.
This method does not support user names.
@end table
@ -4367,7 +4377,6 @@ Flushes the current buffer's remote connection objects, the same as in
Flushes all active remote connection objects, the same as in
@code{tramp-cleanup-connection}. This command removes also ad-hoc
proxy definitions (@pxref{Ad-hoc multi-hops}).
@end deffn
@deffn Command tramp-cleanup-all-buffers
@ -4376,6 +4385,20 @@ connections and ad-hoc proxy definition are cleaned up in addition to
killing all buffers related to remote connections.
@end deffn
@deffn Command tramp-cleanup-some-buffers
Similar to @code{tramp-cleanup-all-buffers}, where all remote
connections and ad-hoc proxy definition are cleaned up. However,
additional buffers are killed only if one of the functions in
@code{tramp-cleanup-some-buffers-hook} returns @code{t}.
@end deffn
@defopt tramp-cleanup-some-buffers-hook
The functions in this hook determine, whether a remote buffer is
killed when @code{tramp-cleanup-some-buffers} is called. Per default,
remote buffers which are linked to a remote file, remote @code{dired}
buffers, and buffers related to a remote process are cleaned up.
@end defopt
@node Renaming remote files
@section Renaming remote files

View file

@ -17,6 +17,32 @@ This refers to https://github.com/joaotavora/eglot/issues/. That is,
to look up issue github#1234, go to
https://github.com/joaotavora/eglot/issues/1234.
* Changes in Eglot 1.15 (29/4/2023)
** Fix LSP "languageId" detection
Many servers today support multiple languages, meaning they can handle
more than one file type in the same connection. This relies on the
client supplying a ':languageId' string. Previously, Eglot calculated
this string based on an imperfect heuristic and was often wrong. See
github#1206.
** Fix problems with missing signature documentation (bug#62687)
** Reworked 'eglot-imenu'
Eglot's Imenu backend (used for M-x imenu among other extensions), has
been reworked. Most newer servers respond to
'textDocument/documentSymbol' with a vector of 'DocumentSymbol', not
'SymbolInformation'. It's not worth it trying to make the two formats
resemble each other. This also lays groundwork supporting a
forthcoming "breadcrumb" feature of bug#58431.
** New command 'eglot-update'
This allows users to easily update to the latest version of Eglot.
* Changes in Eglot 1.14 (3/4/2023)
@ -70,6 +96,16 @@ been added to 'eglot-stay-out-of'.
** ELPA installations on Emacs 26.3 are supported again.
* Changes in Eglot 1.12.29 (Eglot bundled with Emacs 29.1)
** Eglot can upgrade itself to the latest version.
The new command 'eglot-upgrade-eglot' works around behaviour in the
existing 'package-install' command and the new 'package-upgrade'
command which would prevent the user from easily grabbing the latest
version as usual.
* Changes in Eglot 1.12 (13/03/2023)
@ -93,7 +129,7 @@ The position-encoding scheme (UTF-8, UTF-16 or UTF-32) can now
be negotiated with the server.
** More of the user's Eldoc configuration is respected.
This change addresses the problems reported in many Elglot reports
This change addresses the problems reported in many Eglot reports
dating back to early 2021 at least.
(github#646, github#894, github#920, github#1031, github#1171).
@ -139,7 +175,7 @@ systems (bug#58790).
These modes are usually handled by the same server that handles the
"classical mode".
** New servers chsharp-ls and texlab added to 'eglot-server-programs'.
** New servers csharp-ls and texlab added to 'eglot-server-programs'.
** Assorted bugfixes.
(bug#59824, bug#59338)

View file

@ -11,6 +11,210 @@ This file is about changes in ERC, the powerful, modular, and
extensible IRC (Internet Relay Chat) client distributed with
GNU Emacs since Emacs version 22.1.
* Changes in ERC 5.6
** Module 'keep-place' now offers a visual indicator.
Remember your place in ERC buffers a bit more easily while retaining
the freedom to look around. Optionally sync the indicator to any
progress made when you haven't yet caught up to the live stream. See
options 'erc-keep-place-indicator-style' and friends and new module
'keep-place-indicator', which for now must be added manually to
'erc-modules'.
** Module 'fill' now offers a style based on 'visual-line-mode'.
This fill style mimics the "hanging indent" look of 'erc-fill-static'
and provides some movement and editing commands to optionally tame the
less familiar aspects of 'visual-line' behavior. An interactive
helper called 'erc-fill-wrap-nudge' allows for dynamic "refilling" of
buffers on the fly. Set 'erc-fill-function' to 'erc-fill-wrap' to get
started.
** A unified interactive entry point.
New users are often dismayed to discover that M-x ERC doesn't connect
to its default network, Libera.Chat, over TLS. Though perhaps a
decade overdue, this is no longer the case. Other UX improvements in
this area aim to make the process of connecting interactively slightly
more streamlined and less repetitive, even for veteran users.
** Revised buffer-display handling for interactive commands.
A point of friction for new users and one only just introduced with
ERC 5.5 has been the lack of visual feedback when first connecting via
M-x erc or when issuing a "/JOIN" command at the prompt. As explained
below, in the news for 5.5, the discovery of a security issue led to
most new ERC buffers being "buried" on creation. On further
reflection, this was judged to have been an overcorrection in the case
of interactive invocations, hence the borrowing of an old option,
'erc-query-display', and the bestowing of a new alias,
'erc-interactive-display', which better describes its expanded role as
a more general buffer-display knob for interactive commands ("/QUERY"
still among them).
Accompanying this addition are "display"-suffixed aliases for related
options 'erc-join-buffer' and 'erc-auto-query', which users have
reported as being difficult to discover and remember. When the latter
option (now known as 'erc-receive-query-display') is nil, ERC uses
'erc-join-buffer' in its place, much like it does for
'erc-interactive-display'. The old nil behavior can still be gotten
via the new compatibility flag 'erc-receive-query-display-defer'.
** Setting a module's mode variable via Customize earns a warning.
Trying and failing to activate a module via its minor mode's Custom
widget has been an age-old annoyance for new users. Previously
ineffective, this method now actually works, but it also admonishes
users to edit the 'erc-modules' widget instead.
** The option 'erc-timestamp-use-align-to' is more versatile.
While this option has always offered to right-align stamps via the
'display' text property, it's now more effective at doing so when set
to a number indicating an offset from the right edge. And when set to
the symbol 'margin', it displays stamps in the right margin, although,
at the moment, this is mostly intended for use by other modules, such
as 'fill-wrap', described above. For both these variants, users of
the 'log' module may want to customize 'erc-log-filter-function' to
'erc-stamp-prefix-log-filter' to avoid ragged right-hand stamps
appearing in their saved logs.
** Smarter reconnect handling for users on the move.
ERC now offers a new, experimental reconnect strategy in the function
'erc-server-delayed-check-reconnect', which tests for underlying
connectivity before attempting to reconnect in earnest. See options
'erc-server-reconnect-function' and 'erc-nickname-in-use-functions' to
get started.
** Easily constrain all ERC-related business to a dedicated frame.
The option 'erc-reuse-frames' can now be set to 'displayed', which
tells ERC to show new buffers in frames already occupied by buffers
from the same connection. This customization depends on the option
'erc-buffer-display' (formerly 'erc-join-buffer') being set to
'frame'. If you find the name 'displayed' unhelpful, please suggest
an alternative by writing to the mailing list.
** Some keybindings are now set by modules rather than their libraries.
To put it another way, simply loading a built-in module's library no
longer modifies 'erc-mode-map'. Instead, modifications occur during
module setup. This should not impact most user configs since ERC
doesn't bother with keys already taken and only removes bindings it's
previously created. Note that while all affected bindings still
reside in 'erc-mode-map', future built-in modules will use their own
minor-mode maps, and new third-party modules should do the same.
** The option 'erc-timestamp-format-right' has been deprecated.
Having to account for this option prevented other ERC modules from
easily determining what right-hand stamps would look like before
insertion, which is knowledge needed for certain UI decisions. The
way ERC has chosen to address this is imperfect and boils down to
asking users who've customized this option to switch to
'erc-timestamp-format' instead. If you're affected by this and feel
that some other solution, like automatic migration, is justified,
please make that known on the bug list.
** The 'nicknames' entry in 'erc-button-alist' is officially exceptional.
It's no secret that the 'buttons' module treats potential nicknames
specially. To simplify ERC's move to next-gen "rich UI" extensions,
this special treatment is being canonized. From now on, all values
other than the symbol 'erc-button-buttonize-nicks' appearing in the
"FORM" field (third element) of this entry are considered deprecated
and will incur a warning.
** Option 'erc-query-on-unjoined-chan-privmsg' restored and renamed.
This option was accidentally removed from the default client in ERC
5.5 and was thus prevented from influencing PRIVMSG routing. It's now
been restored with a slightly revised role contingent on a few
assumptions explained in its doc string. For clarity, it has been
renamed 'erc-ensure-target-buffer-on-privmsg'.
** Miscellaneous UX changes.
Some minor quality-of-life niceties have finally made their way to
ERC. For example, the function 'erc-echo-timestamp' is now
interactive and can be invoked on any message to view its timestamp in
the echo area. The command 'erc-button-previous' now moves to the
beginning instead of the end of buttons. And the 'irccontrols' module
now supports additional colors and special handling for "spoilers"
(hidden text).
** Changes in the library API.
*** Some top-level dependencies have been removed.
The library 'erc-goodies' is no longer loaded by ERC's main library.
This was done to further cement the move toward a unidirectional
dependency flow begun in 5.5. Additionally, a few barely used and
newly introduced dependencies are now lazily loaded, which may upset
some third-party code. The first of these is 'pp' because its
'pp-to-string' is autoloaded in all supported ERC versions. Also gone
are 'thingatpt', 'time-date', and 'iso8601'. All were used ultra
sparingly, and the latter two have only been around for one minor
release cycle, so their removal hopefully won't cause much churn.
*** Some ERC-applied text properties have changed.
Chiefly, 'rear-sticky' has been replaced by 'erc-command', which
records the IRC command (or numeric) associated with a message. Less
impactfully, the value of the 'field' property for ERC's prompt has
changed from 't' to the more useful 'erc-prompt', although the
property of the same name has been retained.
*** ERC now manages timestamp-related properties a bit differently.
For starters, the 'cursor-sensor-functions' property no longer
contains unique closures and thus no longer proves effective for
traversing messages. To compensate, a new property, 'erc-timestamp',
now spans message bodies but not the newlines delimiting them.
Somewhat relatedly, the function 'erc-insert-aligned' has been
deprecated and removed from the primary client code path.
*** The role of a module's Custom group is now more clearly defined.
Associating built-in modules with Custom groups and provided library
features has improved. More specifically, a module's group now enjoys
the singular purpose of determining where the module's minor mode
variable lives in the Customize interface. And although ERC is now
slightly more adept at linking these entities, third-parties are still
encouraged to keep a module's name aligned with its group's as well as
the provided feature of its containing library, if only for the usual
reasons of namespace hygiene and discoverability.
*** ERC now supports arbitrary CHANTYPES.
Specifically, channels can be prefixed with any predesignated
character, mainly to afford more flexibility to specialty services,
like bridges to other protocols.
*** 'erc-cmd-HELP' recognizes subcommands.
Some IRC "slash" commands are hierarchical and require users to
specify a subcommand to actually carry out anything of consequence.
Built-in modules can now provide more detailed help for a particular
subcommand by telling ERC to defer to a specialized handler.
*** Longtime quasi modules have been made proper.
The 'fill' module is now defined by 'define-erc-module'. The same
goes for ERC's imenu integration, which has 'imenu' now appearing in
the default value of 'erc-modules'.
*** Prompt input is split before 'erc-pre-send-functions' has a say.
Hook members are now treated to input whose lines have already been
adjusted to fall within the allowed length limit. For convenience,
third-party code can request that the final input be "re-filled" prior
to being sent. See doc string for details.
*** ERC's prompt survives the insertion of user input and messages.
Previously, ERC's prompt and its input marker disappeared while
running hooks during message insertion, and the position of its
"insert marker" (ERC's per-buffer process mark) was inconsistent
during these spells. To make insertion handling more predictable in
preparation for incorporating various protocol extensions, the prompt
and its bounding markers have become perennial fixtures. In rare
cases, these changes may mean third-party code needs tweaking, for
example, requiring the use of 'insert-before-markers' instead of
'insert'. As always, users feeling unduly inconvenienced by these
changes are encouraged to voice their concerns on the bug list.
*** Miscellaneous changes
Two helper macros from GNU ELPA's Compat library are now available to
third-party modules as 'erc-compat-call' and 'erc-compat-function'.
In the area of buttons, 'Info-goto-node' has been supplanted by plain
old 'info' in 'erc-button-alist', and the bracketed "<URL:...>"
pattern entry has been removed because it was more or less redundant.
And the "TAB" key is now bound to a new command, 'erc-tab', that only
calls 'completion-at-point' when point is in the input area and
module-specific commands, like 'erc-button-next', otherwise.
* Changes in ERC 5.5
@ -155,8 +359,8 @@ In an effort to help further tame ERC's complexity, the variable
'erc-default-recipients' is now expected to hold but a single target.
As a consequence, functions like 'erc-add-default-channel' that
imagine an alternate, aspirational model of buffer-target relations
have been deprecated. See Emacs change-log entries from around July
of 2022 for specifics.
have been deprecated. Grep for their names in ChangeLog.4 for
details.
A number of less consequential deprecations also debut in this
release. For example, the function 'erc-auto-query' was deemed too

View file

@ -89,7 +89,9 @@ Mathematics ∀ p ∈ world • hello p □
Meetei Mayek (ꯃꯤꯇꯩ ꯃꯌꯦꯛ) ꯈꯨꯔꯨꯝꯖꯔꯤ
Mende Kikakui (𞠀𞠁𞠂) 𞠛𞠉
Modi (𑘦𑘻𑘚𑘲) 𑘡𑘦𑘭𑘿𑘎𑘰𑘨
Mongolian (монгол хэл) Сайн байна уу?
Mongolian Cyrillic (монгол хэл) Сайн байна уу?
Mongolian Traditional (ᠮᠣᠩᠭᠣᠯ ᠪᠢᠴᠢᠭ᠋) ᠰᠠᠶᠢᠨ ᠪᠠᠶᠢᠨ᠎ᠠ ᠤᠤ?
Northern Thai (ᨣᩣᩴᨾᩮᩬᩥᨦ / ᨽᩣᩈᩣᩃ᩶ᩣ᩠ᨶᨶᩣ) ᩈ᩠ᩅᩢᩔ᩠ᨯᩦᨣᩕᩢ᩠ᨸ
Norwegian (norsk) Hei / God dag
Odia (ଓଡ଼ିଆ) ନମସ୍କାର

133
etc/NEWS
View file

@ -30,6 +30,11 @@ applies, and please also update docstrings as needed.
* Changes in Emacs 30.1
---
** New user option 'describe-bindings-outline-rules'.
This user option controls outline visibility in the output buffer of
'describe-bindings' when 'describe-bindings-outline' in non-nil.
** X selection requests are now handled much faster and asynchronously.
This means it should be less necessary to disable the likes of
'select-active-regions' when Emacs is running over a slow network
@ -66,6 +71,11 @@ This allows the user to customize the prompt that is appended by
This is used for displaying the time and date components of
'display-time-mode'.
---
** New icon images for general use.
Several symbolic icons are added to "etc/images/symbols", including
plus, minus, check-mark, start, etc.
* Editing Changes in Emacs 30.1
@ -100,7 +110,7 @@ If you want to get back the old behavior, set the user option to the value
(setopt gdb-locals-table-row-config
`((type . 0) (name . 0) (value . ,gdb-locals-value-limit)))
** Compile
** Grep
*** New user option 'grep-use-headings'.
When non-nil, the output of Grep is split into sections, one for each
@ -174,11 +184,16 @@ correctly unloads Eshell and all of its modules.
After manually editing 'eshell-aliases-file', you can use this command
to load the edited aliases.
+++
*** 'rgrep' is now a builtin command.
Running 'rgrep' in Eshell now uses the Emacs grep facility instead of
calling external rgrep.
** Shell Mode
+++
*** New user option 'shell-get-old-input-include-continuation-lines'.
When this user option is non-nil, 'shell-get-old-input' (C-RET)
When this user option is non-nil, 'shell-get-old-input' ('C-RET')
includes multiple shell "\" continuation lines from command output.
Default is nil.
@ -194,16 +209,23 @@ point is not in a comment or a string. It is by default bound to
** Tramp
+++
*** New connection method "toolbox".
This allows accessing system containers provided by Toolbox.
*** New connection methods "toolbox" and "flatpak".
They allow accessing system containers provided by Toolbox or
sandboxes provided by Flatpak.
+++
*** Rename 'tramp-use-ssh-controlmaster-options' to 'tramp-use-connection-share.
The old name still exists as defvaralias. This user option controls
now connection sharing for both ssh-based and plink-based methods. It
allows the values t, nil, and 'suppress'. The latter suppresses
also "ControlMaster" settings in the user's "~/.ssh/config" file,
or connection share configuration in PuTTY sessions, respectively.
*** Rename 'tramp-use-ssh-controlmaster-options' to 'tramp-use-connection-share'.
The old name still exists as obsolete variable alias. This user
option controls now connection sharing for both ssh-based and
plink-based methods. It allows the values t, nil, and 'suppress'.
The latter suppresses also "ControlMaster" settings in the user's
"~/.ssh/config" file, or connection share configuration in PuTTY
sessions, respectively.
+++
*** New command 'tramp-cleanup-some-buffers'.
It allows to kill only selected remote buffers, controlled by user
option 'tramp-cleanup-some-buffers-hook'.
** EWW
@ -214,6 +236,17 @@ the new argument NEW-BUFFER non-nil, it will use a new buffer instead.
Interactively, invoke 'eww-open-file' with a prefix argument to
activate this behavior.
---
*** 'eww' URL or keyword prompt now has tab completion.
The interactive minibuffer prompt when invoking 'eww' now has support
for tab completion.
+++
*** 'eww' URL and keyword prompt now completes suggested URIs and bookmarks.
The interactive minibuffer prompt when invoking 'eww' now provides
completions from 'eww-suggest-uris'. 'eww-suggest-uris' now includes
bookmark URIs.
** go-ts-mode
+++
@ -261,6 +294,34 @@ When non-nil, it will automatically register every package as a
project, that you can quickly select using 'project-switch-project'
('C-x p p').
** Flymake
+++
*** New user option 'flymake-show-diagnostics-at-end-of-line'.
When non-nil, Flymake shows summarized descriptions of diagnostics at
the end of the line. Depending on your preference, this can either be
distracting and easily confused with actual code, or a significant
early aid that relieves you from moving the buffer or reaching for the
mouse to consult an error message.
** Python Mode
---
*** New user option 'python-indent-block-paren-deeper'.
If non-nil, increase the indentation of the lines inside parens in a
header of a block when they are indented to the same level as the body
of the block:
if (some_expression
and another_expression):
do_something()
instead of:
if (some_expression
and another_expression):
do_something()
* New Modes and Packages in Emacs 30.1
@ -319,7 +380,7 @@ hooks named after the feature name, like 'esh-mode-unload-hook'.
* Lisp Changes in Emacs 30.1
** New var 'inhibit-auto-fill' to temporarily prevent auto-fill.
** New variable 'inhibit-auto-fill' to temporarily prevent auto-fill.
** Functions and variables to transpose sexps
@ -435,7 +496,7 @@ any unwind forms, as in
(unwind-protect (read buffer))
because the behaviour is identical to that of the argument; there is
because the behavior is identical to that of the argument; there is
no protection of any kind. Perhaps the intended unwind forms have
been misplaced or forgotten, or the use of 'unwind-protect' could be
simplified away.
@ -443,26 +504,50 @@ simplified away.
This warning can be suppressed using 'with-suppressed-warnings' with
the warning name 'suspicious'.
+++
** New function 'file-user-uid'.
This function is like 'user-uid', but is aware of file name handlers,
so it will return the remote UID for remote files (or -1 if the
connection has no associated user).
---
*** Warn about more ignored function return values.
The compiler now warns when the return value from certain functions is
implicitly ignored. Example:
(progn (nreverse my-list) my-list)
will elicit a warning because it is usually pointless to call
'nreverse' on a list without using the returned value.
To silence the warning, make use of the value in some way, such as
assigning it to a variable. You can also wrap the function call in
'(ignore ...)', or use 'with-suppressed-warnings' with the warning
name 'ignored-return-value'.
The warning will only be issued for calls to functions declared
'important-return-value' or 'side-effect-free' (but not 'error-free').
+++
** 'fset' and 'defalias' now signal an error for circular alias chains.
Previously, 'fset' and 'defalias' could be made to build circular
function indirection chains as in
** New function declaration and property 'important-return-value'.
The declaration '(important-return-value t)' sets the
'important-return-value' property which indicates that the function
return value should probably not be thrown away implicitly.
+++
** New functions 'file-user-uid' and 'file-group-gid'.
These functions are like 'user-uid' and 'group-gid', respectively, but
are aware of file name handlers, so they will return the remote UID or
GID for remote files (or -1 if the connection has no associated user).
+++
** 'fset', 'defalias' and 'defvaralias' now signal an error for cyclic aliases.
Previously, 'fset', 'defalias' and 'defvaralias' could be made to
build circular function and variable indirection chains as in
(defalias 'able 'baker)
(defalias 'baker 'able)
but trying to call them would often make Emacs hang. Now, an attempt
but trying to use them would sometimes make Emacs hang. Now, an attempt
to create such a loop results in an error.
Since circular alias chains now cannot occur, 'function-alias-p' and
'indirect-function' will never signal an error. Their second
'noerror' arguments have no effect and are therefore obsolete.
Since circular alias chains now cannot occur, 'function-alias-p',
'indirect-function' and 'indirect-variable' will never signal an error.
Their 'noerror' arguments have no effect and are therefore obsolete.
* Changes in Emacs 30.1 on Non-Free Operating Systems

View file

@ -218,13 +218,13 @@ of 'user-emacs-directory'.
+++
** The image commands have changed key bindings.
In previous Emacs versions, images have had the '+', '-' and 'r' keys
bound when point is over an image. In Emacs 29.1, additional commands
were added, and this made it more likely that users would trigger the
image commands by mistake. To avoid this, all image commands have
moved to the 'i' keymap, so '+' is now 'i +', '-' is now 'i -', and
'r' is now 'i r'. In addition, these commands are now repeating, so
you can rotate an image twice by saying 'i r r', for instance.
In previous Emacs versions, the '+', '-' and 'r' keys were bound when
point was over an image. In Emacs 29.1, additional commands have been
added, and this made it more likely that users would trigger the image
commands by mistake. To avoid this, all image commands have been
moved to the 'i' prefix keymap, so '+' is now 'i +', '-' is now 'i -',
and 'r' is now 'i r'. In addition, these commands are now repeating,
so you can rotate an image twice by saying 'i r r', for instance.
+++
** Emacs now picks the correct coding-system for X input methods.
@ -380,7 +380,7 @@ this user option to nil to revert back to the old behavior.
---
** Support for old EIEIO functions is not autoloaded any more.
You need an explicit '(require 'eieio-compat)' to use 'defmethod'
and 'defgeneric' (which have been made obsolete in Emacs 25.1 with
and 'defgeneric' (which were made obsolete in Emacs 25.1 by
'cl-defmethod' and 'cl-defgeneric').
Similarly you might need to '(require 'eieio-compat)' before loading
files that were compiled with an old EIEIO (Emacs<25).
@ -497,7 +497,7 @@ the 'nlinum' package from GNU ELPA instead. The former has better
performance, but the latter is closer to a drop-in replacement.
1. To use 'display-line-numbers-mode', add something like this to your
Init file:
init file:
(global-display-line-numbers-mode 1)
;; Alternatively, to use it only in programming modes:
@ -517,7 +517,7 @@ performance, but the latter is closer to a drop-in replacement.
---
** The thumbs.el library is now obsolete.
We recommend using command 'image-dired' instead.
We recommend using the 'image-dired' command instead.
---
** The autoarg.el library is now marked obsolete.
@ -577,7 +577,7 @@ encoding, only for decoding.
** New user option 'major-mode-remap-alist' to specify favorite major modes.
This user option lets you remap the default modes (e.g. 'perl-mode' or
'latex-mode') to your favorite ones (e.g. 'cperl-mode' or
'LaTeX-mode') without having to use 'defalias', which can have
'LaTeX-mode') instead of having to use 'defalias', which can have
undesirable side effects.
This applies to all modes specified via 'auto-mode-alist', file-local
variables, etc.
@ -587,6 +587,8 @@ variables, etc.
---
** New user option 'electric-quote-replace-consecutive'.
This allows you to disable the default behavior of consecutive single
quotes being replaced with a double quote.
---
** Emacs is now capable of editing files with very long lines.
@ -795,13 +797,14 @@ part of the buffer.
+++
** New user option 'set-message-functions'.
It allows selecting more functions for 'set-message-function'
in addition to the default function that handles messages
in the active minibuffer. The most useful are 'inhibit-message'
that allows specifying a list of messages to inhibit via
'inhibit-message-regexps', and 'set-multi-message' that
accumulates recent messages and displays them stacked
in the echo area.
It allows more flexible control of how echo-area messages are displayed
by adding functions to this list. The default value is a list of one
element: 'set-minibuffer-message', which displays echo-area messages
at the end of the minibuffer text when the minibuffer is active.
Other useful functions include 'inhibit-message', which allows
specifying, via 'inhibit-message-regexps', the list of messages whose
display should be inhibited; and 'set-multi-message' that accumulates
recent messages and displays them stacked together.
---
** New user option 'find-library-include-other-files'.
@ -854,17 +857,17 @@ This value stands for the value of the corresponding attribute of the
inheriting from other faces.
+++
** New X resource: "borderThickness".
** New X resource "borderThickness".
This controls the thickness of the external borders of the menu bars
and pop-up menus.
+++
** New X resource: "inputStyle".
** New X resource "inputStyle".
This controls the style of the pre-edit and status areas of X input
methods.
+++
** New X resources: "highlightForeground" and "highlightBackground".
** New X resources "highlightForeground" and "highlightBackground".
Only in the Lucid build, this controls colors used for highlighted
menu item widgets.
@ -901,7 +904,7 @@ frame's contents will be hidden, leaving only the title bar on display.
---
** New user option 'x-gtk-use-native-input'.
This controls whether or not GTK input methods are used by Emacs,
instead of XIM input methods.
instead of XIM input methods. Defaults to nil.
+++
** New user option 'use-system-tooltips'.
@ -998,17 +1001,17 @@ combinations in a graphical menu system.
+++
*** New command 'emoji-search' (bound to 'C-x 8 e s').
This command lets you search for Emoji based on names.
This command lets you search for and insert an Emoji based on names.
+++
*** New command 'emoji-list' (bound to 'C-x 8 e l').
This command lists all Emoji (categorized by themes) in a special
buffer and lets you choose one of them.
buffer and lets you choose one of them to insert.
---
*** New command 'emoji-recent' (bound to 'C-x 8 e r').
This command lets you choose among the Emoji you have recently
inserted.
inserted and insert it.
+++
*** New command 'emoji-describe' (bound to 'C-x 8 e d').
@ -1020,6 +1023,11 @@ works for non-Emoji characters.)
These are bound to 'C-x 8 e +' and 'C-x 8 e -', respectively. They
can be used on any character, but are mainly useful for Emoji.
---
*** New command 'emoji-zoom-reset'.
This is bound to 'C-x 8 e 0', and undoes any size changes performed by
'emoji-zoom-increase' and 'emoji-zoom-decrease'.
---
*** New input method 'emoji'.
This allows you to enter Emoji using short strings, eg ':face_palm:'
@ -1037,7 +1045,7 @@ quotes removed.
---
*** 'M-x apropos-variable' output now includes values of variables.
Such apropos buffer is more easily viewed with outlining after
Such an apropos buffer is more easily viewed with outlining after
enabling 'outline-minor-mode' in 'apropos-mode'.
+++
@ -1069,7 +1077,7 @@ This has been changed to:
+++
*** The 'C-h .' command now accepts a prefix argument.
'C-u C-h .' would previously inhibit displaying a warning message if
there's no local help at point. This has been changed to call
there was no local help at point. This has been changed to call
'button-describe'/'widget-describe' and display button/widget help
instead.
@ -1122,7 +1130,7 @@ helpful commands for various tasks. You can toggle the display using
'C-h C-q'.
** Emacs now comes with Org v9.6.
See the file "ORG-NEWS" for user-visible changes in Org.
See the file "etc/ORG-NEWS" for user-visible changes in Org.
** Outline Mode
@ -1185,12 +1193,13 @@ the display of several buffers in a row more amenable.
+++
*** New buffer display action alist entry 'lru-frames'.
This allows to specify which frames 'display-buffer' should consider
when using a window that shows another buffer.
This allows specifying which frames 'display-buffer' should consider
when using a window that shows another buffer. It is interpreted as
per the ALL-FRAMES argument of 'get-lru-window'.
+++
*** New buffer display action alist entry 'lru-time'.
'display-buffer' will ignore windows with a use time higher than that
'display-buffer' will ignore windows with a use time higher than this
when using a window that shows another buffer.
+++
@ -1200,12 +1209,14 @@ making it a less likely candidate for displaying another buffer.
+++
*** New buffer display action alist entry 'window-min-width'.
This allows to specify a minimum width of the window used to display a
buffer.
This allows specifying a preferred minimum width of the window used to
display a buffer.
---
*** You can customize on which window 'scroll-other-window' operates.
This is controlled by the new 'other-window-scroll-default' variable.
*** You can specify on which window 'scroll-other-window' operates.
This is controlled by the new 'other-window-scroll-default' variable,
which should be set to a function that returns a window. When this
variable is nil, 'next-window' is used.
** Frames
@ -1268,17 +1279,19 @@ respond within N seconds. The default is to wait forever.
+++
*** 'server-stop-automatically' can be used to automatically stop the server.
The Emacs server will be automatically stopped when certain conditions
are met. The conditions are given by the argument, which can be
'empty', 'delete-frame' or 'kill-terminal'.
are met. The conditions are determined by the argument to
'server-stop-automatically', which can be 'empty', 'delete-frame' or
'kill-terminal'.
** Rcirc
+++
*** New command 'rcirc-when'.
This shows the reception time of the message at point (if available).
+++
*** New user option 'rcirc-cycle-completion-flag'.
Rcirc will use the default 'completion-at-point' mechanism. The
Rcirc now uses the default 'completion-at-point' mechanism. The
conventional IRC behavior of completing by cycling through the
available options can be restored by enabling this option.
@ -1533,6 +1546,10 @@ environments are:
Coptic script and language environment
Mongolian-traditional script and language environment
Mongolian-cyrillic language environment
---
*** The "Oriya" language environment was renamed to "Odia".
This is to follow the change in the official name of the script. The
@ -1546,7 +1563,10 @@ Type 'C-u C-h t' to select it in case your language setup does not do
so automatically.
---
*** New Ukrainian translation of the Emacs Tutorial.
*** New Ukrainian translation of the Emacs tutorial.
---
*** New Farsi/Persian translation of the Emacs tutorial.
---
*** New default phonetic input method for the Tamil language environment.
@ -1571,6 +1591,12 @@ This input method is based on the russian-computer input method, and
is intended for typing in the Chuvash language written in the Cyrillic
script.
---
*** New input method 'cyrillic-mongolian'.
This input method is for typing in the Mongolian language using the
Cyrillic script. It is the default input method for the new
Mongolian-cyrillic language environment, see above.
* Changes in Specialized Modes and Packages in Emacs 29.1
@ -1817,13 +1843,18 @@ this includes "binary" buffers like 'archive-mode' and 'image-mode'.
** Package
+++
*** New command 'package-update'.
*** New command 'package-upgrade'.
This command allows you to upgrade packages without using 'M-x
list-packages'.
list-packages'. A package that comes with the Emacs distribution can
only be upgraded after you install, once, a newer version from ELPA
via the package-menu displayed by 'list-packages'.
+++
*** New command 'package-update-all'.
This command allows updating all packages without any queries.
*** New command 'package-upgrade-all'.
This command allows upgrading all packages without any queries.
A package that comes with the Emacs distribution will only be upgraded
by this command after you install, once, a newer version of that
package from ELPA via the package-menu displayed by 'list-packages'.
+++
*** New commands 'package-recompile' and 'package-recompile-all'.
@ -1858,13 +1889,26 @@ packages checked out using 'package-vc-install'.
+++
*** New command 'package-report-bug'.
This command helps you compose an email for sending bug reports to
package maintainers.
package maintainers, and is bound to 'b' in the "*Packages*" buffer.
+++
*** New user option 'package-vc-selected-packages'.
By customizing this user option you can specify specific packages to
install.
---
*** New user option 'package-install-upgrade-built-in'.
When enabled, 'package-install' will include in the list of
upgradeable packages those built-in packages (like Eglot and
use-package, for example) for which a newer version is available in
package archives, and will allow installing those newer versions. By
default, this is disabled; however, if 'package-install' is invoked
with a prefix argument, it will act as if this new option were
enabled.
If you customize this option, we recommend you place its non-default
setting in your early-init file.
** Emacs Sessions (Desktop)
+++
@ -1922,8 +1966,8 @@ displayed in a window.
+++
*** New user option 'compilation-hidden-output'.
This can be used to make specific parts of compilation output
invisible.
This regular expression can be used to make specific parts of
compilation output invisible.
+++
*** The 'compilation-auto-jump-to-first-error' user option has been extended.
@ -2306,7 +2350,7 @@ EUDC inline expansion result formatting defaulted to
("%s %s <%s>" firstname name email)
Since email address specifications need to comply with RFC 5322 in
order to be useful in messages, there was a risk to produce syntax
order to be useful in messages, there was a risk of producing syntax
which was standard with RFC 822, but is marked as obsolete syntax by
its successor RFC 5322. Also, the first and last name part was never
enclosed in double quotes, potentially producing invalid address
@ -2340,8 +2384,8 @@ used to select the entry type in the ecomplete database.
+++
*** New back-end for mailabbrev.
A new back-end for mailabbrev allows information from that database to
be queried by EUDC, too. The attributes 'email', 'name', and 'firstname'
are supported only.
be queried by EUDC, too. Only the attributes 'email', 'name', and
'firstname' are supported.
** EWW/SHR
@ -2588,14 +2632,14 @@ as opposed to via the command-line.
+++
*** New command 'image-transform-fit-to-window'.
This command fits the image to the current window by scaling down or
up as necessary. Unlike 'image-transform-fit-both', this does not
only scale the image down, but up as well. It is bound to 's w' in
Image Mode by default.
up as necessary. Unlike 'image-transform-fit-both', this can scale
the image up as well as down. It is bound to 's w' in Image Mode by
default.
---
*** New command 'image-mode-wallpaper-set'.
This command sets the desktop background to the current image. It is
bound to 'W' by default.
bound to 'W' in Image Mode by default.
+++
*** 'image-transform-fit-to-{height,width}' are now obsolete.
@ -2613,19 +2657,14 @@ much (in percent). It is nil by default, which means no limit.
---
*** New user option 'image-text-based-formats'.
This controls whether or not to show a message when opening certain
image formats saying how to edit it as text. The default is to show
this message for SVG and XPM.
+++
*** New commands: 'image-flip-horizontally' and 'image-flip-vertically'.
These commands horizontally and vertically flip the image under point,
and are bound to 'i h' and 'i v', respectively.
This controls whether or not to show a message, when opening certain
image formats, explaining how to edit it as text. The default is to
show this message for SVG and XPM.
+++
*** New command 'image-transform-set-percent'.
It allows setting the image size to a percentage of its original size,
and is bound to 's p' in Image mode.
It allows resizing the image to a percentage of its original size, and
is bound to 's p' in Image mode.
+++
*** 'image-transform-original' renamed to 'image-transform-reset-to-original'.
@ -2637,6 +2676,19 @@ The old name was confusing, and is now an obsolete function alias.
** Images
+++
*** New commands 'image-crop' and 'image-cut'.
These commands allow interactively cropping/cutting the image at
point. The commands are bound to keys 'i c' and 'i x' (respectively)
in the local keymap over images. They rely on external programs, by
default "convert" from ImageMagick, to do the actual cropping/eliding
of the image file.
+++
*** New commands 'image-flip-horizontally' and 'image-flip-vertically'.
These commands horizontally and vertically flip the image under point,
and are bound to 'i h' and 'i v', respectively.
+++
*** Users can now add special image conversion functions.
This is done via 'image-converter-add-handler'.
@ -3225,6 +3277,10 @@ based on data provided by language servers using the Language Server
Protocol (LSP). See the new Info manual "(eglot) Top" for more. Also
see "etc/EGLOT-NEWS".
If you want to be able to use 'package-install' to upgrade Eglot to
newer versions released on GNU ELPA, customize the new option
'package-install-upgrade-built-in' to a non-nil value.
+++
** use-package: Declarative package configuration.
use-package is now shipped with Emacs. It provides the 'use-package'
@ -3232,13 +3288,9 @@ macro, which allows you to isolate package configuration in your init
file in a way that is declarative, tidy, and performance-oriented.
See the new Info manual "(use-package) Top" for more.
+++
** New commands 'image-crop' and 'image-cut'.
These commands allow interactively cropping/cutting the image at
point. The commands are bound to keys 'i c' and 'i x' (respectively)
in the local keymap over images. They rely on external programs, by
default "convert" from ImageMagick, to do the actual cropping/eliding
of the image file.
If you want to be able to use 'package-install' to upgrade use-package
to newer versions released on GNU ELPA, customize the new option
'package-install-upgrade-built-in' to a non-nil value.
---
** New package 'wallpaper'.
@ -3904,9 +3956,9 @@ connection-local profile.
+++
*** New macro 'with-connection-local-application-variables'.
This macro works like 'with-connection-local-variables', but it allows
to use another application but 'tramp'. This is useful when running
code in a buffer where Tramp has already set some connection-local
variables.
using another application instead of 'tramp'. This is useful when
running code in a buffer where Tramp has already set some
connection-local variables.
+++
*** New macro 'setq-connection-local'.
@ -3985,8 +4037,8 @@ This returns a list of sub-sequences of the specified sequence.
+++
*** New function 'seq-remove-at-position'.
This function returns a copy of the specified sequence where the
element at a given (zero-based) index got removed.
This function returns a copy of the specified sequence with the
element at a given (zero-based) index removed.
+++
*** New function 'seq-positions'.
@ -4054,7 +4106,7 @@ that quote character has to be escaped to avoid Emacs displaying it as
(setq foo '(1 2 3))
invalid. Emacs will now warn during byte compilation if it seems
invalid. Emacs will now warn during byte compilation if it sees
something like that, and also warn about when using RIGHT/LEFT SINGLE
QUOTATION MARK directly. In both these cases, if these characters
should really be present in the docstring, they should be quoted with
@ -4114,7 +4166,7 @@ example for benchmarking purposes.
** New function 'string-edit'.
This is meant to be used when the user has to edit a (potentially)
long string. It pops up a new buffer where you can edit the string,
and a callback is called when the user types 'C-c C-c'.
and the provided callback is called when the user types 'C-c C-c'.
+++
** New function 'read-string-from-buffer'.
@ -4260,7 +4312,7 @@ them towards or away from each other.
+++
** New hook 'x-pre-popup-menu-hook'.
This hook, run before 'x-popup-menu', is about to display a
This hook is run before 'x-popup-menu' is about to display a
deck-of-cards menu on screen.
---
@ -4322,9 +4374,11 @@ that binding is ignored by 'where-is-internal'.
+++
*** New functions for defining and manipulating keystrokes.
These all take the syntax defined by 'key-valid-p'. None of the older
functions have been deprecated or altered, but they are now
de-emphasized in the documentation.
These all take the syntax defined by 'key-valid-p', which is basically
the same syntax as the one accepted by the 'kbd' macro. None of the
older functions have been deprecated or altered, but they are now
de-emphasized in the documentation, and we encourage Lisp programs to
switch to these new functions.
+++
*** Use 'keymap-set' instead of 'define-key'.
@ -4359,8 +4413,8 @@ de-emphasized in the documentation.
+++
*** 'define-key' now takes an optional REMOVE argument.
If non-nil, remove the definition from the keymap. This is subtly
different from setting a definition to nil (when the keymap has a
parent).
different from setting a definition to nil: when the keymap has a
parent such a definition will shadow the parent's definition.
+++
*** 'read-multiple-choice' now takes an optional SHOW-HELP argument.

View file

@ -2708,6 +2708,15 @@ Emacs so that it isn't compiled with '-O5'.
We list bugs in current versions here. See also the section on legacy
systems.
*** On Solaris 10, running 'configure' with "/bin/sh" produces errors.
The "/bin/sh" shell on Solaris is an ancient and non-POSIX shell, so
we recommend not to use it. The Emacs 'configure' script should find
an appropriate shell and re-exec itself with that shell, unless you
force it to use "/bin/sh" by using "CONFIG_SHELL=/bin/sh" on the
'configure' command line. So either don't use CONFIG_SHELL, or, if
you'd rather pick the shell yourself, choose "/bin/bash" or "/bin/ksh"
or "/usr/xpg4/bin/sh" instead.
*** On Solaris 10 sparc, Emacs crashes during the build while saving state.
This was observed for Emacs 28.1 on Solaris 10 32-bit sparc, with
Oracle Developer Studio 12.6 (Sun C 5.15). The failure was intermittent,

View file

@ -1,5 +1,5 @@
% Reference Card for Org Mode
\def\orgversionnumber{9.6.2}
\def\orgversionnumber{9.6.5}
\def\versionyear{2023} % latest update
\input emacsver.tex

View file

@ -4,7 +4,7 @@ Emacs commands generally involve the CONTROL key (often labeled CTRL)
or the META key (usually labeled ALT). Rather than writing that
in full each time, we'll use the following abbreviations:
C-<chr> means hold the CONTROL key while typing the character <chr>
C-<chr> means hold the CONTROL key while typing the character <chr>.
Thus, C-f would be: hold the CONTROL key and type f.
M-<chr> means hold the META or ALT key down while typing <chr>.
If there is no META or ALT key, instead press and release the

View file

@ -15,10 +15,10 @@ META 键(有时候用 EDIT 或 ALT 来标示)。为了避免每次都要写
ESC 键。
重要提示:要退出 Emacs请用 C-x C-c两个连续的组合键
退出一个正在运行中的命令,请用 C-g。
中断一个正在输入的命令,请用 C-g。
下文中左边顶行的“>>”字样用来提示你尝试键盘命令。比如:
<<Blank lines inserted around following line by help-with-tutorial>>
[本页当中特意留出一些空白是出于教学目的,请继续往后阅读]
【本页当中特意留出一些空白是出于教学目的,请继续往后阅读】
>> 现在输入 C-v (查看下一屏文字)移动到下一屏。
(别紧张,在输入字符 v 的同时注意要按住 CONTROL 键)
从现在开始,每读完当前一屏你都需要这样做一次。
@ -26,12 +26,17 @@ META 键(有时候用 EDIT 或 ALT 来标示)。为了避免每次都要写
值得注意的是,当你从上一屏滚到下一屏时,中间会有两行的重复;这样做是为
了维持滚屏的连续性,方便你顺畅、连续地阅读。
这是 Emacs 教程文本的一个经过少量修改的副本。不久后我们会让你尝试不同
的命令来修改此文本。若你在我们提到这些命令前修改了文本,不要担心;这就
叫做“编辑”,而这就是 Emacs 存在的根本原因。
用编辑器,开门第一件事就是学会在文字中移动。你已经知道了 C-v 可以向下移
动一屏,要往上移,请用 M-v (也就是按住 META 键然后输入v如果你没有
META、EDIT 或 ALT 键那么就先按 <ESC> 再按 v
>> 试试 M-v然后再试试 C-v来回遛几次。
若你知道其他移动文本的方式,也可以在这里试试。
* 小结SUMMARY
-----------------
@ -101,7 +106,7 @@ P 代表 previous上一行N 代表 next下一行B 代表 backw
如果你嫌一个字符一个字符地挪光标太慢你还可以一个词一个词地跳。M-f
(META-f) 可以将光标往前移动一个词,而 M-b 则是往后移。【这里的“词”指
英文单词,对中文来说,则是指移动到下一个标点符号。】
英文单词,对中文来说,则是指移动到下一个空格或标点符号。】
>> 试试 M-f 和 M-b。
@ -132,8 +137,8 @@ P 代表 previous上一行N 代表 next下一行B 代表 backw
C-f 向右移动一个字符
C-b 向左移动一个字符
M-f 向右移动一个词【对中文是移动到下一个标点符号】
M-b 向左移动一个词【对中文是移动到上一个标点符号】
M-f 向右移动一个词【对中文是移动到下一个空格或标点符号】
M-b 向左移动一个词【对中文是移动到上一个空格或标点符号】
C-n 移动到下一行
C-p 移动到上一行
@ -160,24 +165,25 @@ M-commaMETA 逗号)。
然后再按几次 M-v 回到这里。
如果你的键盘上有方向键的话,也可以用它们来移动光标。不过我们有三个理由
推荐你学习 C-b 、C-f 、C-n 、和 C-p1它们在任何键盘上都能用。2
当你熟练使用 Emacs 之后,你会发现用这些组合键比用方向键要快得多,因为你
的手不需要离开打字区。3一旦你习惯了使用这些组合键你也可以很容易地
适应其它更高级的光标移动命令。
推荐你学习 C-b 、C-f 、C-n 、和 C-p1它们在任何终端terminal
都能用。2当你熟练使用 Emacs 之后,你会发现用这些组合键比用方向键要
快得多,因为你的手不需要离开打字区。3一旦你习惯了使用这些组合键
你也可以很容易地适应其它更高级的光标移动命令。
大部分的 Emacs 命令接受数字参数,并且对于多数命令而言,这些数字参数的作
用是指定命令的重复次数。为一个命令指定数字参数(也就是重复次数)的方法
是:先输入 C-u然后输入数字作为参数最后再输入命令。如果你有META (或
EDIT 或 ALT那么还有另一种办法按住 META 键不放,然后输入数字。不
过我们还是建议你用 C-u因为它在任何终端机上都能用。这种数字参数也称为
“前缀参数”,意思是说这个参数是先于使用它的命令而输入的。
大部分的 Emacs 命令接受数字参数,并且对于多数命令而言,这些数字参数的
作用是指定命令的重复次数。为一个命令指定数字参数(也就是重复次数)的方
法是:先输入 C-u然后输入数字作为参数最后再输入命令。如果你有
META或EDIT 或 ALT那么还有另一种办法按住 META 键不放,然后输
入数字。不过我们还是建议你用 C-u因为它在任何终端上都能用。这种数字参
数也称为“前缀参数”prefix argument意思是说这个参数是先于使用它的
命令而输入的。
举例来说, C-u 8 C-f 会向前移动 8 个字符。
>> 为 C-n 或者 C-p 指定一个数字参数,这样你可以只用一个命令就把光标移动
到本行的附近。
虽然大部分命令把数字参数解为其重复次数,但是也有些命令例外,它们将数
虽然大部分命令把数字参数解为其重复次数,但是也有些命令例外,它们将数
字参数另做它用。比如有些命令(我们目前还没学到)仅仅将前缀参数作为一个
标志――只要给出有一个前缀参数,不管其值为何,它都会改变命令的功能。
@ -189,7 +195,7 @@ EDIT 或 ALT那么还有另一种办法按住 META 键不放,然
这个命令应该已经将文字向上滚动了 8 行。如果你想将它再次地向下滚动,你可
以给定一个参数然后执行 M-v。
如果你正在使用图形界面,比如 X 或者微软的 Windows那么在 Emacs窗
如果你正在使用图形界面,比如 X 或者微软的 Windows那么在 Emacs
口的一边应该有一个长方形的区域叫“滚动条”。你可以用鼠标操纵滚动条来滚动
文字。
@ -235,8 +241,8 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面
C-x 1 只保留一个窗格(也就是关掉其它所有窗格)。
也就是先按 CONTROL-x 然后再按 1。C-x 1 会保留光标所在的窗格,并将其扩大
到整个屏幕,同时关掉所有其它的窗格。
也就是先按 CONTROL-x 然后再按数字 1。C-x 1 会保留光标所在的窗格,并将
其扩大到整个屏幕,同时关掉所有其它的窗格。
>> 把光标移到本行然后输入 C-u 0 C-l。
@ -266,12 +272,13 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面
不用担心文件被修改,你做什么都没关系,这里就是专给你练习用的。
如果一行文字很长、超出了窗格的宽度,显示不下的部分会在紧邻的下一行继续
显示。如果你使用的是图形界面,文本区域两边的狭窄区域(左右“边缘”)会出
现小小的转弯箭头,表明这是某一行的接续显示。如果你使用的是文本终端,接
续显示由屏幕最右边一列的一个反斜线(“\”)来表示。
显示称为接续行continuation line。如果你使用的是图形界面文本区
域两边的狭窄区域(左右“边缘”)会出现小小的转弯箭头,表明这是某一行的接
续显示。如果你使用的是文本终端,接续显示由屏幕最右边一列的一个“\”来表
示。
>> 输入文字,一直到屏幕的右边界,然后继续。
你会看到一个接续行出现。
你会看到一个接续行出现。
>> 用 <DEL> 删掉一些文字,直到此行长度小于窗格宽度,接续行就消失了。
@ -286,7 +293,9 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面
<Return> 是一个特殊的键,因为按下这个键后,得到的可能不仅仅是一个换行
符。根据周围文本的不同Emacs 可能会在换行符之后插入一些空白字符,这样,
当你在新的一行开始打字时,文本会自动与前一行对齐。
当你在新的一行开始打字时,文本会自动与前一行对齐。我们称这种行为(在按
这个按键时不只是插入其对应字符为“electric”可以理解为“通电的自动
的”。
>> 这是一个自动缩进的例子。
在这一行的末尾输入 <Return>。
@ -338,7 +347,8 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面
了。】重新插入被移除的文字称为“召回yank”。一般而言那些可能消除很
多文字的命令会把消除掉的文字记录下来(它们被设定成了“可召回”),而那些
只消除一个字符或者只消除空白的命令就不会记录被消除的内容(自然你也就无
法召回了)。
法召回了)。<DEL> 和 C-d 在无前缀参数的情况下进行“删除”,而有前缀参数
时则改用“移除”。
>> 移动光标到一非空白行的行头,然后输入 C-k 移除那一行上的文字。
@ -350,10 +360,11 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面
C-k 会把两行以及它们的换行符移除;而如果只是输入 C-k 两次显然不是这个结
果。
重新插入被移除的文字恢复的动作称为“召回yanking”。就好像把别人从你身边
移走的东西又猛力地拉回来。)你可以在你删除文字的地方召回,也可以在别的
地方召回,还可以多次召回同样的文字以得到它的多个拷贝。很多其它的编辑器
把移除和召回叫做“剪切”和“粘贴” (详情可见 Emacs 使用手册里的术语表)。
【重新插入被移除的文字恢复的动作称为“召回yanking就好像把别人
从你身边移走的东西又猛力地拉回来。】你可以在你删除文字的地方召回,也
可以在别的地方召回,还可以多次召回同样的文字以得到它的多个拷贝。很多其
它的编辑器把移除和召回叫做“剪切”和“粘贴” (详情可见 Emacs 使用手册里的
术语表)。
召回的命令是 C-y。它会在光标所在处插入你最后移除的文字。
@ -372,8 +383,8 @@ C-y 就可以把它们都召回。
C-y 可以召回最近一次移除的内容,那如何召回前几次移除的内容呢?它们当然
没有丢,你可以用 M-y 来召回它们。在用 C-y 召回最近移除的文字之后,紧接
着再按 M-y 就可以召回再前一次被移除的内容,再按一次 M-y 又可以召回再上
一次的……连续使用 M-y 直到找到你想要召回的东西,然后什么也不用做,继续
编辑就行了。
一次的内容……连续使用 M-y 直到找到你想要召回的东西,然后什么也不用做,
继续编辑就行了。
如果连续按 M-y 很多次,你可能会回到起始点,也就是最近移除的文字。
【看得出这实际上是一个环。】
@ -401,14 +412,16 @@ C-/,你会把以前的命令也依次撤销。
>> 用 C-k 将这一行移除,然后输入 C-/ ,它会再次出现。
C-_ 也是撤销命令;它的作用跟 C-/ 一样,但是它比较容易多次输入。在
某些终端上,输入 C-/ 实际上向 Emacs 发送的是 C-_ 。
另外, C-x u 和 C-/ 完全一样,但是按起来有些麻烦。
C-_ 也是撤销命令;它的作用跟 C-/ 一样,但是它比较容易多次输入。在某些
终端上,你可以不按 shift 键(即 C--)。在某些终端上,输入 C-/ 实际上向
Emacs 发送的是 C-_ 。另外, C-x u 和 C-/ 完全一样,但是按起来有些麻烦。
数字参数对于 C-/ 、 C-_ 和 C-x u 的意义是执行撤销的重复次数。
你可以撤销文字的删除,就像你能撤销文字的移除一样。删除与移除的区别只在
于你是否能召回被影响的文字;对于撤销来说没有区别。
* 文件FILE
* 文件FILES
--------------
想保存工作成果就要记得存盘,否则一旦退出 Emacs 你编辑的文字就会丢失。要
@ -424,7 +437,7 @@ C-_ 也是撤销命令;它的作用跟 C-/ 一样,但是它比较容易多
在屏幕的下方,你应该能够看到头部有短线“-”的一行,行首通常是一些诸如“
-:--- TUTORIAL.cn”的文字这些文字代表了你当前正在访问的文件。比如你现
在正在访问的文件是对 Emacs 快速指南的一份临时拷贝叫做“TUTORIAL.cn”。
每当Emacs 寻找到一个文件,文件名就会出现在这个位置。
每当 Emacs 寻找到一个文件,文件名就会出现在这个位置。
寻找文件的命令有一个特点,那就是你必须给出文件名。我们称这个命令“读入
了一个参数”(在这里,这个参数显然就是文件名)。在你输入这条命令之后:
@ -435,14 +448,14 @@ Emacs 会提示你输入文件名。你输入的文件名会出现在屏幕最
行被称为小缓冲minibuffer在小缓冲里你可以使用通常的 Emacs 编辑命令
来编辑文件名。
在小缓冲里输入文件名(其实输入其它东西也一样)时可以用 C-g 取消。
在小缓冲里输入文件名(其实输入其它东西也一样)时可以用 C-g 取消这个命令
>> 输入 C-x C-f然后输入 C-g
这会关掉小缓冲,同时也会取消使用小缓冲的 C-x C-f 命令。
当然了,你也没有找任何文件。
当然了,你也没有找任何文件。
用 <Return> 结束文件名的输入。之后,小缓冲会消失C-x C-f 将会去寻找你
指定的文件。小缓冲在 C-x C-f 命令结束之后也会消失
当你写完要寻找的文件名时,用 <Return> 结束文件名的输入。之后,小缓冲会
消失C-x C-f 将会去寻找你指定的文件。
文件被显示在了屏幕上,你可以开始编辑了。存盘用这条命令:
@ -453,20 +466,21 @@ Emacs 会提示你输入文件名。你输入的文件名会出现在屏幕最
【对许多人来说,这是一个烦人的特性,关掉文件备份可以用如下命令:
M-x customize-variable <Return> make-backup-files <Return>】
存盘结束后Emacs 会显示写入文件的文件名。你最好养成经常存盘的习惯,这
可以减少系统崩溃和死机给你带来的损失(也可参见下面的“自动保存”一节)。
存盘结束后Emacs 会显示写入文件的文件名。【你最好养成经常存盘的习惯,
这可以减少系统崩溃和死机给你带来的损失(也可参见下面的“自动保存”一
节)。】
>> 输入 C-x C-s TUTORIAL.cn <Return> 。
这将会把该指南保存为一个名为 TUTORIAL.cn 的文件,并且在屏幕的下方显
示一条消息“Wrote ...TUTORIAL.cn”。
示一条消息“Wrote TUTORIAL.cn”。
你不但可以寻找一个已有的文件来查看或编辑,还可以寻找一个不存在的文件。
实际上这正是 Emacs 创建新文件的方法:找到不存在的新文件。事实上,只有
在存盘的时候Emacs 才会真正创建这个文件。而在这之后的一切就跟编辑一个
已有文件没有区别了。
实际上这正是 Emacs 创建新文件的方法:找到不存在的新文件,它一开始是空
的,然后你就可以开始插入文本。事实上,只有在存盘的时候Emacs 才会真正
创建这个文件。而在这之后的一切就跟编辑一个已有文件没有区别了。
* 缓冲区BUFFER
* 缓冲区BUFFERS
------------------
你可以用 C-x C-f 找到并打开第二个文件,但第一个文件仍然在 Emacs 中。要
@ -495,7 +509,7 @@ C-x C-f 是一种办法。不过还有一个更简单的办法,那就是用 C-
然后输入 C-x b TUTORIAL.cn <Return> 回到这里。
大多数情况下,缓冲区与跟其对应的文件是同名的(不包括目录名),不过这也
不是绝对的。用 C-x C-b 得到的缓冲区列表总是显示缓冲区名。
不是绝对的。因此用 C-x C-b 得到的缓冲区列表总是显示缓冲区名与文件名
缓冲区未必有对应文件。显示缓冲区列表的缓冲区(叫做“*Buffer List*”)就
是这样。这个 TUTORIAL.cn 缓冲区起初没有对应的文件,但是现在有了,因为
@ -516,8 +530,8 @@ C-x C-f 是一种办法。不过还有一个更简单的办法,那就是用 C-
C-x s 保存多个缓冲区
C-x s 会找出所有已被修改但尚未存盘的缓冲区,然后向你逐个询问:是否需要
存盘
C-x s 会找出所有访问文件的、且已被修改但尚未存盘的缓冲区,然后向你逐个
询问:是否需要存盘此文件
>> 插入一行文字,然后输入 C-x s。
它应该会问你,是否要储存名为 TUTORIAL.cn 的缓冲区?
@ -554,7 +568,9 @@ C-x 的扩展命令有很多,下面列出的是你已经学过的:
C-x C-f 寻找文件。
C-x C-s 保存文件。
C-x s 保存多个缓冲区。
C-x C-b 列出缓冲区。
C-x b 切换缓冲区。
C-x C-c 离开 Emacs。
C-x 1 关掉其它所有窗格,只保留一个。
C-x u 撤销。
@ -608,10 +624,10 @@ replace-string字符串替换这个命令它会把一个字符串替换
状态栏显示了 Emacs 的状态和你正在编辑的文字的一些信息。
你应该知道文件名的意思吧?就是你找到的那个文件嘛。-NN%-- 显示的是光标在
全文中的位置。如果位于文件的开头,那么就显示 --Top-- 而不是 --00%--;如
果位于文件的末尾,就显示 --Bot--。如果文件很小,一屏就足以显示全部内容,
那么状态栏会显示 --All--
你应该知道文件名的意思吧就是你找到的那个文件嘛。NN% 显示的是光标在
全文中的位置。如果位于文件的开头,那么就显示 Top 而不是 0%;如
果位于文件的末尾,就显示 Bot。如果文件很小一屏就足以显示全部内容
那么状态栏会显示 All。
“L” 和其后的数字给出了光标所在行的行号。
@ -723,7 +739,10 @@ C-s 是向前搜索C-r 是向后搜索。不过手别这么快!别着急试
* 多窗格MULTIPLE WINDOWS
----------------------------
Emacs 的迷人之处很多,能够在屏幕上同时显示多个窗格就是其中之一。
Emacs 的迷人之处很多,能够在屏幕上同时显示多个窗格就是其中之一。(请注
意在 Emacs 里的“窗口frame”与“窗格window”的定义可能与其他应用程
序不同详见Emacs 手册里的术语表。)【另见此教程末尾的翻译章节的术语译
词对照表。】
>> 移动光标到这一行,然后输入 C-l C-l。
@ -782,13 +801,13 @@ Emacs 可以创建多个窗口。窗口由许多窗格以及菜单、滚动条
在图形界面下,多个窗口可以同时显示出来。在文本终端中,只能同时显示一个
窗口。
>> 输入 M-x make-frame <Return>
>> 输入 C-x 5 2
可以看到一个新的窗口出现在了你的屏幕上。
你可以在新的窗口里做最初的窗口里可以做的任何事情。第一个窗口没有什么特
别的。
>> 输入 M-x delete-frame <Return>.
>> 输入 C-x 5 0。
这个命令将会关闭选中的窗口。
你也可以通过图形系统来关闭某个窗口(通常是在窗口上面的某个角落里的一个
@ -853,9 +872,9 @@ Emacs 可以创建多个窗口。窗口由许多窗格以及菜单、滚动条
还有一些其它有用的 C-h 命令:
C-h f 解释一个函数。需要输入函数名。
C-h x 解释一个命令。需要输入命令名。
>> 试试看,输入 C-h f previous-line <Return>。
>> 试试看,输入 C-h x previous-line <Return>。
Emacs 会给出它所知道的所有有关“实现 C-p 命令功能的函数”的信息。
C-h v 用来显示 Emacs 变量的文档。Emacs 变量可以被用来“定制 Emacs 的行
@ -905,15 +924,15 @@ Dired 能够在一个缓冲区里列出一个目录下的所有文件(可以
Emacs 使用手册里还有许许多多的精彩功能等着你来了解。
* 安装包INSTALLING PACKAGES
* 安装软件INSTALLING PACKAGES
---------------------------
Emacs 社区著作了许多持有扩展性的包packages其中包括对各种语言
支持、色彩鲜艳的主题、用于集成外部程序的包,等等。
Emacs 社区著作了许多持有扩展性的软件packages其中包括对各种语言
支持、色彩鲜艳的主题、用于集成外部程序的软件包,等等。
使用 M-x list-packages 便可浏览存在的包裹。这个命令显示的界面中可以安
装和卸载包裹以及查看包裹的简介。Emacs 使用手册中有对包裹管理更详细的
介绍。
使用 M-x list-packages 便可浏览所有可安装的软件包。这个命令显示的界面
中可以安装和卸载软件包以及查看软件包的简介。Emacs 使用手册中有对软件
包管理更详细的介绍。
* 总结CONCLUSION
--------------------
@ -929,6 +948,7 @@ Emacs 社区著作了许多持有扩展性的包裹packages其中包括
翻译:孙一江 <sunyijiang@gmail.com>
维护:薛富侨 <xfq.free@gmail.com>
余睿杰 <ruijie@netyu.xyz>
校对水木社区www.newsmth.netEmacs 板众多网友及众多 Emacs 中文用户
Emacs 快速指南Tutorial早有两个刘昭宏的中文译本繁简各一。其简体版本

1164
etc/tutorials/TUTORIAL.fa Normal file

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,7 @@ Maintainer: Ognyan Kulev <ogi@tower.3.bg>
* TUTORIAL.cn:
Author: Sun Yijiang <sunyijiang@gmail.com>
Maintainer: Xue Fuqiao <xfq.free@gmail.com>
Ruijie Yu <ruijie@netyu.xyz>
* TUTORIAL.cs:
Author: Milan Zamazal <pdm@zamazal.org>
@ -30,6 +31,10 @@ Maintainer: Rafael Sepúlveda <drs@gnulinux.org.mx>
Author: Protesilaos Stavrou <info@protesilaos.com>
Maintainer: Protesilaos Stavrou <info@protesilaos.com>
* TUTORIAL.fa:
Author: Mohsen BANAN <emacs@mohsen.1.banan.byname.net>
Maintainer: Mohsen BANAN <emacs@mohsen.1.banan.byname.net>
* TUTORIAL.fr:
Author: Éric Jacoboni <jaco@teaser.fr>
Maintainer: Éric Jacoboni <jaco@teaser.fr>

View file

@ -197,7 +197,7 @@
GAN 近緊跟根巾筋斤僅謹靳堇哏艮
GANG 梗更庚羹館耿粳哽
GAP 鴿蛤急
GAT <20><><EFBFBD>
GAT <20><><EFBFBD>
GAU 究舊九夠苟狗垢玖韭久灸廄救咎疚摳鼽
GEI 幾記機基既紀技箕肌飢譏姬己伎寄忌妓剞嘰杞畿麂
GENG 鏡頸
@ -231,7 +231,7 @@
GWAI 櫃季瑰圭硅歸龜閨軌鬼詭桂跪貴悸巋饋匭匱劌皈
GWAN 君軍均滾棍鈞郡袞筠
GWANG 轟
GWAT 癌备竇浑
GWAT 癌备竇浑
GWING 炯
GWOH 過果戈裹棵顆錁
GWOK 郭國廓

View file

@ -72,9 +72,10 @@ AUTOGENEL = ${loaddefs} ${srcdir}/cus-load.el ${srcdir}/finder-inf.el \
${srcdir}/subdirs.el ${srcdir}/eshell/esh-groups.el
# Set load-prefer-newer for the benefit of the non-bootstrappers.
# Set org--inhibit-version-check to avoid unnecessarily aborting the build.
BYTE_COMPILE_FLAGS = \
--eval "(setq load-prefer-newer t byte-compile-warnings 'all)" \
$(BYTE_COMPILE_EXTRA_FLAGS)
--eval "(setq org--inhibit-version-check t)" $(BYTE_COMPILE_EXTRA_FLAGS)
# ... but we must prefer .elc files for those in the early bootstrap.
compile-first: BYTE_COMPILE_FLAGS = $(BYTE_COMPILE_EXTRA_FLAGS)
@ -489,8 +490,8 @@ check-declare:
## This finds a lot of duplicates between foo.el and obsolete/foo.el.
check-defun-dups:
sed -n -e '/^(defun /s/\(.\)(.*/\1/p' \
$$(find . -name '*.el' ! -name '.*' -print | \
grep -Ev '(loaddefs|ldefs-boot)\.el|obsolete') | sort | uniq -d
`find . -name '*.el' ! -name '.*' -print | \
grep -Ev '(loaddefs|ldefs-boot)\.el|obsolete'` | sort | uniq -d
# Dependencies

View file

@ -5390,7 +5390,7 @@ Defaults:
;; not specified -- default it:
(setq tobuf (concat "*" (buffer-name frombuf) " exposed*")))
(if (listp format)
(nreverse format))
(setq format (reverse format)))
(let* ((listified
(progn (set-buffer frombuf)

View file

@ -645,6 +645,49 @@ Does not signal an error if optional argument NOERROR is non-nil."
(if (not noerror)
(error "Line does not describe a member of the archive")))))
;; -------------------------------------------------------------------------
;;; Section: Helper functions for requiring filename extensions
(defun archive--act-files (command files)
(lambda (archive)
(apply #'call-process (car command)
nil nil nil (append (cdr command) (cons archive files)))))
(defun archive--need-rename-p (&optional archive)
(let ((archive
(file-name-nondirectory (or archive buffer-file-name))))
(cl-case archive-subtype
((zip) (not (seq-contains-p archive ?. #'eq))))))
(defun archive--ensure-extension (archive ensure-extension)
(if ensure-extension
(make-temp-name (expand-file-name (concat archive "_tmp.")))
archive))
(defun archive--maybe-rename (newname need-rename-p)
;; Operating with archive as current buffer, and protect
;; `default-directory' from being modified in `rename-visited-file'.
(when need-rename-p
(let ((default-directory default-directory))
(rename-visited-file newname))))
(defun archive--with-ensure-extension (archive proc-fn)
(let ((saved default-directory))
(with-current-buffer (find-buffer-visiting archive)
(let ((ensure-extension (archive--need-rename-p))
(default-directory saved))
(unwind-protect
;; Some archive programs (like zip) expect filenames to
;; have an extension, so if necessary, temporarily rename
;; an extensionless file for write accesses.
(let ((archive (archive--ensure-extension
archive ensure-extension)))
(archive--maybe-rename archive ensure-extension)
(let ((exitcode (funcall proc-fn archive)))
(or (zerop exitcode)
(error "Updating was unsuccessful (%S)" exitcode))))
(progn (archive--maybe-rename archive ensure-extension)
(revert-buffer nil t)))))))
;; -------------------------------------------------------------------------
;;; Section: the mode definition
;;;###autoload
@ -1378,16 +1421,9 @@ NEW-NAME."
(setq ename
(encode-coding-string ename archive-file-name-coding-system))
(let* ((coding-system-for-write 'no-conversion)
(default-directory (file-name-as-directory archive-tmpdir))
(exitcode (apply #'call-process
(car command)
nil
nil
nil
(append (cdr command)
(list archive ename)))))
(or (zerop exitcode)
(error "Updating was unsuccessful (%S)" exitcode))))
(default-directory (file-name-as-directory archive-tmpdir)))
(archive--with-ensure-extension
archive (archive--act-files command (list ename)))))
(archive-delete-local tmpfile))))
(defun archive-write-file (&optional file)
@ -1510,9 +1546,7 @@ as a relative change like \"g+rw\" as for chmod(2)."
(archive-resummarize))
(error "Setting group is not supported for this archive type"))))
(defun archive-expunge ()
"Do the flagged deletions."
(interactive)
(defun archive--expunge-maybe-force (force)
(let (files)
(save-excursion
(goto-char archive-file-list-start)
@ -1526,7 +1560,8 @@ as a relative change like \"g+rw\" as for chmod(2)."
(and files
(or (not archive-read-only)
(error "Archive is read-only"))
(or (yes-or-no-p (format "Really delete %d member%s? "
(or force
(yes-or-no-p (format "Really delete %d member%s? "
(length files)
(if (null (cdr files)) "" "s")))
(error "Operation aborted"))
@ -1540,13 +1575,14 @@ as a relative change like \"g+rw\" as for chmod(2)."
(archive-resummarize)
(revert-buffer))))))
(defun archive-expunge ()
"Do the flagged deletions."
(interactive)
(archive--expunge-maybe-force nil))
(defun archive-*-expunge (archive files command)
(apply #'call-process
(car command)
nil
nil
nil
(append (cdr command) (cons archive files))))
(archive--with-ensure-extension
archive (archive--act-files command files)))
(defun archive-rename-entry (newname)
"Change the name associated with this entry in the archive file."

View file

@ -195,7 +195,6 @@ Calc user interface as before (either \\`C-x * C' or \\`C-x * K'; initially \\`C
;;;###autoload
(defun calc-info-goto-node (node)
"Go to a node in the Calculator info documentation."
(interactive)
(select-window (get-largest-window))
(info (concat "(Calc)" node)))

View file

@ -936,7 +936,6 @@
(defun calc-edit-macro-finish-edit (cmdname key)
"Finish editing a Calc macro.
Redefine the corresponding command."
(interactive)
(let ((cmd (intern cmdname)))
(calc-edit-macro-pre-finish-edit)
(let* ((str (buffer-substring calc-edit-top (point-max)))

View file

@ -1349,8 +1349,9 @@ Optional string argument KEYS will force using it as the keys entered."
(calculator-update-display t))
(defun calculator-saved-move (n)
"Go N elements up the list of saved values."
(interactive)
"Go N elements up the list of saved values.
Interactively, N is the prefix numeric argument and defaults to 1."
(interactive "p")
(when (and calculator-saved-list
(or (null calculator-stack) calculator-display-fragile))
(setq calculator-saved-ptr

View file

@ -147,7 +147,7 @@ letters, digits, plus or minus signs or colons."
;;;###autoload(put 'parse-time-rules 'risky-local-variable t)
;;;###autoload
(defun parse-time-string (string)
(defun parse-time-string (string &optional form)
"Parse the time in STRING into (SEC MIN HOUR DAY MON YEAR DOW DST TZ).
STRING should be an ISO 8601 time string, e.g., \"2020-01-15T16:12:21-08:00\",
or something resembling an RFC 822 (or later) date-time, e.g.,
@ -156,9 +156,11 @@ somewhat liberal in what format it accepts, and will attempt to
return a \"likely\" value even for somewhat malformed strings.
The values returned are identical to those of `decode-time', but
any unknown values other than DST are returned as nil, and an
unknown DST value is returned as -1."
unknown DST value is returned as -1.
See `decode-time' for the meaning of FORM."
(condition-case ()
(iso8601-parse string)
(iso8601-parse string form)
(wrong-type-argument
(let ((time (list nil nil nil nil nil nil nil -1 nil))
(temp (parse-time-tokenize (downcase string))))
@ -199,12 +201,14 @@ unknown DST value is returned as -1."
(setf (nth (pop slots) time) new-val))))))))
time))))
(defun parse-iso8601-time-string (date-string)
(defun parse-iso8601-time-string (date-string &optional form)
"Parse an ISO 8601 time string, such as \"2020-01-15T16:12:21-08:00\".
Fall back on parsing something resembling an RFC 822 (or later) date-time.
This function is like `parse-time-string' except that it returns
a Lisp timestamp when successful."
(when-let ((time (parse-time-string date-string)))
a Lisp timestamp when successful.
See `decode-time' for the meaning of FORM."
(when-let ((time (parse-time-string date-string form)))
(encode-time time)))
(provide 'parse-time)

View file

@ -618,21 +618,18 @@ Does nothing if the current buffer doesn't need reparsing."
(lexically-safe t)
)
(unwind-protect
;; Perform the parsing.
(progn
(when (semantic-lex-catch-errors safe-refresh
(save-excursion (semantic-fetch-tags))
nil)
;; If we are here, it is because the lexical step failed,
;; probably due to unterminated lists or something like that.
;; Perform the parsing.
(when (semantic-lex-catch-errors safe-refresh
(save-excursion (semantic-fetch-tags))
nil)
;; If we are here, it is because the lexical step failed,
;; probably due to unterminated lists or something like that.
;; We do nothing, and just wait for the next idle timer
;; to go off. In the meantime, remember this, and make sure
;; no other idle services can get executed.
(setq lexically-safe nil))
;; We do nothing, and just wait for the next idle timer
;; to go off. In the meantime, remember this, and make sure
;; no other idle services can get executed.
(setq lexically-safe nil))
)
)
;; Return if we are lexically safe
lexically-safe))))

View file

@ -927,9 +927,9 @@ marked file, return (t FILENAME) instead of (FILENAME)."
(lambda ()
(if ,show-progress (sit-for 0))
(setq results (cons ,body results))))
(if (< ,arg 0)
(nreverse results)
results))
(when (< ,arg 0)
(setq results (nreverse results)))
results)
;; non-nil, non-integer, non-marked ARG means use current file:
(list ,body))
(let ((regexp (dired-marker-regexp)) next-position)
@ -1647,13 +1647,16 @@ If HDR is non-nil, insert a header line with the directory name."
;; save the answer in `dired-use-ls-dired'.
(or (setq dired-use-ls-dired
(eq 0 (call-process insert-directory-program
nil nil nil "--dired")))
nil nil nil "--dired" "-N")))
(progn
(message "ls does not support --dired; \
(message "ls does not support --dired -N; \
see `dired-use-ls-dired' for more details.")
nil))
dired-use-ls-dired)))
(setq switches (concat "--dired " switches)))
;; Use -N with --dired, to countermand possible non-default
;; quoting style, in particular via the environment variable
;; QUOTING_STYLE.
(setq switches (concat "--dired -N " switches)))
;; Expand directory wildcards and fill file-list.
(let ((dir-wildcard (insert-directory-wildcard-in-dir-p dir)))
(cond (dir-wildcard
@ -1662,7 +1665,7 @@ see `dired-use-ls-dired' for more details.")
;; "--dired", so we cannot add it to the `process-file'
;; call for wildcards.
(when (file-remote-p dir)
(setq switches (string-replace "--dired" "" switches)))
(setq switches (string-replace "--dired -N" "" switches)))
(let* ((default-directory (car dir-wildcard))
(script (format "ls %s %s" switches (cdr dir-wildcard)))
(remotep (file-remote-p dir))

View file

@ -409,9 +409,7 @@ If multiple rules match, only first one is executed.")
(goto-char pos)
(funcall probe last-command-event))))
(when res (throw 'done res))))))))))
(when (and rule
;; Not in a string or comment.
(not (nth 8 (save-excursion (syntax-ppss pos)))))
(when rule
(goto-char pos)
(when (functionp rule) (setq rule (funcall rule)))
(dolist (sym (if (symbolp rule) (list rule) rule))

View file

@ -499,7 +499,6 @@ Reprint the frame with the new view plist."
(defun backtrace-expand-ellipsis (button)
"Expand display of the elided form at BUTTON."
(interactive)
(goto-char (button-start button))
(unless (get-text-property (point) 'cl-print-ellipsis)
(if (and (> (point) (point-min))

View file

@ -221,21 +221,17 @@ for speeding up processing.")
(defun byte-optimize--substitutable-p (expr)
"Whether EXPR is a constant that can be propagated."
;; Only consider numbers, symbols and strings to be values for substitution
;; purposes. Numbers and symbols are immutable, and mutating string
;; literals (or results from constant-evaluated string-returning functions)
;; can be considered undefined.
;; (What about other quoted values, like conses?)
(or (booleanp expr)
(numberp expr)
(stringp expr)
(and (consp expr)
(or (and (memq (car expr) '(quote function))
(symbolp (cadr expr)))
;; (internal-get-closed-var N) can be considered constant for
;; const-prop purposes.
(and (eq (car expr) 'internal-get-closed-var)
(integerp (cadr expr)))))
(arrayp expr)
(let ((head (car-safe expr)))
(cond ((eq head 'quote) t)
;; Don't substitute #'(lambda ...) since that would enable
;; uncontrolled inlining.
((eq head 'function) (symbolp (cadr expr)))
;; (internal-get-closed-var N) can be considered constant for
;; const-prop purposes.
((eq head 'internal-get-closed-var) (integerp (cadr expr)))))
(keywordp expr)))
(defmacro byte-optimize--pcase (exp &rest cases)
@ -469,10 +465,6 @@ for speeding up processing.")
form
(byte-optimize-form newform for-effect))))
;; FIXME: Strictly speaking, I think this is a bug: (closure...)
;; is a *value* and shouldn't appear in the car.
(`((closure . ,_) . ,_) form)
(`(setq ,var ,expr)
(let ((lexvar (assq var byte-optimize--lexvars))
(value (byte-optimize-form expr nil)))
@ -500,19 +492,13 @@ for speeding up processing.")
(cons fn (mapcar #'byte-optimize-form exps)))
(`(,(pred (not symbolp)) . ,_)
(byte-compile-warn-x fn "`%s' is a malformed function" fn)
(byte-compile-warn-x form "`%s' is a malformed function" fn)
form)
((guard (when for-effect
(if-let ((tmp (byte-opt--fget fn 'side-effect-free)))
(or byte-compile-delete-errors
(eq tmp 'error-free)
(progn
(byte-compile-warn-x
form
"value returned from %s is unused"
form)
nil)))))
(eq tmp 'error-free)))))
(byte-compile-log " %s called for effect; deleted" fn)
(byte-optimize-form (cons 'progn (cdr form)) t))
@ -1426,10 +1412,13 @@ See Info node `(elisp) Integer Basics'."
(defun byte-optimize-funcall (form)
;; (funcall (lambda ...) ...) ==> ((lambda ...) ...)
;; (funcall foo ...) ==> (foo ...)
(let ((fn (nth 1 form)))
(if (memq (car-safe fn) '(quote function))
;; (funcall #'(lambda ...) ...) -> ((lambda ...) ...)
;; (funcall #'SYM ...) -> (SYM ...)
;; (funcall 'SYM ...) -> (SYM ...)
(let* ((fn (nth 1 form))
(head (car-safe fn)))
(if (or (eq head 'function)
(and (eq head 'quote) (symbolp (nth 1 fn))))
(cons (nth 1 fn) (cdr (cdr form)))
form)))
@ -1526,6 +1515,44 @@ See Info node `(elisp) Integer Basics'."
;; (list) -> nil
(and (cdr form) form))
(put 'nconc 'byte-optimizer #'byte-optimize-nconc)
(defun byte-optimize-nconc (form)
(pcase (cdr form)
('nil nil) ; (nconc) -> nil
(`(,x) x) ; (nconc X) -> X
(_ (named-let loop ((args (cdr form)) (newargs nil))
(if args
(let ((arg (car args))
(prev (car newargs)))
(cond
;; Elide null args.
((and (null arg)
;; Don't elide a terminal nil unless preceded by
;; a nonempty proper list, since that will have
;; its last cdr forced to nil.
(or (cdr args)
;; FIXME: prove the 'nonempty proper list' property
;; for more forms than just `list', such as
;; `append', `mapcar' etc.
(eq 'list (car-safe (car newargs)))))
(loop (cdr args) newargs))
;; Merge consecutive `list' args.
((and (eq (car-safe arg) 'list)
(eq (car-safe prev) 'list))
(loop (cons (cons (car prev) (append (cdr prev) (cdr arg)))
(cdr args))
(cdr newargs)))
;; (nconc ... (list A) B ...) -> (nconc ... (cons A B) ...)
((and (eq (car-safe prev) 'list) (cdr prev) (null (cddr prev)))
(loop (cdr args)
(cons (list 'cons (cadr prev) arg)
(cdr newargs))))
(t (loop (cdr args) (cons arg newargs)))))
(let ((new-form (cons (car form) (nreverse newargs))))
(if (equal new-form form)
form
new-form)))))))
(put 'append 'byte-optimizer #'byte-optimize-append)
(defun byte-optimize-append (form)
;; There is (probably) too much code relying on `append' to return a
@ -1578,11 +1605,9 @@ See Info node `(elisp) Integer Basics'."
;; (append X) -> X
((null newargs) arg)
;; (append (list Xs...) nil) -> (list Xs...)
((and (null arg)
newargs (null (cdr newargs))
(consp prev) (eq (car prev) 'list))
prev)
;; (append ... (list Xs...) nil) -> (append ... (list Xs...))
((and (null arg) (eq (car-safe prev) 'list))
(cons (car form) (nreverse newargs)))
;; (append '(X) Y) -> (cons 'X Y)
;; (append (list X) Y) -> (cons X Y)
@ -1593,13 +1618,13 @@ See Info node `(elisp) Integer Basics'."
(= (length (cadr prev)) 1)))
((eq (car prev) 'list)
(= (length (cdr prev)) 1))))
(list 'cons (if (eq (car prev) 'quote)
(macroexp-quote (caadr prev))
(cadr prev))
arg))
`(cons ,(if (eq (car prev) 'quote)
(macroexp-quote (caadr prev))
(cadr prev))
,arg))
(t
(let ((new-form (cons 'append (nreverse (cons arg newargs)))))
(let ((new-form (cons (car form) (nreverse (cons arg newargs)))))
(if (equal new-form form)
form
new-form))))))))
@ -1642,98 +1667,231 @@ See Info node `(elisp) Integer Basics'."
;; I wonder if I missed any :-\)
(let ((side-effect-free-fns
'(% * + - / /= 1+ 1- < <= = > >= abs acos append aref ash asin atan
assq
base64-decode-string base64-encode-string base64url-encode-string
'(
;; alloc.c
make-bool-vector make-byte-code make-list make-record make-string
make-symbol make-vector
;; buffer.c
buffer-base-buffer buffer-chars-modified-tick buffer-file-name
buffer-local-value buffer-local-variables buffer-modified-p
buffer-modified-tick buffer-name get-buffer next-overlay-change
overlay-buffer overlay-end overlay-get overlay-properties
overlay-start overlays-at overlays-in previous-overlay-change
;; callint.c
prefix-numeric-value
;; casefiddle.c
capitalize downcase upcase upcase-initials
;; category.c
category-docstring category-set-mnemonics char-category-set
copy-category-table get-unused-category make-category-set
;; character.c
char-width multibyte-char-to-unibyte string unibyte-char-to-multibyte
;; charset.c
decode-char encode-char
;; chartab.c
make-char-table
;; data.c
% * + - / /= 1+ 1- < <= = > >=
aref ash bare-symbol
bool-vector-count-consecutive bool-vector-count-population
bool-vector-subsetp
boundp buffer-file-name buffer-local-variables buffer-modified-p
buffer-substring byte-code-function-p
capitalize car-less-than-car car cdr ceiling char-after char-before
char-equal char-to-string char-width compare-strings
window-configuration-equal-p concat coordinates-in-window-p
copy-alist copy-sequence copy-marker copysign cos
current-time-string current-time-zone
decode-char
decode-time default-boundp default-value documentation downcase
elt encode-char exp expt encode-time error-message-string
fboundp fceiling featurep ffloor
file-directory-p file-exists-p file-locked-p file-name-absolute-p
file-name-concat
file-newer-than-file-p file-readable-p file-symlink-p file-writable-p
float float-time floor format format-message format-time-string
frame-first-window frame-root-window frame-selected-window
frame-visible-p fround ftruncate
get gethash get-buffer get-buffer-window get-file-buffer
hash-table-count
intern-soft isnan
keymap-parent
ldexp
length length< length> length=
line-beginning-position line-end-position pos-bol pos-eol
local-variable-if-set-p local-variable-p locale-info
log logand logb logcount logior lognot logxor
make-byte-code make-list make-string make-symbol marker-buffer max
match-beginning match-end
member memq memql min minibuffer-selected-window minibuffer-window
mod multibyte-char-to-unibyte next-window nth nthcdr number-to-string
prefix-numeric-value previous-window prin1-to-string propertize
rassq rassoc read-from-string
regexp-quote region-beginning region-end reverse round
sin sqrt string string-equal string-lessp
string-search string-to-char
string-to-number string-to-syntax substring substring-no-properties
sxhash-equal sxhash-eq sxhash-eql
symbol-function symbol-name symbol-plist symbol-value
string-make-unibyte
string-make-multibyte string-as-multibyte string-as-unibyte
string-to-multibyte
take tan time-convert truncate
unibyte-char-to-multibyte upcase user-full-name
user-login-name
vconcat
window-at window-body-height
window-body-width window-buffer window-dedicated-p window-display-table
window-combination-limit window-frame window-fringes
window-hscroll
window-left-child window-left-column window-margins window-minibuffer-p
window-next-buffers window-next-sibling window-new-normal
window-new-total window-normal-size window-parameter window-parameters
window-parent window-point window-prev-buffers
window-prev-sibling window-scroll-bars
window-start window-text-height window-top-child window-top-line
window-total-height window-total-width window-use-time window-vscroll
))
boundp car cdr default-boundp default-value fboundp
get-variable-watchers indirect-variable
local-variable-if-set-p local-variable-p
logand logcount logior lognot logxor max min mod
number-to-string position-symbol string-to-number
subr-arity subr-name subr-native-lambda-list subr-type
symbol-function symbol-name symbol-plist symbol-value
symbol-with-pos-pos variable-binding-locus
;; doc.c
documentation
;; editfns.c
buffer-substring buffer-substring-no-properties
byte-to-position byte-to-string
char-after char-before char-equal char-to-string
compare-buffer-substrings
format format-message
group-name
line-beginning-position line-end-position ngettext pos-bol pos-eol
propertize region-beginning region-end string-to-char
user-full-name user-login-name
;; fileio.c
car-less-than-car directory-name-p file-directory-p file-exists-p
file-name-absolute-p file-name-concat file-newer-than-file-p
file-readable-p file-symlink-p file-writable-p
;; filelock.c
file-locked-p
;; floatfns.c
abs acos asin atan ceiling copysign cos exp expt fceiling ffloor
float floor fround ftruncate isnan ldexp log logb round sin sqrt tan
truncate
;; fns.c
append assq
base64-decode-string base64-encode-string base64url-encode-string
compare-strings concat copy-alist copy-hash-table copy-sequence elt
featurep get
gethash hash-table-count hash-table-rehash-size
hash-table-rehash-threshold hash-table-size hash-table-test
hash-table-weakness
length length< length= length>
line-number-at-pos locale-info make-hash-table
member memq memql nth nthcdr
object-intervals rassoc rassq reverse
string-as-multibyte string-as-unibyte string-bytes string-distance
string-equal string-lessp string-make-multibyte string-make-unibyte
string-search string-to-multibyte substring substring-no-properties
sxhash-eq sxhash-eql sxhash-equal sxhash-equal-including-properties
take vconcat
;; frame.c
frame-ancestor-p frame-bottom-divider-width frame-char-height
frame-char-width frame-child-frame-border-width frame-focus
frame-fringe-width frame-internal-border-width frame-native-height
frame-native-width frame-parameter frame-parameters frame-parent
frame-pointer-visible-p frame-position frame-right-divider-width
frame-scale-factor frame-scroll-bar-height frame-scroll-bar-width
frame-text-cols frame-text-height frame-text-lines frame-text-width
frame-total-cols frame-total-lines frame-visible-p
frame-window-state-change next-frame previous-frame
tool-bar-pixel-width window-system
;; fringe.c
fringe-bitmaps-at-pos
;; keyboard.c
posn-at-point posn-at-x-y
;; keymap.c
copy-keymap keymap-parent keymap-prompt make-keymap make-sparse-keymap
;; lread.c
intern-soft read-from-string
;; marker.c
copy-marker marker-buffer marker-insertion-type marker-position
;; minibuf.c
active-minibuffer-window assoc-string innermost-minibuffer-p
minibuffer-innermost-command-loop-p minibufferp
;; print.c
error-message-string prin1-to-string
;; process.c
format-network-address get-buffer-process get-process
process-buffer process-coding-system process-command process-filter
process-id process-inherit-coding-system-flag process-mark
process-name process-plist process-query-on-exit-flag
process-running-child-p process-sentinel process-thread
process-tty-name process-type
;; search.c
match-beginning match-end regexp-quote
;; sqlite.c
sqlite-columns sqlite-more-p sqlite-version
;; syntax.c
char-syntax copy-syntax-table matching-paren string-to-syntax
syntax-class-to-char
;; term.c
controlling-tty-p tty-display-color-cells tty-display-color-p
tty-top-frame tty-type
;; terminal.c
frame-terminal terminal-list terminal-live-p terminal-name
terminal-parameter terminal-parameters
;; textprop.c
get-char-property get-char-property-and-overlay get-text-property
next-char-property-change next-property-change
next-single-char-property-change next-single-property-change
previous-char-property-change previous-property-change
previous-single-char-property-change previous-single-property-change
text-properties-at text-property-any text-property-not-all
;; thread.c
all-threads condition-mutex condition-name mutex-name thread-live-p
thread-name
;; timefns.c
current-time-string current-time-zone decode-time encode-time
float-time format-time-string time-add time-convert time-equal-p
time-less-p time-subtract
;; window.c
coordinates-in-window-p frame-first-window frame-root-window
frame-selected-window get-buffer-window minibuffer-selected-window
minibuffer-window next-window previous-window window-at
window-body-height window-body-width window-buffer
window-combination-limit window-configuration-equal-p
window-dedicated-p window-display-table window-frame window-fringes
window-hscroll window-left-child window-left-column window-margins
window-minibuffer-p window-new-normal window-new-total
window-next-buffers window-next-sibling window-normal-size
window-parameter window-parameters window-parent window-point
window-prev-buffers window-prev-sibling window-scroll-bars
window-start window-text-height window-top-child window-top-line
window-total-height window-total-width window-use-time window-vscroll
;; xdisp.c
buffer-text-pixel-size current-bidi-paragraph-direction
get-display-property invisible-p line-pixel-height lookup-image-map
tab-bar-height tool-bar-height window-text-pixel-size
))
(side-effect-and-error-free-fns
'(arrayp atom
bobp bolp bool-vector-p
buffer-list buffer-size buffer-string bufferp
car-safe case-table-p cdr-safe char-or-string-p characterp
charsetp commandp cons consp
current-buffer current-global-map current-indentation
current-local-map current-minor-mode-maps current-time
eobp eolp eq equal
floatp following-char framep
hash-table-p
identity indirect-function integerp integer-or-marker-p
invocation-directory invocation-name
keymapp keywordp
list listp
make-marker mark-marker markerp max-char
natnump nlistp null number-or-marker-p numberp
overlayp
point point-marker point-min point-max preceding-char
processp proper-list-p
recent-keys recursion-depth
safe-length selected-frame selected-window sequencep
standard-case-table standard-syntax-table stringp subrp symbolp
syntax-table syntax-table-p
this-command-keys this-command-keys-vector this-single-command-keys
this-single-command-raw-keys type-of
user-real-login-name user-real-uid user-uid
vector vectorp visible-frame-list
wholenump window-configuration-p window-live-p
window-valid-p windowp)))
'(
;; alloc.c
bool-vector cons list make-marker purecopy record vector
;; buffer.c
buffer-list buffer-live-p current-buffer overlay-lists overlayp
;; casetab.c
case-table-p current-case-table standard-case-table
;; category.c
category-table category-table-p make-category-table
standard-category-table
;; character.c
characterp max-char
;; charset.c
charsetp
;; data.c
arrayp atom bare-symbol-p bool-vector-p bufferp byte-code-function-p
byteorder car-safe cdr-safe char-or-string-p char-table-p
condition-variable-p consp eq floatp indirect-function
integer-or-marker-p integerp keywordp listp markerp
module-function-p multibyte-string-p mutexp natnump nlistp null
number-or-marker-p numberp recordp remove-pos-from-symbol
sequencep stringp subr-native-elisp-p subrp symbol-with-pos-p symbolp
threadp type-of user-ptrp vector-or-char-table-p vectorp wholenump
;; editfns.c
bobp bolp buffer-size buffer-string current-message emacs-pid
eobp eolp following-char gap-position gap-size group-gid
group-real-gid mark-marker point point-marker point-max point-min
position-bytes preceding-char system-name
user-real-login-name user-real-uid user-uid
;; emacs.c
invocation-directory invocation-name
;; eval.c
commandp functionp
;; fileio.c
default-file-modes
;; fns.c
eql equal hash-table-p identity proper-list-p safe-length
secure-hash-algorithms
;; frame.c
frame-list frame-live-p framep last-nonminibuffer-frame
old-selected-frame selected-frame visible-frame-list
;; image.c
imagep
;; indent.c
current-column current-indentation
;; keyboard.c
current-idle-time current-input-mode recent-keys recursion-depth
this-command-keys this-command-keys-vector this-single-command-keys
this-single-command-raw-keys
;; keymap.c
current-global-map current-local-map current-minor-mode-maps keymapp
;; minibuf.c
minibuffer-contents minibuffer-contents-no-properties minibuffer-depth
minibuffer-prompt minibuffer-prompt-end
;; process.c
process-list processp signal-names waiting-for-user-input-p
;; sqlite.c
sqlite-available-p sqlitep
;; syntax.c
standard-syntax-table syntax-table syntax-table-p
;; thread.c
current-thread
;; timefns.c
current-time
;; window.c
selected-window window-configuration-p window-live-p window-valid-p
windowp
;; xdisp.c
long-line-optimizations-p
)))
(while side-effect-free-fns
(put (car side-effect-free-fns) 'side-effect-free t)
(setq side-effect-free-fns (cdr side-effect-free-fns)))
@ -1758,41 +1916,34 @@ See Info node `(elisp) Integer Basics'."
;; values if a marker is moved.
(let ((pure-fns
'(concat regexp-quote
string-to-char string-to-syntax symbol-name
eq eql
= /= < <= >= > min max
+ - * / % mod abs ash 1+ 1- sqrt
logand logior lognot logxor logcount
copysign isnan ldexp float logb
floor ceiling round truncate
ffloor fceiling fround ftruncate
string-equal string-lessp
string-search
consp atom listp nlistp proper-list-p
sequencep arrayp vectorp stringp bool-vector-p hash-table-p
null
numberp integerp floatp natnump characterp
integer-or-marker-p number-or-marker-p char-or-string-p
symbolp keywordp
type-of
identity
;; The following functions are pure up to mutation of their
;; arguments. This is pure enough for the purposes of
;; constant folding, but not necessarily for all kinds of
;; code motion.
car cdr car-safe cdr-safe nth nthcdr take
equal
length safe-length
memq memql member
;; `assoc' and `assoc-default' are excluded since they are
;; impure if the test function is (consider `string-match').
assq rassq rassoc
aref elt
base64-decode-string base64-encode-string base64url-encode-string
bool-vector-subsetp
bool-vector-count-population bool-vector-count-consecutive
'(
;; character.c
characterp
;; data.c
% * + - / /= 1+ 1- < <= = > >= aref arrayp ash atom bare-symbol
bool-vector-count-consecutive bool-vector-count-population
bool-vector-p bool-vector-subsetp
bufferp car car-safe cdr cdr-safe char-or-string-p char-table-p
condition-variable-p consp eq floatp integer-or-marker-p integerp
keywordp listp logand logcount logior lognot logxor markerp max min
mod multibyte-string-p mutexp natnump nlistp null number-or-marker-p
numberp recordp remove-pos-from-symbol sequencep stringp symbol-name
symbolp threadp type-of vector-or-char-table-p vectorp
;; editfns.c
string-to-char
;; floatfns.c
abs ceiling copysign fceiling ffloor float floor fround ftruncate
isnan ldexp logb round sqrt truncate
;; fns.c
assq base64-decode-string base64-encode-string base64url-encode-string
concat elt eql equal hash-table-p identity length length< length=
length> member memq memql nth nthcdr proper-list-p rassoc rassq
safe-length string-bytes string-distance string-equal string-lessp
string-search take
;; search.c
regexp-quote
;; syntax.c
string-to-syntax
)))
(while pure-fns
(put (car pure-fns) 'pure t)

View file

@ -145,6 +145,11 @@ So far, FUNCTION can only be a symbol, not a lambda expression."
(list 'function-put (list 'quote f)
''side-effect-free (list 'quote val))))
(defalias 'byte-run--set-important-return-value
#'(lambda (f _args val)
(list 'function-put (list 'quote f)
''important-return-value (list 'quote val))))
(put 'compiler-macro 'edebug-declaration-spec
'(&or symbolp ("lambda" &define lambda-list lambda-doc def-body)))
@ -226,6 +231,8 @@ This may shift errors from run-time to compile-time.")
(list 'side-effect-free #'byte-run--set-side-effect-free
"If non-nil, calls can be ignored if their value is unused.
If `error-free', drop calls even if `byte-compile-delete-errors' is nil.")
(list 'important-return-value #'byte-run--set-important-return-value
"If non-nil, warn about calls not using the returned value.")
(list 'compiler-macro #'byte-run--set-compiler-macro)
(list 'doc-string #'byte-run--set-doc-string)
(list 'indent #'byte-run--set-indent)
@ -650,11 +657,8 @@ in `byte-compile-warning-types'; see the variable
`byte-compile-warnings' for a fuller explanation of the warning
types. The types that can be suppressed with this macro are
`free-vars', `callargs', `redefine', `obsolete',
`interactive-only', `lexical', `mapcar', `constants',
`suspicious' and `empty-body'.
For the `mapcar' case, only the `mapcar' function can be used in
the symbol list."
`interactive-only', `lexical', `ignored-return-value', `constants',
`suspicious' and `empty-body'."
;; Note: during compilation, this definition is overridden by the one in
;; byte-compile-initial-macro-environment.
(declare (debug (sexp body)) (indent 1))

View file

@ -317,7 +317,9 @@ Elements of the list may be:
lexical-dynamic
lexically bound variable declared dynamic elsewhere
make-local calls to `make-variable-buffer-local' that may be incorrect.
mapcar mapcar called for effect.
ignored-return-value
function called without using the return value where this
is likely to be a mistake
not-unused warning about using variables with symbol names starting with _.
constants let-binding of, or assignment to, constants/nonvariables.
docstrings docstrings that are too wide (longer than
@ -330,7 +332,7 @@ Elements of the list may be:
empty-body body argument to a special form or macro is empty.
If the list begins with `not', then the remaining elements specify warnings to
suppress. For example, (not mapcar) will suppress warnings about mapcar.
suppress. For example, (not free-vars) will suppress the `free-vars' warning.
The t value means \"all non experimental warning types\", and
excludes the types in `byte-compile--emacs-build-warning-types'.
@ -3490,6 +3492,29 @@ lambda-expression."
(byte-compile-report-error
(format-message "`%s' defined after use in %S (missing `require' of a library file?)"
(car form) form)))
(when byte-compile--for-effect
(let ((sef (function-get (car form) 'side-effect-free)))
(cond
((and sef (or (eq sef 'error-free)
byte-compile-delete-errors))
;; This transform is normally done in the Lisp optimiser,
;; so maybe we don't need to bother about it here?
(setq form (cons 'progn (cdr form)))
(setq handler #'byte-compile-progn))
((and (or sef (function-get (car form) 'important-return-value))
;; Don't warn for arguments to `ignore'.
(not (eq byte-compile--for-effect 'for-effect-no-warn))
(byte-compile-warning-enabled-p
'ignored-return-value (car form)))
(byte-compile-warn-x
(car form)
"value from call to `%s' is unused%s"
(car form)
(cond ((eq (car form) 'mapcar)
"; use `mapc' or `dolist' instead")
(t "")))))))
(if (and handler
;; Make sure that function exists.
(and (functionp handler)
@ -3513,6 +3538,26 @@ lambda-expression."
(byte-compile-discard))
(pop byte-compile-form-stack)))
(let ((important-return-value-fns
'(
;; These functions are side-effect-free except for the
;; behaviour of functions passed as argument.
mapcar mapcan mapconcat
assoc plist-get plist-member
;; It's safe to ignore the value of `sort' and `nreverse'
;; when used on arrays, but most calls pass lists.
nreverse sort
;; Adding these functions causes many warnings;
;; evaluate how many of them are false first.
;;delq delete
;;nconc plist-put
)))
(dolist (fn important-return-value-fns)
(put fn 'important-return-value t)))
(defun byte-compile-normal-call (form)
(when (and (symbolp (car form))
(byte-compile-warning-enabled-p 'callargs (car form)))
@ -3523,11 +3568,7 @@ lambda-expression."
(byte-compile-callargs-warn form))
(if byte-compile-generate-call-tree
(byte-compile-annotate-call-tree form))
(when (and byte-compile--for-effect (eq (car form) 'mapcar)
(byte-compile-warning-enabled-p 'mapcar 'mapcar))
(byte-compile-warn-x
(car form)
"`mapcar' called for effect; use `mapc' or `dolist' instead"))
(byte-compile-push-constant (car form))
(mapc 'byte-compile-form (cdr form)) ; wasteful, but faster.
(byte-compile-out 'byte-call (length (cdr form))))
@ -4367,7 +4408,8 @@ This function is never called when `lexical-binding' is nil."
(defun byte-compile-ignore (form)
(dolist (arg (cdr form))
(byte-compile-form arg t))
;; Compile each argument for-effect but suppress unused-value warnings.
(byte-compile-form arg 'for-effect-no-warn))
(byte-compile-form nil))
;; Return the list of items in CONDITION-PARAM that match PRED-LIST.

View file

@ -408,6 +408,7 @@ Other non-digit chars are considered junk.
RADIX is an integer between 2 and 36, the default is 10. Signal
an error if the substring between START and END cannot be parsed
as an integer unless JUNK-ALLOWED is non-nil."
(declare (side-effect-free t))
(cl-check-type string string)
(let* ((start (or start 0))
(len (length string))
@ -566,6 +567,7 @@ too large if positive or too small if negative)."
;;;###autoload
(defun cl-revappend (x y)
"Equivalent to (append (reverse X) Y)."
(declare (side-effect-free t))
(nconc (reverse x) y))
;;;###autoload

View file

@ -459,6 +459,7 @@ Thus, `(cl-list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to
(defun cl-copy-list (list)
"Return a copy of LIST, which may be a dotted list.
The elements of LIST are not copied, just the list structure itself."
(declare (side-effect-free error-free))
(if (consp list)
(let ((res nil))
(while (consp list) (push (pop list) res))

View file

@ -2891,45 +2891,14 @@ The function's arguments should be treated as immutable.
,(format "compiler-macro for inlining `%s'." name)
(cl--defsubst-expand
',argns '(cl-block ,name ,@(cdr (macroexp-parse-body body)))
;; We used to pass `simple' as
;; (not (or unsafe (cl-expr-access-order pbody argns)))
;; But this is much too simplistic since it
;; does not pay attention to the argvs (and
;; cl-expr-access-order itself is also too naive).
nil
,(and (memq '&key args) 'cl-whole) nil ,@argns)))
(cl-defun ,name ,args ,@body))))
(defun cl--defsubst-expand (argns body simple whole _unsafe &rest argvs)
(if (and whole (not (cl--safe-expr-p (cons 'progn argvs)))) whole
(if (cl--simple-exprs-p argvs) (setq simple t))
(let* ((substs ())
(lets (delq nil
(cl-mapcar (lambda (argn argv)
(if (or simple (macroexp-const-p argv))
(progn (push (cons argn argv) substs)
nil)
(list argn argv)))
argns argvs))))
;; FIXME: `sublis/subst' will happily substitute the symbol
;; `argn' in places where it's not used as a reference
;; to a variable.
;; FIXME: `sublis/subst' will happily copy `argv' to a different
;; scope, leading to name capture.
(setq body (cond ((null substs) body)
((null (cdr substs))
(cl-subst (cdar substs) (caar substs) body))
(t (cl--sublis substs body))))
(if lets `(let ,lets ,body) body))))
(defun cl--sublis (alist tree)
"Perform substitutions indicated by ALIST in TREE (non-destructively)."
(let ((x (assq tree alist)))
(cond
(x (cdr x))
((consp tree)
(cons (cl--sublis alist (car tree)) (cl--sublis alist (cdr tree))))
(t tree))))
(defun cl--defsubst-expand (argns body _simple whole _unsafe &rest argvs)
(if (and whole (not (cl--safe-expr-p (cons 'progn argvs))))
whole
`(let ,(cl-mapcar #'list argns argvs) ,body)))
;;; Structures.
@ -3244,19 +3213,8 @@ To see the documentation for a defined struct type, use
(let* ((anames (cl--arglist-args args))
(make (cl-mapcar (lambda (s d) (if (memq s anames) s d))
slots defaults))
;; `cl-defsubst' is fundamentally broken: it substitutes
;; its arguments into the body's `sexp' much too naively
;; when inlinling, which results in various problems.
;; For example it generates broken code if your
;; argument's name happens to be the same as some
;; function used within the body.
;; E.g. (cl-defsubst sm-foo (list) (list list))
;; will expand `(sm-foo 1)' to `(1 1)' rather than to `(list t)'!
;; Try to catch this known case!
(con-fun (or type #'record))
(unsafe-cl-defsubst
(or (memq con-fun args) (assq con-fun args))))
(push `(,(if unsafe-cl-defsubst 'cl-defun cldefsym) ,cname
(con-fun (or type #'record)))
(push `(,cldefsym ,cname
(&cl-defs (nil ,@descs) ,@args)
,(if (stringp doc) doc
(format "Constructor for objects of type `%s'." name))
@ -3690,14 +3648,53 @@ macro that returns its `&whole' argument."
;;; Things that are side-effect-free.
(mapc (lambda (x) (function-put x 'side-effect-free t))
'(cl-oddp cl-evenp cl-signum last butlast cl-ldiff cl-pairlis cl-gcd
'(cl-oddp cl-evenp cl-signum cl-ldiff cl-pairlis cl-gcd
cl-lcm cl-isqrt cl-floor cl-ceiling cl-truncate cl-round cl-mod cl-rem
cl-subseq cl-list-length cl-get cl-getf))
;;; Things that are side-effect-and-error-free.
(mapc (lambda (x) (function-put x 'side-effect-free 'error-free))
'(eql cl-list* cl-subst cl-acons cl-equalp
cl-random-state-p copy-tree cl-sublis))
'(cl-list* cl-acons cl-equalp
cl-random-state-p copy-tree))
;;; Things whose return value should probably be used.
(mapc (lambda (x) (function-put x 'important-return-value t))
'(
;; Functions that are side-effect-free except for the
;; behaviour of functions passed as argument.
cl-mapcar cl-mapcan cl-maplist cl-map cl-mapcon
cl-reduce
cl-assoc cl-assoc-if cl-assoc-if-not
cl-rassoc cl-rassoc-if cl-rassoc-if-not
cl-member cl-member-if cl-member-if-not
cl-adjoin
cl-mismatch cl-search
cl-find cl-find-if cl-find-if-not
cl-position cl-position-if cl-position-if-not
cl-count cl-count-if cl-count-if-not
cl-remove cl-remove-if cl-remove-if-not
cl-remove-duplicates
cl-subst cl-subst-if cl-subst-if-not
cl-substitute cl-substitute-if cl-substitute-if-not
cl-sublis
cl-union cl-intersection cl-set-difference cl-set-exclusive-or
cl-subsetp
cl-every cl-some cl-notevery cl-notany
cl-tree-equal
;; Functions that mutate and return a list.
cl-delete cl-delete-if cl-delete-if-not
cl-delete-duplicates
cl-nsubst cl-nsubst-if cl-nsubst-if-not
cl-nsubstitute cl-nsubstitute-if cl-nsubstitute-if-not
cl-nunion cl-nintersection cl-nset-difference cl-nset-exclusive-or
cl-nreconc cl-nsublis
cl-merge
;; It's safe to ignore the value of `cl-sort' and `cl-stable-sort'
;; when used on arrays, but most calls pass lists.
cl-sort cl-stable-sort
))
;;; Types and assertions.

View file

@ -176,6 +176,7 @@ supertypes from the most specific to least specific.")
(i 0)
(offset (if type 0 1)))
(dolist (slot slots)
(put (car slot) 'slot-name t)
(let* ((props (cl--plist-to-alist (cddr slot)))
(typep (assq :type props))
(type (if (null typep) t

View file

@ -2853,81 +2853,81 @@ See `edebug-behavior-alist' for implementations.")
edebug-inside-windows
)
(unwind-protect
(let (
;; Declare global values local but using the same global value.
;; We could set these to the values for previous edebug call.
(last-command last-command)
(this-command this-command)
(current-prefix-arg nil)
(last-input-event nil)
(last-command-event nil)
(last-event-frame nil)
(last-nonmenu-event nil)
(track-mouse nil)
(let (
;; Declare global values local but using the same global value.
;; We could set these to the values for previous edebug call.
(last-command last-command)
(this-command this-command)
(current-prefix-arg nil)
(standard-output t)
(standard-input t)
(last-input-event nil)
(last-command-event nil)
(last-event-frame nil)
(last-nonmenu-event nil)
(track-mouse nil)
;; Don't keep reading from an executing kbd macro
;; within edebug unless edebug-continue-kbd-macro is
;; non-nil. Again, local binding may not be best.
(executing-kbd-macro
(if edebug-continue-kbd-macro executing-kbd-macro))
(standard-output t)
(standard-input t)
;; Don't get confused by the user's keymap changes.
(overriding-local-map nil)
(overriding-terminal-local-map nil)
;; Override other minor modes that may bind the keys
;; edebug uses.
(minor-mode-overriding-map-alist
(list (cons 'edebug-mode edebug-mode-map)))
;; Don't keep reading from an executing kbd macro
;; within edebug unless edebug-continue-kbd-macro is
;; non-nil. Again, local binding may not be best.
(executing-kbd-macro
(if edebug-continue-kbd-macro executing-kbd-macro))
;; Bind again to outside values.
(debug-on-error edebug-outside-debug-on-error)
(debug-on-quit edebug-outside-debug-on-quit)
;; Don't get confused by the user's keymap changes.
(overriding-local-map nil)
(overriding-terminal-local-map nil)
;; Override other minor modes that may bind the keys
;; edebug uses.
(minor-mode-overriding-map-alist
(list (cons 'edebug-mode edebug-mode-map)))
;; Don't keep defining a kbd macro.
(defining-kbd-macro
(if edebug-continue-kbd-macro defining-kbd-macro))
;; Bind again to outside values.
(debug-on-error edebug-outside-debug-on-error)
(debug-on-quit edebug-outside-debug-on-quit)
;; others??
)
;; Don't keep defining a kbd macro.
(defining-kbd-macro
(if edebug-continue-kbd-macro defining-kbd-macro))
(if (and (eq edebug-execution-mode 'go)
(not (memq arg-mode '(after error))))
(message "Break"))
;; others??
)
(setq signal-hook-function nil)
(if (and (eq edebug-execution-mode 'go)
(not (memq arg-mode '(after error))))
(message "Break"))
(edebug-mode 1)
(unwind-protect
(recursive-edit) ; <<<<<<<<<< Recursive edit
(setq signal-hook-function nil)
;; Do the following, even if quit occurs.
(setq signal-hook-function #'edebug-signal)
(if edebug-backtrace-buffer
(kill-buffer edebug-backtrace-buffer))
(edebug-mode 1)
(unwind-protect
(recursive-edit) ; <<<<<<<<<< Recursive edit
;; Remember selected-window after recursive-edit.
;; (setq edebug-inside-window (selected-window))
;; Do the following, even if quit occurs.
(setq signal-hook-function #'edebug-signal)
(if edebug-backtrace-buffer
(kill-buffer edebug-backtrace-buffer))
(set-match-data edebug-outside-match-data)
;; Remember selected-window after recursive-edit.
;; (setq edebug-inside-window (selected-window))
;; Recursive edit may have changed buffers,
;; so set it back before exiting let.
(if (buffer-name edebug-buffer) ; if it still exists
(progn
(set-buffer edebug-buffer)
(when (memq edebug-execution-mode '(go Go-nonstop))
(edebug-overlay-arrow)
(sit-for 0))
(edebug-mode -1))
;; gotta have a buffer to let its buffer local variables be set
(get-buffer-create " bogus edebug buffer"))
));; inner let
)))
(set-match-data edebug-outside-match-data)
;; Recursive edit may have changed buffers,
;; so set it back before exiting let.
(if (buffer-name edebug-buffer) ; if it still exists
(progn
(set-buffer edebug-buffer)
(when (memq edebug-execution-mode '(go Go-nonstop))
(edebug-overlay-arrow)
(sit-for 0))
(edebug-mode -1))
;; gotta have a buffer to let its buffer local variables be set
(get-buffer-create " bogus edebug buffer"))
));; inner let
))
;;; Display related functions

View file

@ -681,29 +681,34 @@ This is the default value for `eldoc-documentation-strategy'."
(lambda (f)
(funcall f (eldoc--make-callback :eager f)))))
(defun eldoc--documentation-compose-1 (eagerlyp)
"Helper function for composing multiple doc strings.
If EAGERLYP is non-nil show documentation as soon as possible,
else wait for all doc strings."
(run-hook-wrapped 'eldoc-documentation-functions
(lambda (f)
(let* ((callback (eldoc--make-callback
(if eagerlyp :eager :patient)
f))
(str (funcall f callback)))
(if (or (null str) (stringp str)) (funcall callback str))
nil)))
t)
(defun eldoc-documentation-compose ()
"Show multiple documentation strings together after waiting for all of them.
This is meant to be used as a value for `eldoc-documentation-strategy'."
(eldoc--documentation-compose-1 nil))
(let (fns-and-callbacks)
;; Make all the callbacks, setting up state inside
;; `eldoc--invoke-strategy' to know how many callbacks to wait for
;; before displaying the result (bug#62816).
(run-hook-wrapped 'eldoc-documentation-functions
(lambda (f)
(push (cons f (eldoc--make-callback :patient f))
fns-and-callbacks)
nil))
;; Now call them. The last one will trigger the display.
(cl-loop for (f . callback) in fns-and-callbacks
for str = (funcall f callback)
when (or (null str) (stringp str)) do (funcall callback str)))
t)
(defun eldoc-documentation-compose-eagerly ()
"Show multiple documentation strings one by one as soon as possible.
This is meant to be used as a value for `eldoc-documentation-strategy'."
(eldoc--documentation-compose-1 t))
(run-hook-wrapped 'eldoc-documentation-functions
(lambda (f)
(let* ((callback (eldoc--make-callback :eager f))
(str (funcall f callback)))
(if (or (null str) (stringp str)) (funcall callback str))
nil)))
t)
(defun eldoc-documentation-enthusiast ()
"Show most important documentation string produced so far.

View file

@ -563,9 +563,9 @@ The same keyword arguments are supported as in
;; Emacs's Makefile sets $HOME to a nonexistent value. Needed
;; in batch mode only, therefore.
(when (and noninteractive (not (file-directory-p "~/")))
(setenv "HOME" temporary-file-directory))
(setenv "HOME" (directory-file-name temporary-file-directory)))
(format "/mock::%s" temporary-file-directory))))
"Temporary directory for remote file tests.")
"Temporary directory for remote file tests.")
(provide 'ert-x)

View file

@ -639,6 +639,13 @@ REF must have been previously obtained with `gv-ref'."
;;; Generalized variables.
;; You'd think noone would write `(setf (error ...) ..)' but it
;; appears naturally as the result of macroexpansion of things like
;; (setf (pcase-exhaustive ...)).
;; We could generalize this to `throw' and `signal', but it seems
;; preferable to wait until there's a concrete need.
(gv-define-expander error (lambda (_do &rest args) `(error . ,args)))
;; Some Emacs-related place types.
(gv-define-simple-setter buffer-file-name set-visited-file-name t)
(make-obsolete-generalized-variable

View file

@ -597,73 +597,66 @@ instead of just updating them with the new/changed autoloads."
defs))))))
(progress-reporter-done progress))
;; If we have no autoloads data, but we have EXTRA-DATA, then
;; generate the (almost) empty file anyway.
(if (and (not defs) extra-data)
;; First group per output file.
(dolist (fdefs (seq-group-by (lambda (x) (expand-file-name (car x)))
defs))
(let ((loaddefs-file (car fdefs))
hash)
(with-temp-buffer
(insert (loaddefs-generate--rubric output-file nil t))
(search-backward "\f")
(insert extra-data)
(ensure-empty-lines 1)
(write-region (point-min) (point-max) output-file nil 'silent))
;; We have some data, so generate the loaddef files. First
;; group per output file.
(dolist (fdefs (seq-group-by (lambda (x) (expand-file-name (car x)))
defs))
(let ((loaddefs-file (car fdefs))
hash)
(with-temp-buffer
(if (and updating (file-exists-p loaddefs-file))
(insert-file-contents loaddefs-file)
(insert (loaddefs-generate--rubric
loaddefs-file nil t include-package-version))
(search-backward "\f")
(when extra-data
(insert extra-data)
(ensure-empty-lines 1)))
(setq hash (buffer-hash))
;; Then group by source file (and sort alphabetically).
(dolist (section (sort (seq-group-by #'cadr (cdr fdefs))
(lambda (e1 e2)
(string<
(file-name-sans-extension
(file-name-nondirectory (car e1)))
(file-name-sans-extension
(file-name-nondirectory (car e2)))))))
(pop section)
(let* ((relfile (file-relative-name
(cadar section)
(file-name-directory loaddefs-file)))
(head (concat "\n\f\n;;; Generated autoloads from "
relfile "\n\n")))
(when (file-exists-p loaddefs-file)
;; If we're updating an old loaddefs file, then see if
;; there's a section here for this file already.
(goto-char (point-min))
(if (not (search-forward head nil t))
;; It's a new file; put the data at the end.
(progn
(goto-char (point-max))
(search-backward "\f\n" nil t))
;; Delete the old version of the section.
(delete-region (match-beginning 0)
(and (search-forward "\n\f\n;;;")
(match-beginning 0)))
(forward-line -2)))
(insert head)
(dolist (def (reverse section))
(setq def (caddr def))
(if (stringp def)
(princ def (current-buffer))
(loaddefs-generate--print-form def))
(unless (bolp)
(insert "\n")))))
;; Only write the file if we actually made a change.
(unless (equal (buffer-hash) hash)
(write-region (point-min) (point-max) loaddefs-file nil 'silent)
(byte-compile-info
(file-relative-name loaddefs-file (car (ensure-list dir)))
t "GEN"))))))))
(if (and updating (file-exists-p loaddefs-file))
(insert-file-contents loaddefs-file)
(insert (loaddefs-generate--rubric
loaddefs-file nil t include-package-version))
(search-backward "\f")
(when extra-data
(insert extra-data)
(ensure-empty-lines 1)))
(setq hash (buffer-hash))
;; Then group by source file (and sort alphabetically).
(dolist (section (sort (seq-group-by #'cadr (cdr fdefs))
(lambda (e1 e2)
(string<
(file-name-sans-extension
(file-name-nondirectory (car e1)))
(file-name-sans-extension
(file-name-nondirectory (car e2)))))))
(pop section)
(let* ((relfile (file-relative-name
(cadar section)
(file-name-directory loaddefs-file)))
(head (concat "\n\f\n;;; Generated autoloads from "
relfile "\n\n")))
(when (file-exists-p loaddefs-file)
;; If we're updating an old loaddefs file, then see if
;; there's a section here for this file already.
(goto-char (point-min))
(if (not (search-forward head nil t))
;; It's a new file; put the data at the end.
(progn
(goto-char (point-max))
(search-backward "\f\n" nil t))
;; Delete the old version of the section. Strictly
;; speaking this should search for "\n\f\n;;;", but
;; there are loaddefs files in the wild that only
;; have two ';;'. (Bug#63236)
(delete-region (match-beginning 0)
(and (search-forward "\n\f\n;;")
(match-beginning 0)))
(forward-line -2)))
(insert head)
(dolist (def (reverse section))
(setq def (caddr def))
(if (stringp def)
(princ def (current-buffer))
(loaddefs-generate--print-form def))
(unless (bolp)
(insert "\n")))))
;; Only write the file if we actually made a change.
(unless (equal (buffer-hash) hash)
(write-region (point-min) (point-max) loaddefs-file nil 'silent)
(byte-compile-info
(file-relative-name loaddefs-file (car (ensure-list dir)))
t "GEN")))))))
(defun loaddefs-generate--print-form (def)
"Print DEF in a format that makes sense for version control."

View file

@ -24,7 +24,7 @@
;; While packages managed by package.el use tarballs for distributing
;; the source code, this extension allows for packages to be fetched
;; and updated directly from a version control system.
;; and upgraded directly from a version control system.
;;
;; To install a package from source use `package-vc-install'. If you
;; aren't interested in activating a package, you can use
@ -147,32 +147,9 @@ is a symbol designating the package and SPEC is one of:
- nil, if any package version can be installed;
- a version string, if that specific revision is to be installed;
- a property list, describing a package specification. Valid
key/value pairs are
`:url' (string)
The URL of the repository used to fetch the package source.
`:branch' (string)
If given, the name of the branch to checkout after cloning the directory.
`:lisp-dir' (string)
The repository-relative name of the directory to use for loading the Lisp
sources. If not given, the value defaults to the root directory
of the repository.
`:main-file' (string)
The main file of the project, relevant to gather package metadata.
If not given, the assumed default is the package name with \".el\"
appended to it.
`:vc-backend' (symbol)
A symbol of the VC backend to use for cloning the package. The
value ought to be a member of `vc-handled-backends'. If omitted,
`vc-clone' will fall back onto the archive default or on
`package-vc-default-backend'.
All other keys are ignored.
- a property list, describing a package specification. For more
details, please consult the subsection \"Specifying Package
Sources\" in the Info node `(emacs)Fetching Package Sources'.
This user option will be automatically updated to store package
specifications for packages that are not specified in any
@ -186,10 +163,11 @@ archive."
(:branch string)
(:lisp-dir string)
(:main-file string)
(:doc string)
(:vc-backend symbol)))))
:version "29.1")
(defvar package-vc--archive-spec-alist nil
(defvar package-vc--archive-spec-alists nil
"List of package specifications for each archive.
The list maps each package name, as a string, to a plist as
specified in `package-vc-selected-packages'.")
@ -221,15 +199,15 @@ name for PKG-DESC."
(not (alist-get name package-vc-selected-packages
nil nil #'string=)))
(alist-get (intern (package-desc-archive pkg-desc))
package-vc--archive-spec-alist)
package-vc--archive-spec-alists)
;; Consult both our local list of package specifications, as well
;; as the lists provided by the archives.
(apply #'append (cons package-vc-selected-packages
(mapcar #'cdr package-vc--archive-spec-alist))))
(mapcar #'cdr package-vc--archive-spec-alists))))
'() nil #'string=))
(defun package-vc--read-archive-data (archive)
"Update `package-vc--archive-spec-alist' for ARCHIVE.
"Update `package-vc--archive-spec-alists' for ARCHIVE.
This function is meant to be used as a hook for `package-read-archive-hook'."
(let ((contents-file (expand-file-name
(format "archives/%s/elpa-packages.eld" archive)
@ -246,7 +224,7 @@ This function is meant to be used as a hook for `package-read-archive-hook'."
(let ((spec (read (current-buffer))))
(when (eq package-vc--elpa-packages-version
(plist-get (cdr spec) :version))
(setf (alist-get (intern archive) package-vc--archive-spec-alist)
(setf (alist-get (intern archive) package-vc--archive-spec-alists)
(car spec)))
(setf (alist-get (intern archive) package-vc--archive-data-alist)
(cdr spec))
@ -257,7 +235,7 @@ This function is meant to be used as a hook for `package-read-archive-hook'."
(defun package-vc--download-and-read-archives (&optional async)
"Download specifications of all `package-archives' and read them.
Populate `package-vc--archive-spec-alist' with the result.
Populate `package-vc--archive-spec-alists' with the result.
If optional argument ASYNC is non-nil, perform the downloads
asynchronously."
@ -605,7 +583,7 @@ Emacs Lisp files.")
(defun package-vc--unpack (pkg-desc pkg-spec &optional rev)
"Install the package described by PKG-DESC.
PKG-SPEC is a package specification, a property list describing
how to fetch and build the package. See `package-vc--archive-spec-alist'
how to fetch and build the package. See `package-vc--archive-spec-alists'
for details. The optional argument REV specifies a specific revision to
checkout. This overrides the `:branch' attribute in PKG-SPEC."
(unless (eq (package-desc-kind pkg-desc) 'vc)
@ -654,7 +632,8 @@ abort installation?" name))
(throw 'done (setq lisp-dir name)))))
;; Ensure we have a copy of the package specification
(unless (equal (alist-get name (mapcar #'cdr package-vc--archive-spec-alist)) pkg-spec)
(unless (seq-some (lambda (alist) (equal (alist-get name (cdr alist)) pkg-spec))
package-vc--archive-spec-alists)
(customize-save-variable
'package-vc-selected-packages
(cons (cons name pkg-spec)
@ -694,19 +673,19 @@ installed package."
#'string=)))
;;;###autoload
(defun package-vc-update-all ()
"Attempt to update all installed VC packages."
(defun package-vc-upgrade-all ()
"Attempt to upgrade all installed VC packages."
(interactive)
(dolist (package package-alist)
(dolist (pkg-desc (cdr package))
(when (package-vc-p pkg-desc)
(package-vc-update pkg-desc))))
(message "Done updating packages."))
(package-vc-upgrade pkg-desc))))
(message "Done upgrading packages."))
;;;###autoload
(defun package-vc-update (pkg-desc)
"Attempt to update the package PKG-DESC."
(interactive (list (package-vc--read-package-desc "Update VC package: " t)))
(defun package-vc-upgrade (pkg-desc)
"Attempt to upgrade the package PKG-DESC."
(interactive (list (package-vc--read-package-desc "Upgrade VC package: " t)))
;; HACK: To run `package-vc--unpack-1' after checking out the new
;; revision, we insert a hook into `vc-post-command-functions', and
;; remove it right after it ran. To avoid running the hook multiple
@ -904,7 +883,7 @@ Rebuilding an installation means scraping for new autoload
cookies, re-compiling Emacs Lisp files, building and installing
any documentation, downloading any missing dependencies. This
command does not fetch new revisions from a remote server. That
is the responsibility of `package-vc-update'. Interactively,
is the responsibility of `package-vc-upgrade'. Interactively,
prompt for the name of the package to rebuild."
(interactive (list (package-vc--read-package-desc "Rebuild package: " t)))
(package-vc--unpack-1 pkg-desc (package-desc-dir pkg-desc)))

View file

@ -795,6 +795,21 @@ specifying the minimum acceptable version."
(require 'finder-inf nil t) ; For `package--builtins'.
(assq package package--builtins))))))
(defun package--active-built-in-p (package)
"Return non-nil if the built-in version of PACKAGE is used.
If the built-in version of PACKAGE is used and PACKAGE is
also available for installation from an archive, it is an
indication that PACKAGE was never upgraded to any newer
version from the archive."
(and (not (assq (cond
((package-desc-p package)
(package-desc-name package))
((stringp package) (intern package))
((symbolp package) package)
((error "Unknown package format: %S" package)))
(package--alist)))
(package-built-in-p package)))
(defun package--autoloads-file-name (pkg-desc)
"Return the absolute name of the autoloads file, sans extension.
PKG-DESC is a `package-desc' object."
@ -1181,7 +1196,7 @@ boundaries."
;; the earliest in version 31.1. The idea is to phase out the
;; requirement for a "footer line" without unduly impacting users
;; on earlier Emacs versions. See Bug#26490 for more details.
(unless (search-forward (concat ";;; " file-name ".el ends here"))
(unless (search-forward (concat ";;; " file-name ".el ends here") nil t)
(lwarn '(package package-format) :warning
"Package lacks a terminating comment"))
;; Try to include a trailing newline.
@ -1209,8 +1224,8 @@ boundaries."
:url website
:keywords keywords
:maintainer
;; For backward compatibility, use a single string if there's only
;; one maintainer (the most common case).
;; For backward compatibility, use a single cons-cell if
;; there's only one maintainer (the most common case).
(let ((maints (lm-maintainers))) (if (cdr maints) maints (car maints)))
:authors (lm-authors)))))
@ -1218,15 +1233,14 @@ boundaries."
"Read a `define-package' form in current buffer.
Return the pkg-desc, with desc-kind set to KIND."
(goto-char (point-min))
(unwind-protect
(let* ((pkg-def-parsed (read (current-buffer)))
(pkg-desc
(when (eq (car pkg-def-parsed) 'define-package)
(apply #'package-desc-from-define
(append (cdr pkg-def-parsed))))))
(when pkg-desc
(setf (package-desc-kind pkg-desc) kind)
pkg-desc))))
(let* ((pkg-def-parsed (read (current-buffer)))
(pkg-desc
(when (eq (car pkg-def-parsed) 'define-package)
(apply #'package-desc-from-define
(append (cdr pkg-def-parsed))))))
(when pkg-desc
(setf (package-desc-kind pkg-desc) kind)
pkg-desc)))
(declare-function tar-get-file-descriptor "tar-mode" (file))
(declare-function tar--extract "tar-mode" (descriptor))
@ -2179,12 +2193,18 @@ using `package-compute-transaction'."
(unless package-archive-contents
(package-refresh-contents)))
(defcustom package-install-upgrade-built-in nil
"Non-nil means that built-in packages can be upgraded via a package archive.
If disabled, then `package-install' will not suggest to replace a
built-in package with a (possibly newer) version from a package archive."
:type 'boolean
:version "29.1")
;;;###autoload
(defun package-install (pkg &optional dont-select)
"Install the package PKG.
PKG can be a `package-desc' or a symbol naming one of the
available packages in an archive in `package-archives'. When
called interactively, prompt for the package name.
available packages in an archive in `package-archives'.
Mark the installed package as selected by adding it to
`package-selected-packages'.
@ -2194,7 +2214,11 @@ non-nil, install the package but do not add it to
`package-selected-packages'.
If PKG is a `package-desc' and it is already installed, don't try
to install it but still mark it as selected."
to install it but still mark it as selected.
If the command is invoked with a prefix argument, it will allow
upgrading of built-in packages, as if `package-install-upgrade-built-in'
had been enabled."
(interactive
(progn
;; Initialize the package system to get the list of package
@ -2202,11 +2226,14 @@ to install it but still mark it as selected."
(package--archives-initialize)
(list (intern (completing-read
"Install package: "
(delq nil
(mapcar (lambda (elt)
(unless (package-installed-p (car elt))
(symbol-name (car elt))))
package-archive-contents))
(mapcan
(lambda (elt)
(and (or (and (or current-prefix-arg
package-install-upgrade-built-in)
(package--active-built-in-p (car elt)))
(not (package-installed-p (car elt))))
(list (symbol-name (car elt)))))
package-archive-contents)
nil t))
nil)))
(package--archives-initialize)
@ -2217,6 +2244,9 @@ to install it but still mark it as selected."
(unless (or dont-select (package--user-selected-p name))
(package--save-selected-packages
(cons name package-selected-packages)))
(when (and (or current-prefix-arg package-install-upgrade-built-in)
(package--active-built-in-p pkg))
(setq pkg (or (cadr (assq name package-archive-contents)) pkg)))
(if-let* ((transaction
(if (package-desc-p pkg)
(unless (package-installed-p pkg)
@ -2229,24 +2259,30 @@ to install it but still mark it as selected."
(message "Package `%s' installed." name))
(message "`%s' is already installed" name))))
(declare-function package-vc-update "package-vc" (pkg))
(declare-function package-vc-upgrade "package-vc" (pkg))
;;;###autoload
(defun package-update (name)
"Update package NAME if a newer version exists."
(defun package-upgrade (name)
"Upgrade package NAME if a newer version exists."
(interactive
(list (completing-read
"Update package: " (package--updateable-packages) nil t)))
"Upgrade package: " (package--upgradeable-packages t) nil t)))
(let* ((package (if (symbolp name)
name
(intern name)))
(pkg-desc (cadr (assq package package-alist))))
(if (package-vc-p pkg-desc)
(package-vc-update pkg-desc)
(package-delete pkg-desc 'force)
(package-install package 'dont-select))))
(pkg-desc (cadr (assq package package-alist)))
(package-install-upgrade-built-in (not pkg-desc)))
;; `pkg-desc' will be nil when the package is an "active built-in".
(if (and pkg-desc (package-vc-p pkg-desc))
(package-vc-upgrade pkg-desc)
(when pkg-desc
(package-delete pkg-desc 'force 'dont-unselect))
(package-install package
;; An active built-in has never been "selected"
;; before. Mark it as installed explicitly.
(and pkg-desc 'dont-select)))))
(defun package--updateable-packages ()
(defun package--upgradeable-packages (&optional include-builtins)
;; Initialize the package system to get the list of package
;; symbols for completion.
(package--archives-initialize)
@ -2257,30 +2293,46 @@ to install it but still mark it as selected."
(or (let ((available
(assq (car elt) package-archive-contents)))
(and available
(version-list-<
(package-desc-version (cadr elt))
(package-desc-version (cadr available)))))
(package-vc-p (cadr (assq (car elt) package-alist)))))
package-alist)))
(or (and
include-builtins
(not (package-desc-version (cadr elt))))
(version-list-<
(package-desc-version (cadr elt))
(package-desc-version (cadr available))))))
(package-vc-p (cadr elt))))
(if include-builtins
(append package-alist
(mapcan
(lambda (elt)
(when (not (assq (car elt) package-alist))
(list (list (car elt) (package--from-builtin elt)))))
package--builtins))
package-alist))))
;;;###autoload
(defun package-update-all (&optional query)
(defun package-upgrade-all (&optional query)
"Refresh package list and upgrade all packages.
If QUERY, ask the user before updating packages. When called
interactively, QUERY is always true."
If QUERY, ask the user before upgrading packages. When called
interactively, QUERY is always true.
Currently, packages which are part of the Emacs distribution are
not upgraded by this command. To enable upgrading such a package
using this command, first upgrade the package to a newer version
from ELPA by either using `\\[package-upgrade]' or
`\\<package-menu-mode-map>\\[package-menu-mark-install]' after `\\[list-packages]'."
(interactive (list (not noninteractive)))
(package-refresh-contents)
(let ((updateable (package--updateable-packages)))
(if (not updateable)
(message "No packages to update")
(let ((upgradeable (package--upgradeable-packages)))
(if (not upgradeable)
(message "No packages to upgrade")
(when (and query
(not (yes-or-no-p
(if (length= updateable 1)
"One package to update. Do it? "
(format "%s packages to update. Do it?"
(length updateable))))))
(user-error "Updating aborted"))
(mapc #'package-update updateable))))
(if (length= upgradeable 1)
"One package to upgrade. Do it? "
(format "%s packages to upgrade. Do it?"
(length upgradeable))))))
(user-error "Upgrade aborted"))
(mapc #'package-upgrade upgradeable))))
(defun package--dependencies (pkg)
"Return a list of all dependencies PKG has.
@ -2693,7 +2745,8 @@ Helper function for `describe-package'."
(status (if desc (package-desc-status desc) "orphan"))
(incompatible-reason (package--incompatible-p desc))
(signed (if desc (package-desc-signed desc)))
(maintainer (cdr (assoc :maintainer extras)))
(maintainers (or (cdr (assoc :maintainers extras))
(cdr (assoc :maintainer extras))))
(authors (cdr (assoc :authors extras)))
(news (and-let* (pkg-dir
((not built-in))
@ -2828,19 +2881,21 @@ Helper function for `describe-package'."
'action 'package-keyword-button-action)
(insert " "))
(insert "\n"))
(when maintainer
(package--print-help-section "Maintainer")
(package--print-email-button maintainer))
(when authors
(when maintainers
(unless (proper-list-p maintainers)
(setq maintainers (list maintainers)))
(package--print-help-section
(if (= (length authors) 1)
"Author"
"Authors"))
(package--print-email-button (pop authors))
;; If there's more than one author, indent the rest correctly.
(dolist (name authors)
(insert (make-string 13 ?\s))
(package--print-email-button name)))
(if (cdr maintainers) "Maintainers" "Maintainer"))
(dolist (maintainer maintainers)
(when (bolp)
(insert (make-string 13 ?\s)))
(package--print-email-button maintainer)))
(when authors
(package--print-help-section (if (cdr authors) "Authors" "Author"))
(dolist (author authors)
(when (bolp)
(insert (make-string 13 ?\s)))
(package--print-email-button author)))
(let* ((all-pkgs (append (cdr (assq name package-alist))
(cdr (assq name package-archive-contents))
(let ((bi (assq name package--builtins)))

View file

@ -722,16 +722,12 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
(let (viper-vi-kbd-minor-mode
viper-insert-kbd-minor-mode
viper-emacs-kbd-minor-mode)
(unwind-protect
(progn
(setq com
(key-binding (setq key (read-key-sequence nil))))
;; In case of binding indirection--chase definitions.
;; Have to do it here because we execute this command under
;; different keymaps, so command-execute may not do the
;; right thing there
(while (vectorp com) (setq com (key-binding com))))
nil)
(setq com (key-binding (setq key (read-key-sequence nil))))
;; In case of binding indirection--chase definitions.
;; Have to do it here because we execute this command under
;; different keymaps, so command-execute may not do the
;; right thing there
(while (vectorp com) (setq com (key-binding com)))
;; Execute command com in the original Viper state, not in state
;; `state'. Otherwise, if we switch buffers while executing the
;; escaped to command, Viper's mode vars will remain those of
@ -1950,16 +1946,16 @@ To turn this feature off, set this variable to nil."
(if found
()
(viper-tmp-insert-at-eob " [Please complete file name]")
(unwind-protect
(while (not (memq cmd
'(exit-minibuffer viper-exit-minibuffer)))
(setq cmd
(key-binding (setq key (read-key-sequence nil))))
(cond ((eq cmd 'self-insert-command)
(insert key))
((memq cmd '(exit-minibuffer viper-exit-minibuffer))
nil)
(t (command-execute cmd))))))))))
(while (not (memq cmd
'(exit-minibuffer viper-exit-minibuffer)))
(setq cmd
(key-binding (setq key (read-key-sequence nil))))
(cond ((eq cmd 'self-insert-command)
(insert key))
((memq cmd '(exit-minibuffer viper-exit-minibuffer))
nil)
(t (command-execute cmd)))))))))
(defun viper-minibuffer-trim-tail ()

View file

@ -294,7 +294,8 @@
"\\|"
"bash$\\|bash.exe$"
"\\)")
shell-file-name)))
shell-file-name)
t))
"Is the user using a unix-type shell under a non-OS?"
:type 'boolean)

View file

@ -47,7 +47,8 @@
(defun viper-window-display-p ()
(and window-system (not (memq window-system '(tty stream pc)))))
(defcustom viper-ms-style-os-p (memq system-type '(ms-dos windows-nt))
(defcustom viper-ms-style-os-p
(not (not (memq system-type '(ms-dos windows-nt))))
"Non-nil if Emacs is running under an MS-style OS: MS-DOS, or MS-Windows."
:type 'boolean
:tag "Is it Microsoft-made OS?"

View file

@ -102,11 +102,12 @@
(require 'erc-common)
(defvar erc--target)
(defvar erc-auto-query)
(defvar erc--user-from-nick-function)
(defvar erc-channel-list)
(defvar erc-channel-users)
(defvar erc-default-nicks)
(defvar erc-default-recipients)
(defvar erc-ensure-target-buffer-on-privmsg)
(defvar erc-format-nick-function)
(defvar erc-format-query-as-channel-p)
(defvar erc-hide-prompt)
@ -123,6 +124,8 @@
(defvar erc-nick-change-attempt-count)
(defvar erc-prompt-for-channel-key)
(defvar erc-prompt-hidden)
(defvar erc-receive-query-display)
(defvar erc-receive-query-display-defer)
(defvar erc-reuse-buffers)
(defvar erc-verbose-server-ping)
(defvar erc-whowas-on-nosuchnick)
@ -297,6 +300,12 @@ function `erc-server-process-alive' instead.")
(defvar-local erc-server-reconnect-count 0
"Number of times we have failed to reconnect to the current server.")
(defvar-local erc--server-reconnect-display-timer nil
"Timer that resets `erc--server-last-reconnect-count' to zero.
Becomes non-nil in all server buffers when an IRC connection is
first \"established\" and carries out its duties
`erc-reconnect-display-timeout' seconds later.")
(defvar-local erc--server-last-reconnect-count 0
"Snapshot of reconnect count when the connection was established.")
@ -415,8 +424,12 @@ This only has an effect if `erc-server-auto-reconnect' is non-nil."
(defcustom erc-server-reconnect-timeout 1
"Number of seconds to wait between successive reconnect attempts.
If a key is pressed while ERC is waiting, it will stop waiting."
If this value is too low, servers may reject your initial nick
request upon reconnecting because they haven't yet noticed that
your previous connection is dead. If this happens, try setting
this value to 120 or greater and/or exploring the option
`erc-nickname-in-use-functions', which may provide a more
proactive means of handling this situation on some servers."
:type 'number)
(defcustom erc-server-reconnect-function 'erc-server-delayed-reconnect
@ -427,6 +440,7 @@ dialing. Use `erc-schedule-reconnect' to instead try again later
and optionally alter the attempts tally."
:package-version '(ERC . "5.5")
:type '(choice (function-item erc-server-delayed-reconnect)
(function-item erc-server-delayed-check-reconnect)
function))
(defcustom erc-split-line-length 440
@ -559,6 +573,47 @@ If this is set to nil, never try to reconnect."
;;;; Helper functions
(defvar erc--reject-unbreakable-lines nil
"Signal an error when a line exceeds `erc-split-line-length'.
Sending such lines and hoping for the best is no longer supported
in ERC 5.6. This internal var exists as a possibly temporary
escape hatch for inhibiting their transmission.")
(defun erc--split-line (longline)
(let* ((coding (erc-coding-system-for-target nil))
(original-window-buf (window-buffer (selected-window)))
out)
(when (consp coding)
(setq coding (car coding)))
(setq coding (coding-system-change-eol-conversion coding 'unix))
(unwind-protect
(with-temp-buffer
(set-window-buffer (selected-window) (current-buffer))
(insert longline)
(goto-char (point-min))
(while (not (eobp))
(let ((upper (filepos-to-bufferpos erc-split-line-length
'exact coding)))
(goto-char (or upper (point-max)))
(unless (eobp)
(skip-chars-backward "^ \t"))
(when (bobp)
(when erc--reject-unbreakable-lines
(user-error
(substitute-command-keys
(concat "Unbreakable line encountered "
"(Recover input with \\[erc-previous-command])"))))
(goto-char upper))
(when-let ((cmp (find-composition (point) (1+ (point)))))
(if (= (car cmp) (point-min))
(goto-char (nth 1 cmp))
(goto-char (car cmp)))))
(cl-assert (/= (point-min) (point)))
(push (buffer-substring-no-properties (point-min) (point)) out)
(delete-region (point-min) (point)))
(or (nreverse out) (list "")))
(set-window-buffer (selected-window) original-window-buf))))
;; From Circe
(defun erc-split-line (longline)
"Return a list of lines which are not too long for IRC.
@ -658,6 +713,30 @@ The current buffer is given by BUFFER."
(run-hooks 'erc--server-post-connect-hook)
(erc-login))
(defvar erc--server-connect-function #'erc--server-propagate-failed-connection
"Function called one second after creating a server process.
Called with the newly created process just before the opening IRC
protocol exchange.")
(defun erc--server-propagate-failed-connection (process)
"Ensure the PROCESS sentinel runs at least once on early failure.
Act as a watchdog timer to force `erc-process-sentinel' and its
finalizers, like `erc-disconnected-hook', to run when PROCESS has
a status of `failed' after one second. But only do so when its
error data is something ERC recognizes. Print an explanation to
the server buffer in any case."
(when (eq (process-status process) 'failed)
(erc-display-message
nil 'error (process-buffer process)
(format "Process exit status: %S" (process-exit-status process)))
(pcase (process-exit-status process)
(111
(erc-process-sentinel process "failed with code 111\n"))
(`(file-error . ,_)
(erc-process-sentinel process "failed with code -523\n"))
((rx "tls" (+ nonl) "failed")
(erc-process-sentinel process "failed with code -525\n")))))
(defvar erc--server-connect-dumb-ipv6-regexp
;; Not for validation (gives false positives).
(rx bot "[" (group (+ (any xdigit digit ":.")) (? "%" (+ alnum))) "]" eot))
@ -710,7 +789,9 @@ TLS (see `erc-session-client-certificate' for more details)."
;; MOTD line)
(if (eq (process-status process) 'connect)
;; waiting for a non-blocking connect - keep the user informed
(erc-display-message nil nil buffer "Opening connection..\n")
(progn
(erc-display-message nil nil buffer "Opening connection..\n")
(run-at-time 1 nil erc--server-connect-function process))
(message "%s...done" msg)
(erc--register-connection))))
@ -744,6 +825,78 @@ Make sure you are in an ERC buffer when running this."
(with-current-buffer buffer
(erc-server-reconnect))))
(defvar-local erc--server-reconnect-timeout nil)
(defvar-local erc--server-reconnect-timeout-check 10)
(defvar-local erc--server-reconnect-timeout-scale-function
#'erc--server-reconnect-timeout-double)
(defun erc--server-reconnect-timeout-double (existing)
"Double EXISTING timeout, but cap it at 5 minutes."
(min 300 (* existing 2)))
;; This may appear to hang at various places. It's assumed that when
;; *Messages* contains "Waiting for socket ..." or similar, progress
;; will be made eventually.
(defun erc-server-delayed-check-reconnect (buffer)
"Wait for internet connectivity before trying to reconnect.
Expect BUFFER to be the server buffer for the current connection."
(when (buffer-live-p buffer)
(with-current-buffer buffer
(setq erc--server-reconnect-timeout
(funcall erc--server-reconnect-timeout-scale-function
(or erc--server-reconnect-timeout
erc-server-reconnect-timeout)))
(let* ((reschedule (lambda (proc)
(when (buffer-live-p buffer)
(with-current-buffer buffer
(let ((erc-server-reconnect-timeout
erc--server-reconnect-timeout))
(delete-process proc)
(erc-display-message nil 'error buffer
"Nobody home...")
(erc-schedule-reconnect buffer 0))))))
(conchk-exp (time-add erc--server-reconnect-timeout-check
(current-time)))
(conchk-timer nil)
(conchk (lambda (proc)
(let ((status (process-status proc))
(xprdp (time-less-p conchk-exp (current-time))))
(when (or (not (eq 'connect status)) xprdp)
(cancel-timer conchk-timer))
(when (buffer-live-p buffer)
(cond (xprdp (erc-display-message
nil 'error buffer
"Timed out while dialing...")
(delete-process proc)
(funcall reschedule proc))
((eq 'failed status)
(funcall reschedule proc)))))))
(sentinel (lambda (proc event)
(pcase event
("open\n"
(run-at-time nil nil #'send-string proc
(format "PING %d\r\n"
(time-convert nil 'integer))))
((or "connection broken by remote peer\n"
(rx bot "failed"))
(funcall reschedule proc)))))
(filter (lambda (proc _)
(delete-process proc)
(with-current-buffer buffer
(setq erc--server-reconnect-timeout nil))
(run-at-time nil nil #'erc-server-delayed-reconnect
buffer))))
(condition-case _
(let ((proc (funcall erc-session-connector
"*erc-connectivity-check*" nil
erc-session-server erc-session-port
:nowait t)))
(setq conchk-timer (run-at-time 1 1 conchk proc))
(set-process-filter proc filter)
(set-process-sentinel proc sentinel))
(file-error (funcall reschedule nil)))))))
(defun erc-server-filter-function (process string)
"The process filter for the ERC server."
(with-current-buffer (process-buffer process)
@ -798,6 +951,22 @@ EVENT is the message received from the closed connection process."
erc-server-reconnecting)
(erc--server-reconnect-p event)))
(defun erc--server-last-reconnect-on-disconnect (&rest _)
(remove-hook 'erc-disconnected-hook
#'erc--server-last-reconnect-on-disconnect t)
(erc--server-last-reconnect-display-reset (current-buffer)))
(defun erc--server-last-reconnect-display-reset (buffer)
"Deactivate `erc-reconnect-display'."
(when (buffer-live-p buffer)
(with-current-buffer buffer
(when erc--server-reconnect-display-timer
(cancel-timer erc--server-reconnect-display-timer)
(remove-hook 'erc-disconnected-hook
#'erc--server-last-reconnect-display-reset t)
(setq erc--server-reconnect-display-timer nil
erc--server-last-reconnect-count 0)))))
(defconst erc--mode-line-process-reconnecting
'(:eval (erc-with-server-buffer
(and erc--server-reconnect-timer
@ -823,11 +992,16 @@ When `erc-server-reconnect-attempts' is a number, increment
`erc-server-reconnect-count' by INCR unconditionally."
(let ((count (and (integerp erc-server-reconnect-attempts)
(- erc-server-reconnect-attempts
(cl-incf erc-server-reconnect-count (or incr 1))))))
(erc-display-message nil 'error (current-buffer) 'reconnecting
(cl-incf erc-server-reconnect-count (or incr 1)))))
(proc (buffer-local-value 'erc-server-process buffer)))
(erc-display-message nil 'error buffer 'reconnecting
?m erc-server-reconnect-timeout
?i (if count erc-server-reconnect-count "N")
?n (if count erc-server-reconnect-attempts "A"))
(set-process-sentinel proc #'ignore)
(set-process-filter proc nil)
(delete-process proc)
(erc-update-mode-line)
(setq erc-server-reconnecting nil
erc--server-reconnect-timer
(run-at-time erc-server-reconnect-timeout nil
@ -1327,8 +1501,6 @@ Finds hooks by looking in the `erc-server-responses' hash table."
(erc-with-server-buffer
(run-hook-with-args 'erc-timer-hook (erc-current-time)))))
(add-hook 'erc-default-server-functions #'erc-handle-unknown-server-response)
(defun erc-handle-unknown-server-response (proc parsed)
"Display unknown server response's message."
(let ((line (concat (erc-response.sender parsed)
@ -1723,11 +1895,16 @@ add things to `%s' instead."
(unless (or buffer noticep (string-empty-p tgt) (eq ?$ (aref tgt 0))
(erc-is-message-ctcp-and-not-action-p msg))
(if privp
(when erc-auto-query
(let ((erc-join-buffer erc-auto-query))
(setq buffer (erc--open-target nick))))
;; A channel buffer has been killed but is still joined
(setq buffer (erc--open-target tgt))))
(when-let ((erc-join-buffer
(or (and (not erc-receive-query-display-defer)
erc-receive-query-display)
(and erc-ensure-target-buffer-on-privmsg
(or erc-receive-query-display
erc-join-buffer)))))
(setq buffer (erc--open-target nick)))
;; A channel buffer has been killed but is still joined.
(when erc-ensure-target-buffer-on-privmsg
(setq buffer (erc--open-target tgt)))))
(when buffer
(with-current-buffer buffer
(when privp (erc--unhide-prompt))
@ -1736,7 +1913,8 @@ add things to `%s' instead."
;; at this point.
(erc-update-channel-member (if privp nick tgt) nick nick
privp nil nil nil nil nil host login nil nil t)
(let ((cdata (erc-get-channel-user nick)))
(let ((cdata (funcall erc--user-from-nick-function
(erc-downcase nick) sndr parsed)))
(setq fnick (funcall erc-format-nick-function
(car cdata) (cdr cdata))))))
(cond
@ -1876,7 +2054,7 @@ ambiguous and only useful for tokens supporting a single
primitive value."
(if-let* ((table (or erc--isupport-params
(erc-with-server-buffer erc--isupport-params)))
(value (erc-compat--with-memoization (gethash key table)
(value (with-memoization (gethash key table)
(when-let ((v (assoc (symbol-name key)
erc-server-parameters)))
(if (cdr v)
@ -2236,6 +2414,11 @@ See `erc-display-server-message'." nil
(erc-display-message parsed '(notice error) 'active
's401 ?n nick/channel)))
(define-erc-response-handler (402)
"No such server." nil
(erc-display-message parsed '(notice error) 'active
's402 ?c (cadr (erc-response.command-args parsed))))
(define-erc-response-handler (403)
"No such channel." nil
(erc-display-message parsed '(notice error) 'active
@ -2383,7 +2566,7 @@ See `erc-display-error-notice'." nil
;; (define-erc-response-handler (323 364 365 381 382 392 393 394 395
;; 200 201 202 203 204 205 206 208 209 211 212 213
;; 214 215 216 217 218 219 241 242 243 244 249 261
;; 262 302 342 351 402 407 409 411 413 414 415
;; 262 302 342 351 407 409 411 413 414 415
;; 423 424 436 441 443 444 467 471 472 473 KILL)
;; nil nil
;; (ignore proc parsed))

View file

@ -52,14 +52,15 @@
;;;###autoload(autoload 'erc-button-mode "erc-button" nil t)
(define-erc-module button nil
"This mode buttonizes all messages according to `erc-button-alist'."
((add-hook 'erc-insert-modify-hook #'erc-button-add-buttons 'append)
((erc-button--check-nicknames-entry)
(add-hook 'erc-insert-modify-hook #'erc-button-add-buttons 'append)
(add-hook 'erc-send-modify-hook #'erc-button-add-buttons 'append)
(add-hook 'erc-complete-functions #'erc-button-next-function)
(add-hook 'erc-mode-hook #'erc-button-setup))
(add-hook 'erc--tab-functions #'erc-button-next)
(erc--modify-local-map t "<backtab>" #'erc-button-previous))
((remove-hook 'erc-insert-modify-hook #'erc-button-add-buttons)
(remove-hook 'erc-send-modify-hook #'erc-button-add-buttons)
(remove-hook 'erc-complete-functions #'erc-button-next-function)
(remove-hook 'erc-mode-hook #'erc-button-setup)))
(remove-hook 'erc--tab-functions #'erc-button-next)
(erc--modify-local-map nil "<backtab>" #'erc-button-previous)))
;;; Variables
@ -127,13 +128,12 @@ longer than `erc-fill-column'."
;; things hard to maintain.
'((nicknames 0 erc-button-buttonize-nicks erc-nick-popup 0)
(erc-button-url-regexp 0 t browse-url-button-open-url 0)
("<URL: *\\([^<> ]+\\) *>" 0 t browse-url-button-open-url 1)
;;; ("(\\(\\([^~\n \t@][^\n \t@]*\\)@\\([a-zA-Z0-9.:-]+\\)\\)" 1 t finger 2 3)
;; emacs internal
("[`]\\([a-zA-Z][-a-zA-Z_0-9!*<=>+]+\\)[']"
1 t erc-button-describe-symbol 1)
;; pseudo links
("\\bInfo:[\"]\\([^\"]+\\)[\"]" 0 t Info-goto-node 1)
("\\(?:\\bInfo: ?\\|(info \\)[\"]\\(([^\"]+\\)[\"])?" 0 t info 1)
("\\b\\(Ward\\|Wiki\\|WardsWiki\\|TheWiki\\):\\([A-Z][a-z]+\\([A-Z][a-z]+\\)+\\)"
0 t (lambda (page)
(browse-url (concat "http://c2.com/cgi-bin/wiki?" page)))
@ -165,8 +165,14 @@ REGEXP is the string matching text around the button or a symbol
BUTTON is the number of the regexp grouping actually matching the
button. This is ignored if REGEXP is `nicknames'.
FORM is a Lisp expression which must eval to true for the button to
be added.
FORM is either a boolean or a special variable whose value must
be non-nil for the button to be added. When REGEXP is the
special symbol `nicknames', FORM must be the symbol
`erc-button-buttonize-nicks'. Anything else is deprecated.
For all other entries, FORM can also be a function to call in
place of `erc-button-add-button' with the exact same arguments.
When FORM is also a special variable, ERC disregards the
variable and calls the function.
CALLBACK is the function to call when the user push this button.
CALLBACK can also be a symbol. Its variable value will be used
@ -176,7 +182,7 @@ PAR is a number of a regexp grouping whose text will be passed to
CALLBACK. There can be several PAR arguments. If REGEXP is
`nicknames', these are ignored, and CALLBACK will be called with
the nickname matched as the argument."
:package-version '(ERC . "5.5")
:package-version '(ERC . "5.6") ; FIXME sync on release
:type '(repeat
(list :tag "Button"
(choice :tag "Matches"
@ -233,6 +239,8 @@ constituents.")
"Internal variable used to keep track of whether we've added the
global-level ERC button keys yet.")
;; Maybe deprecate this function and `erc-button-keys-added' if they
;; continue to go unused for a another version (currently 5.6).
(defun erc-button-setup ()
"Add ERC mode-level button movement keys. This is only done once."
;; Add keys.
@ -275,35 +283,186 @@ specified by `erc-button-alist'."
(concat "\\<" (regexp-quote (car elem)) "\\>")
entry)))))))))))
(defun erc-button--maybe-warn-arbitrary-sexp (form)
(cl-assert (not (booleanp form))) ; covered by caller
;; If a special-variable is also a function, favor the function.
(cond ((functionp form) form)
((and (symbolp form) (special-variable-p form)) (symbol-value form))
(t (unless (get 'erc-button--maybe-warn-arbitrary-sexp
'warned-arbitrary-sexp)
(put 'erc-button--maybe-warn-arbitrary-sexp
'warned-arbitrary-sexp t)
(lwarn 'erc :warning (concat "Arbitrary sexps for the third FORM"
" slot of `erc-button-alist' entries"
" have been deprecated.")))
(eval form t))))
(defun erc-button--check-nicknames-entry ()
;; This helper exists because the module is defined after its options.
(when (eq major-mode 'erc-mode)
(unless (eq (nth 1 (alist-get 'nicknames erc-button-alist))
'erc-button-buttonize-nicks)
(erc-button--display-error-notice-with-keys-and-warn
"Values other than `erc-button-buttonize-nicks' in the third slot of "
"the `nicknames' entry of `erc-button-alist' are deprecated."))))
(cl-defstruct erc-button--nick
( bounds nil :type cons
;; Indicates the nick's position in the current message. BEG is
;; normally also point.
:documentation "A cons of (BEG . END).")
( data nil :type (or null cons)
;; When non-nil, the CAR must be a non-casemapped nickname. For
;; compatibility, the CDR should probably be nil, but this may
;; have to change eventually. If non-nil, the entire cons should
;; be mutated rather than replaced because it's used as a key in
;; hash tables and text-property searches.
:documentation "A unique cons whose car is a nickname.")
( downcased nil :type (or null string)
:documentation "The case-mapped nickname sans text properties.")
( user nil :type (or null erc-server-user)
;; Not necessarily present in `erc-server-users'.
:documentation "A possibly nil or spoofed `erc-server-user'.")
( cuser nil :type (or null erc-channel-user)
;; The CDR of a value from an `erc-channel-users' table.
:documentation "A possibly nil `erc-channel-user'.")
( erc-button-face erc-button-face :type symbol
:documentation "Temp `erc-button-face' while buttonizing.")
( erc-button-nickname-face erc-button-nickname-face :type symbol
:documentation "Temp `erc-button-nickname-face' while buttonizing.")
( erc-button-mouse-face erc-button-mouse-face :type symbol
:documentation "Temp `erc-button-mouse-face' while buttonizing."))
;; This variable is intended to serve as a "core" to be wrapped by
;; (built-in) modules during setup. It's unclear whether
;; `add-function's practice of removing existing advice before
;; re-adding it is desirable when integrating modules since we're
;; mostly concerned with ensuring one "piece" precedes or follows
;; another (specific piece), which may not yet (or ever) be present.
(defvar erc-button--modify-nick-function #'identity
"Function to possibly modify aspects of nick being buttonized.
Called with one argument, an `erc-button--nick' object, or nil.
The function should return the same (or similar) object when
buttonizing ought to proceed and nil otherwise. While running,
all faces defined in `erc-button' are bound temporarily and can
be updated at will.")
(defvar-local erc-button--phantom-users nil)
(defvar erc-button--fallback-user-function #'ignore
"Function to determine `erc-server-user' if not found in the usual places.
Called with DOWNCASED-NICK, NICK, and NICK-BOUNDS when
`erc-button-add-nickname-buttons' cannot find a user object for
DOWNCASED-NICK in `erc-channel-users' or `erc-server-users'.")
(defun erc-button--add-phantom-speaker (downcased nuh _parsed)
"Stash fictitious `erc-server-user' while processing \"PRIVMSG\".
Expect DOWNCASED to be the downcased nickname, NUH to be a triple
of (NICK LOGIN HOST), and parsed to be an `erc-response' object."
(pcase-let* ((`(,nick ,login ,host) nuh)
(user (or (gethash downcased erc-button--phantom-users)
(make-erc-server-user
:nickname nick
:host (and (not (string-empty-p host)) host)
:login (and (not (string-empty-p login)) login)))))
(list (puthash downcased user erc-button--phantom-users))))
(defun erc-button--get-phantom-user (down _word _bounds)
(gethash down erc-button--phantom-users))
;; In the future, we'll most likely create temporary
;; `erc-channel-users' tables during BATCH chathistory playback, thus
;; obviating the need for this mode entirely.
(define-minor-mode erc-button--phantom-users-mode
"Minor mode to recognize unknown speakers.
Expect to be used by module setup code for creating placeholder
users on the fly during history playback. Treat an unknown
\"PRIVMSG\" speaker, like \"<bob>\", as if they previously
appeared in a prior \"353\" message and are thus a known member
of the channel. However, don't bother creating an actual
`erc-channel-user' object because their status prefix is unknown.
Instead, just spoof an `erc-server-user' and stash it during
\"PRIVMSG\" handling via `erc--user-from-nick-function' and
retrieve it during buttonizing via
`erc-button--fallback-user-function'."
:interactive nil
(if erc-button--phantom-users-mode
(progn
(add-function :after-until (local 'erc--user-from-nick-function)
#'erc-button--add-phantom-speaker '((depth . -50)))
(add-function :after-until (local 'erc-button--fallback-user-function)
#'erc-button--get-phantom-user '((depth . 50)))
(setq erc-button--phantom-users (make-hash-table :test #'equal)))
(remove-function (local 'erc--user-from-nick-function)
#'erc-button--add-phantom-speaker)
(remove-function (local 'erc-button--fallback-user-function)
#'erc-button--get-phantom-user)
(kill-local-variable 'erc-nicks--phantom-users)))
(defun erc-button-add-nickname-buttons (entry)
"Search through the buffer for nicknames, and add buttons."
(let ((form (nth 2 entry))
(fun (nth 3 entry))
bounds word)
(when (or (eq t form)
(eval form t))
(when (eq form 'erc-button-buttonize-nicks)
(setq form (and (symbol-value form) erc-button--modify-nick-function)))
(when (or (functionp form)
(eq t form)
(and form (erc-button--maybe-warn-arbitrary-sexp form)))
(goto-char (point-min))
(while (erc-forward-word)
(when (setq bounds (erc-bounds-of-word-at-point))
(setq word (buffer-substring-no-properties
(car bounds) (cdr bounds)))
(when (or (and (erc-server-buffer-p) (erc-get-server-user word))
(and erc-channel-users (erc-get-channel-user word)))
(erc-button-add-button (car bounds) (cdr bounds)
fun t (list word))))))))
(let* ((erc-button-face erc-button-face)
(erc-button-mouse-face erc-button-mouse-face)
(erc-button-nickname-face erc-button-nickname-face)
(down (erc-downcase word))
(cuser (and erc-channel-users
(gethash down erc-channel-users)))
(user (or (and cuser (car cuser))
(and erc-server-users
(gethash down erc-server-users))
(funcall erc-button--fallback-user-function
down word bounds)))
(data (list word)))
(when (or (not (functionp form))
(and-let* ((user)
(obj (funcall form (make-erc-button--nick
:bounds bounds :data data
:downcased down :user user
:cuser (cdr cuser)))))
(setq bounds (erc-button--nick-bounds obj)
data (erc-button--nick-data obj)
erc-button-mouse-face
(erc-button--nick-erc-button-mouse-face obj)
erc-button-nickname-face
(erc-button--nick-erc-button-nickname-face obj)
erc-button-face
(erc-button--nick-erc-button-face obj))))
(erc-button-add-button (car bounds) (cdr bounds)
fun t data))))))))
(defun erc-button-add-buttons-1 (regexp entry)
"Search through the buffer for matches to ENTRY and add buttons."
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(let ((start (match-beginning (nth 1 entry)))
(end (match-end (nth 1 entry)))
(form (nth 2 entry))
(fun (nth 3 entry))
(data (mapcar #'match-string-no-properties (nthcdr 4 entry))))
(when (or (eq t form)
(eval form t))
(erc-button-add-button start end fun nil data regexp)))))
(let (buttonizer)
(while
(and (re-search-forward regexp nil t)
(or buttonizer
(setq buttonizer
(and-let*
((raw-form (nth 2 entry))
(res (or (eq t raw-form)
(erc-button--maybe-warn-arbitrary-sexp
raw-form))))
(if (functionp res) res #'erc-button-add-button)))))
(let ((start (match-beginning (nth 1 entry)))
(end (match-end (nth 1 entry)))
(fun (nth 3 entry))
(data (mapcar #'match-string-no-properties (nthcdr 4 entry))))
(funcall buttonizer start end fun nil data regexp)))))
(defun erc-button-remove-old-buttons ()
"Remove all existing buttons.
@ -405,6 +564,7 @@ call it with the value of the `erc-data' text property."
(defun erc-button-next-function ()
"Pseudo completion function that actually jumps to the next button.
For use on `completion-at-point-functions'."
(declare (obsolete erc-nickserv-identify "30.1"))
;; FIXME: This is an abuse of completion-at-point-functions.
(when (< (point) (erc-beg-of-input-line))
(let ((start (point)))
@ -422,27 +582,73 @@ For use on `completion-at-point-functions'."
(error "No next button"))
t)))))
(defun erc-button-next ()
"Go to the next button in this buffer."
(interactive)
(let ((f (erc-button-next-function)))
(if f (funcall f))))
(defvar erc-button--prev-next-predicate-functions
'(erc-button--end-of-button-p)
"Abnormal hook whose members can return non-nil to continue searching.
Otherwise, if all members return nil, point will stay at the
current button. Called with a single arg, a buffer position
greater than `point-min' with a text property of `erc-callback'.")
(defun erc-button-previous ()
"Go to the previous button in this buffer."
(interactive)
(let ((here (point)))
(when (< here (erc-beg-of-input-line))
(while (and (get-text-property here 'erc-callback)
(not (= here (point-min))))
(setq here (1- here)))
(while (and (not (get-text-property here 'erc-callback))
(not (= here (point-min))))
(setq here (1- here)))
(if (> here (point-min))
(goto-char here)
(error "No previous button"))
t)))
(defun erc-button--end-of-button-p (point)
(get-text-property (1- point) 'erc-callback))
(defun erc--button-next (arg)
(let* ((nextp (prog1 (>= arg 1) (setq arg (max 1 (abs arg)))))
(search-fn (if nextp
#'next-single-char-property-change
#'previous-single-char-property-change))
(start (point))
(p start))
(while (progn
;; Break out of current search context.
(when-let ((low (max (point-min) (1- (pos-bol))))
(high (min (point-max) (1+ (pos-eol))))
(prop (get-text-property p 'erc-callback))
(q (if nextp
(text-property-not-all p high
'erc-callback prop)
(funcall search-fn p 'erc-callback nil low)))
((< low q high)))
(setq p q))
;; Assume that buttons occur frequently enough that
;; omitting LIMIT is acceptable.
(while
(and (setq p (funcall search-fn p 'erc-callback))
(if nextp (< p erc-insert-marker) (/= p (point-min)))
(run-hook-with-args-until-success
'erc-button--prev-next-predicate-functions p)))
(and arg
(< (point-min) p erc-insert-marker)
(goto-char p)
(not (zerop (cl-decf arg))))))
(when (= (point) start)
(user-error (if nextp "No next button" "No previous button")))
t))
(defun erc-button-next (&optional arg)
"Go to the ARGth next button."
(declare (advertised-calling-convention (arg) "30.1"))
(interactive "p")
(setq arg (pcase arg ((pred listp) (prefix-numeric-value arg)) (_ arg)))
(erc--button-next arg))
(defun erc-button-previous (&optional arg)
"Go to ARGth previous button."
(declare (advertised-calling-convention (arg) "30.1"))
(interactive "p")
(setq arg (pcase arg ((pred listp) (prefix-numeric-value arg)) (_ arg)))
(erc--button-next (- arg)))
(defun erc-button-previous-of-nick (arg)
"Go to ARGth previous button for nick at point."
(interactive "p")
(if-let* ((prop (get-text-property (point) 'erc-data))
(erc-button--prev-next-predicate-functions
(cons (lambda (p)
(not (equal (get-text-property p 'erc-data) prop)))
erc-button--prev-next-predicate-functions)))
(erc--button-next (- arg))
(user-error "No nick at point")))
(defun erc-browse-emacswiki (thing)
"Browse to THING in the emacs-wiki."
@ -511,6 +717,70 @@ and `apropos' for other symbols."
(message "@%s is %d:%02d local time"
beats hours minutes)))
(defun erc-button--display-error-with-buttons
(from to fun nick-p &optional data regexp)
"Replace command in region with keys and return new bounds"
(let* ((o (buffer-substring from to))
(s (substitute-command-keys o))
(erc-button-face (and (equal o s) erc-button-face)))
(delete-region from to)
(insert s)
(erc-button-add-button from (point) fun nick-p data regexp)))
;;;###autoload
(defun erc-button--display-error-notice-with-keys (&optional parsed buffer
&rest strings)
"Add help keys to STRINGS for configuration-related admonishments.
Return inserted result. Expect PARSED to be an `erc-response'
object, a string, or nil. Expect BUFFER to be a buffer, a string,
or nil. As a special case, allow PARSED to be a buffer as long
as BUFFER is a string or nil. If STRINGS contains any trailing
non-strings, concatenate leading string members before applying
`format'. Otherwise, just concatenate everything."
(when (stringp buffer)
(push buffer strings)
(setq buffer nil))
(when (stringp parsed)
(push parsed strings)
(setq parsed nil))
(when (bufferp parsed)
(cl-assert (null buffer))
(setq buffer parsed
parsed nil))
(let* ((op (if (seq-every-p #'stringp (cdr strings))
#'concat
(let ((head (pop strings)))
(while (stringp (car strings))
(setq head (concat head (pop strings))))
(push head strings))
#'format))
(string (apply op strings))
(erc-insert-post-hook
(cons (lambda ()
(setq string (buffer-substring (point-min)
(1- (point-max)))))
erc-insert-post-hook))
(erc-button-alist
`((,(rx "\\[" (group (+ (not "]"))) "]") 0
erc-button--display-error-with-buttons
erc-button-describe-symbol 1)
,@erc-button-alist)))
(erc-display-message parsed '(notice error) (or buffer 'active) string)
string))
;;;###autoload
(defun erc-button--display-error-notice-with-keys-and-warn (&rest args)
"Like `erc-button--display-error-notice-with-keys' but also warn."
(let ((string (apply #'erc-button--display-error-notice-with-keys args)))
(with-temp-buffer
(insert string)
(goto-char (point-min))
(with-syntax-table lisp-mode-syntax-table
(skip-syntax-forward "^-"))
(forward-char)
(display-warning
'erc (buffer-substring-no-properties (point) (point-max))))))
(provide 'erc-button)
;;; erc-button.el ends here

View file

@ -89,6 +89,7 @@ character not found in IRC nicknames to avoid confusion."
;;; Define module:
;;;###autoload(autoload 'erc-capab-identify-mode "erc-capab" nil t)
(put 'capab-identify 'erc-group 'erc-capab)
(define-erc-module capab-identify nil
"Handle dancer-ircd's CAPAB IDENTIFY-MSG and IDENTIFY-CTCP."
;; append so that `erc-server-parameters' is already set by `erc-server-005'

View file

@ -30,19 +30,35 @@
(defvar erc--casemapping-rfc1459-strict)
(defvar erc-channel-users)
(defvar erc-dbuf)
(defvar erc-insert-this)
(defvar erc-log-p)
(defvar erc-modules)
(defvar erc-send-this)
(defvar erc-server-process)
(defvar erc-server-users)
(defvar erc-session-server)
(declare-function erc--get-isupport-entry "erc-backend" (key &optional single))
(declare-function erc-get-buffer "erc" (target &optional proc))
(declare-function erc-server-buffer "erc" nil)
(declare-function widget-apply-action "wid-edit" (widget &optional event))
(declare-function widget-at "wid-edit" (&optional pos))
(declare-function widget-create-child-and-convert "wid-edit"
(parent type &rest args))
(declare-function widget-default-format-handler "wid-edit" (widget escape))
(declare-function widget-get-sibling "wid-edit" (widget))
(declare-function widget-move "wid-edit" (arg &optional suppress-echo))
(declare-function widget-type "wid-edit" (widget))
(cl-defstruct erc-input
string insertp sendp)
string insertp sendp refoldp)
(cl-defstruct (erc--input-split (:include erc-input))
lines cmdp)
(cl-defstruct (erc--input-split (:include erc-input
(string :read-only)
(insertp erc-insert-this)
(sendp erc-send-this)))
(lines nil :type (list-of string))
(cmdp nil :type boolean))
(cl-defstruct (erc-server-user (:type vector) :named)
;; User data
@ -85,45 +101,52 @@
(contents "" :type string)
(tags '() :type list))
;; TODO move goodies modules here after 29 is released.
(defconst erc--features-to-modules
'((erc-pcomplete completion pcomplete)
(erc-capab capab-identify)
(erc-join autojoin)
(erc-page page ctcp-page)
(erc-sound sound ctcp-sound)
(erc-stamp stamp timestamp)
(erc-services services nickserv))
"Migration alist mapping a library feature to module names.
Keys need not be unique: a library may define more than one
module. Sometimes a module's downcased alias will be its
canonical name.")
(defconst erc--modules-to-features
(let (pairs)
(pcase-dolist (`(,feature . ,names) erc--features-to-modules)
(dolist (name names)
(push (cons name feature) pairs)))
(nreverse pairs))
"Migration alist mapping a module's name to its home library feature.")
(defconst erc--module-name-migrations
(let (pairs)
(pcase-dolist (`(,_ ,canonical . ,rest) erc--features-to-modules)
(dolist (obsolete rest)
(push (cons obsolete canonical) pairs)))
pairs)
"Association list of obsolete module names to canonical names.")
;; After dropping 28, we can use prefixed "erc-autoload" cookies.
(defun erc--normalize-module-symbol (symbol)
"Return preferred SYMBOL for `erc-modules'."
(setq symbol (intern (downcase (symbol-name symbol))))
(or (cdr (assq symbol erc--module-name-migrations)) symbol))
"Return preferred SYMBOL for `erc--modules'."
(while-let ((canonical (get symbol 'erc--module))
((not (eq canonical symbol))))
(setq symbol canonical))
symbol)
(defvar erc--inside-mode-toggle-p nil
"Non-nil when a module's mode toggle is updating module membership.
This serves as a flag to inhibit the mutual recursion that would
otherwise occur between an ERC-defined minor-mode function, such
as `erc-services-mode', and the custom-set function for
`erc-modules'. For historical reasons, the latter calls
`erc-update-modules', which, in turn, enables the minor-mode
functions for all member modules. Also non-nil when a mode's
widget runs its set function.")
(defun erc--favor-changed-reverted-modules-state (name op)
"Be more nuanced in displaying Custom state of `erc-modules'.
When `customized-value' differs from `saved-value', allow widget
to behave normally and show \"SET for current session\", as
though `customize-set-variable' or similar had been applied.
However, when `customized-value' and `standard-value' match but
differ from `saved-value', prefer showing \"CHANGED outside
Customize\" to prevent the widget from seeing a `standard'
instead of a `set' state, which precludes any actual saving."
;; Although the button "Apply and save" is fortunately grayed out,
;; `Custom-save' doesn't actually save (users must click the magic
;; state button instead). The default behavior described in the doc
;; string is intentional and was introduced by bug#12864 "Make state
;; button interaction less confusing". However, it is unfriendly to
;; rogue libraries (like ours) that insist on mutating user options
;; as a matter of course.
(custom-load-symbol 'erc-modules)
(funcall (get 'erc-modules 'custom-set) 'erc-modules
(funcall op (erc--normalize-module-symbol name) erc-modules))
(when (equal (pcase (get 'erc-modules 'saved-value)
(`((quote ,saved) saved)))
erc-modules)
(customize-mark-as-set 'erc-modules)))
(defun erc--assemble-toggle (localp name ablsym mode val body)
(let ((arg (make-symbol "arg")))
`(defun ,ablsym ,(if localp `(&optional ,arg) '())
,(concat
,(erc--fill-module-docstring
(if val "Enable" "Disable")
" ERC " (symbol-name name) " mode."
(when localp
@ -137,14 +160,133 @@ canonical name.")
(,ablsym))
(setq ,mode ,val)
,@body)))
`(,(if val
`(cl-pushnew ',(erc--normalize-module-symbol name)
erc-modules)
`(setq erc-modules (delq ',(erc--normalize-module-symbol name)
erc-modules)))
;; No need for `default-value', etc. because a buffer-local
;; `erc-modules' only influences the next session and
;; doesn't survive the major-mode reset that soon follows.
`((unless
(or erc--inside-mode-toggle-p
,@(let ((v `(memq ',(erc--normalize-module-symbol name)
erc-modules)))
`(,(if val v `(not ,v)))))
(let ((erc--inside-mode-toggle-p t))
(erc--favor-changed-reverted-modules-state
',name #',(if val 'cons 'delq))))
(setq ,mode ,val)
,@body)))))
;; This is a migration helper that determines a module's `:group'
;; keyword argument from its name or alias. A (global) module's minor
;; mode variable appears under the group's Custom menu. Like
;; `erc--normalize-module-symbol', it must run when the module's
;; definition (rather than that of `define-erc-module') is expanded.
;; For corner cases in which this fails or the catch-all of `erc' is
;; more inappropriate, (global) modules can declare a top-level
;;
;; (put 'foo 'erc-group 'erc-bar)
;;
;; where `erc-bar' is the group and `foo' is the normalized module.
;; Do this *before* the module's definition. If `define-erc-module'
;; ever accepts arbitrary keywords, passing an explicit `:group' will
;; obviously be preferable.
(defun erc--find-group (&rest symbols)
(catch 'found
(dolist (s symbols)
(let* ((downed (downcase (symbol-name s)))
(known (intern-soft (concat "erc-" downed))))
(when (and known
(or (get known 'group-documentation)
(rassq known custom-current-group-alist)))
(throw 'found known))
(when (setq known (intern-soft (concat "erc-" downed "-mode")))
(when-let ((found (custom-group-of-mode known)))
(throw 'found found))))
(when-let ((found (get (erc--normalize-module-symbol s) 'erc-group)))
(throw 'found found)))
'erc))
;; This exists as a separate, top-level function to prevent the byte
;; compiler from warning about widget-related dependencies not being
;; loaded at runtime.
(defun erc--tick-module-checkbox (name &rest _) ; `name' must be normalized
(customize-variable-other-window 'erc-modules)
;; Move to `erc-modules' section.
(while (not (eq (widget-type (widget-at)) 'checkbox))
(widget-move 1 t))
;; This search for a checkbox can fail when `name' refers to a
;; third-party module that modifies `erc-modules' (improperly) on
;; load.
(let (w)
(while (and (eq (widget-type (widget-at)) 'checkbox)
(not (and (setq w (widget-get-sibling (widget-at)))
(eq (widget-value w) name))))
(setq w nil)
(widget-move 1 t)) ; the `suppress-echo' arg exists in 27.2
(unless w
(error "Failed to find %s in `erc-modules' checklist" name))
(widget-apply-action (widget-at))
(message "Hit %s to apply or %s to apply and save."
(substitute-command-keys "\\[Custom-set]")
(substitute-command-keys "\\[Custom-save]"))))
;; This stands apart to avoid needing forward declarations for
;; `wid-edit' functions in every file requiring `erc-common'.
(defun erc--make-show-me-widget (widget escape &rest plist)
(if (eq escape ?i)
(apply #'widget-create-child-and-convert widget 'push-button plist)
(widget-default-format-handler widget escape)))
(defun erc--prepare-custom-module-type (name)
`(let* ((name (erc--normalize-module-symbol ',name))
(fmtd (format " `%s' " name)))
`(boolean
:format "%{%t%}: %i %[Deprecated Toggle%] %v \n%h\n"
:format-handler
,(lambda (widget escape)
(erc--make-show-me-widget
widget escape
:button-face '(custom-variable-obsolete custom-button)
:tag "Show Me"
:action (apply-partially #'erc--tick-module-checkbox name)
:help-echo (lambda (_)
(let ((hasp (memq name erc-modules)))
(concat (if hasp "Remove" "Add") fmtd
(if hasp "from" "to")
" `erc-modules'.")))))
:action widget-toggle-action
:documentation-property
,(lambda (_)
(let ((hasp (memq name erc-modules)))
(concat
"Setting a module's minor-mode variable is "
(propertize "ineffective" 'face 'error)
".\nPlease " (if hasp "remove" "add") fmtd
(if hasp "from" "to") " `erc-modules' directly instead.\n"
"You can do so now by clicking "
(propertize "Show Me" 'face 'custom-variable-obsolete)
" above."))))))
(defun erc--fill-module-docstring (&rest strings)
(with-temp-buffer
(emacs-lisp-mode)
(insert "(defun foo ()\n"
(format "%S" (apply #'concat strings))
"\n(ignore))")
(goto-char (point-min))
(forward-line 2)
(let ((emacs-lisp-docstring-fill-column 65)
(sentence-end-double-space t))
(fill-paragraph))
(goto-char (point-min))
(nth 3 (read (current-buffer)))))
(defmacro erc--find-feature (name alias)
`(pcase (erc--find-group ',name ,(and alias (list 'quote alias)))
('erc (and-let* ((file (or (macroexp-file-name) buffer-file-name)))
(intern (file-name-base file))))
(v v)))
(defmacro define-erc-module (name alias doc enable-body disable-body
&optional local-p)
"Define a new minor mode using ERC conventions.
@ -179,21 +321,20 @@ Example:
(declare (doc-string 3) (indent defun))
(let* ((sn (symbol-name name))
(mode (intern (format "erc-%s-mode" (downcase sn))))
(group (intern (format "erc-%s" (downcase sn))))
(enable (intern (format "erc-%s-enable" (downcase sn))))
(disable (intern (format "erc-%s-disable" (downcase sn)))))
`(progn
(define-minor-mode
,mode
,(format "Toggle ERC %S mode.
,(erc--fill-module-docstring (format "Toggle ERC %s mode.
With a prefix argument ARG, enable %s if ARG is positive,
and disable it otherwise. If called from Lisp, enable the mode
if ARG is omitted or nil.
%s" name name doc)
;; FIXME: We don't know if this group exists, so this `:group' may
;; actually just silence a valid warning about the fact that the var
;; is not associated with any group.
:global ,(not local-p) :group (quote ,group)
\n%s" name name doc))
:global ,(not local-p)
:group (erc--find-group ',name ,(and alias (list 'quote alias)))
,@(unless local-p `(:require ',(erc--find-feature name alias)))
,@(unless local-p `(:type ,(erc--prepare-custom-module-type name)))
(if ,mode
(,enable)
(,disable)))
@ -249,11 +390,17 @@ See also `with-current-buffer'.
"Execute BODY in the current ERC server buffer.
If no server buffer exists, return nil."
(declare (indent 0) (debug (body)))
(let ((buffer (make-symbol "buffer")))
`(let ((,buffer (erc-server-buffer)))
(when (buffer-live-p ,buffer)
(with-current-buffer ,buffer
,@body)))))
(let ((varp (and (symbolp (car body))
(not (cdr body))
(special-variable-p (car body))))
(buffer (make-symbol "buffer")))
`(when-let* (((processp erc-server-process))
(,buffer (process-buffer erc-server-process))
((buffer-live-p ,buffer)))
,(if varp
`(buffer-local-value ',(car body) ,buffer)
`(with-current-buffer ,buffer
,@body)))))
(defmacro erc-with-all-buffers-of-server (process pred &rest forms)
"Execute FORMS in all buffers which have same process as this server.

View file

@ -32,7 +32,50 @@
;;; Code:
(require 'compat nil 'noerror)
(eval-when-compile (require 'cl-lib) (require 'url-parse))
(eval-when-compile (require 'cl-lib))
;; Except for the "erc-" namespacing, these two definitions should be
;; continuously updated to match the latest upstream ones verbatim.
;; Although they're pretty simple, it's likely not worth checking for
;; and possibly deferring to the non-prefixed versions.
;;
;; BEGIN Compat macros
;;;; Macros for extended compatibility function calls
(defmacro erc-compat-function (fun)
"Return compatibility function symbol for FUN.
If the Emacs version provides a sufficiently recent version of
FUN, the symbol FUN is returned itself. Otherwise the macro
returns the symbol of a compatibility function which supports the
behavior and calling convention of the current stable Emacs
version. For example Compat 29.1 will provide compatibility
functions which implement the behavior and calling convention of
Emacs 29.1.
See also `compat-call' to directly call compatibility functions."
(let ((compat (intern (format "compat--%s" fun))))
`#',(if (fboundp compat) compat fun)))
(defmacro erc-compat-call (fun &rest args)
"Call compatibility function or macro FUN with ARGS.
A good example function is `plist-get' which was extended with an
additional predicate argument in Emacs 29.1. The compatibility
function, which supports this additional argument, can be
obtained via (compat-function plist-get) and called
via (compat-call plist-get plist prop predicate). It is not
possible to directly call (plist-get plist prop predicate) on
Emacs older than 29.1, since the original `plist-get' function
does not yet support the predicate argument. Note that the
Compat library never overrides existing functions.
See also `compat-function' to lookup compatibility functions."
(let ((compat (intern (format "compat--%s" fun))))
`(,(if (fboundp compat) compat fun) ,@args)))
;; END Compat macros
;;;###autoload(autoload 'erc-define-minor-mode "erc-compat")
(define-obsolete-function-alias 'erc-define-minor-mode
@ -368,16 +411,8 @@ If START or END is negative, it counts from the end."
;;;; Misc 29.1
(defmacro erc-compat--with-memoization (table &rest forms)
(declare (indent defun))
(cond
((fboundp 'with-memoization)
`(with-memoization ,table ,@forms)) ; 29.1
((fboundp 'cl--generic-with-memoization)
`(cl--generic-with-memoization ,table ,@forms))
(t `(progn ,@forms))))
(defvar url-irc-function)
(declare-function url-type "url-parse" (cl-x))
(defun erc-compat--29-browse-url-irc (string &rest _)
(require 'url-irc)
@ -409,6 +444,28 @@ If START or END is negative, it counts from the end."
(cons '("\\`irc6?s?://" . erc-compat--29-browse-url-irc)
existing))))))
;;;; Misc 28.1
(defvar comint-file-name-quote-list)
(defvar shell-file-name-quote-list)
(declare-function shell--parse-pcomplete-arguments "shell" nil)
(defun erc-compat--28-split-string-shell-command (string)
(require 'comint)
(require 'shell)
(with-temp-buffer
(insert string)
(let ((comint-file-name-quote-list shell-file-name-quote-list))
(car (shell--parse-pcomplete-arguments)))))
(defmacro erc-compat--split-string-shell-command (string)
;; Autoloaded in Emacs 28.
(list (if (fboundp 'split-string-shell-command)
'split-string-shell-command
'erc-compat--28-split-string-shell-command)
string))
(provide 'erc-compat)
;;; erc-compat.el ends here

View file

@ -43,7 +43,7 @@
;; /dcc chat nick - Either accept pending chat offer from nick, or offer
;; DCC chat to nick
;; /dcc close type [nick] - Close DCC connection (SEND/GET/CHAT) with nick
;; /dcc get [-t][-s] nick [file] - Accept DCC offer from nick
;; /dcc get [-t][-s] nick [--] file - Accept DCC offer from nick
;; /dcc list - List all DCC offers/connections
;; /dcc send nick file - Offer DCC SEND to nick
@ -389,12 +389,18 @@ If this is nil, then the current value of `default-directory' is used."
:type '(choice (const :value nil :tag "Default directory") directory))
;;;###autoload
(defun erc-cmd-DCC (cmd &rest args)
(defun erc-cmd-DCC (line &rest compat-args)
"Parser for /dcc command.
This figures out the dcc subcommand and calls the appropriate routine to
handle it. The function dispatched should be named \"erc-dcc-do-FOO-command\",
where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
(when cmd
(let (cmd args)
;; Called as library function (i.e., not directly as /dcc)
(if compat-args
(setq cmd line
args compat-args)
(setq args (delete "" (erc-compat--split-string-shell-command line))
cmd (pop args)))
(let ((fn (intern-soft (concat "erc-dcc-do-" (upcase cmd) "-command"))))
(if fn
(apply fn erc-server-process args)
@ -404,8 +410,16 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
(apropos "erc-dcc-do-.*-command")
t))))
(put 'erc-cmd-DCC 'do-not-parse-args t)
(autoload 'pcomplete-erc-all-nicks "erc-pcomplete")
;;;###autoload(put 'erc-cmd-DCC 'erc--cmd-help 'erc-dcc--cmd-help)
(defun erc-dcc--cmd-help (&rest args)
(describe-function
(or (and args (intern-soft (concat "erc-dcc-do-"
(upcase (car args)) "-command")))
'erc-cmd-DCC)))
;;;###autoload
(defun pcomplete/erc-mode/DCC ()
"Provide completion for the /DCC command."
@ -430,15 +444,20 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
(eq (plist-get elt :type) 'GET))
erc-dcc-list)))
('send (pcomplete-erc-all-nicks))))
(when (equal "get" (downcase (pcomplete-arg 'first 1)))
(pcomplete-opt "-"))
(pcomplete-here
(pcase (intern (downcase (pcomplete-arg 'first 1)))
('get (mapcar (lambda (elt) (plist-get elt :file))
('get (mapcar (lambda (elt)
(combine-and-quote-strings (list (plist-get elt :file))))
(cl-remove-if-not
(lambda (elt)
(and (eq (plist-get elt :type) 'GET)
(erc-nick-equal-p (erc-extract-nick
(plist-get elt :nick))
(pcomplete-arg 1))))
(pcase (pcomplete-arg 1)
("--" (pcomplete-arg 2))
(v v)))))
erc-dcc-list)))
('close (mapcar #'erc-dcc-nick
(cl-remove-if-not
@ -504,16 +523,33 @@ At least one of TYPE and NICK must be provided."
?n (erc-extract-nick (plist-get ret :nick))))))
t))
(defun erc-dcc-do-GET-command (proc nick &rest file)
"Do a DCC GET command. NICK is the person who is sending the file.
FILE is the filename. If FILE is split into multiple arguments,
re-join the arguments, separated by a space.
PROC is the server process."
(let* ((args (seq-group-by (lambda (s) (eq ?- (aref s 0))) (cons nick file)))
(defun erc-dcc-do-GET-command (proc &rest args)
"Perform a DCC GET command.
Recognize input conforming to the following usage syntax:
/DCC GET [-t|-s] nick [--] filename
nick The person who is sending the file.
filename The filename to be downloaded. Can be split into multiple
arguments that are then joined by a space.
flags \"-t\" sets `:turbo' in `erc-dcc-list'
\"-s\" sets `:secure' in `erc-dcc-list'
\"--\" indicates end of options
All of which are optional.
Expect PROC to be the server process and ARGS to contain
everything after the subcommand \"GET\" in the usage description
above."
;; Despite the advertised syntax above, we currently respect flags
;; in these positions: [flag] nick [flag] filename [flag]
(let* ((trailing (and-let* ((trailing (member "--" args)))
(setq args (butlast args (length trailing)))
(cdr trailing)))
(args (seq-group-by (lambda (s) (eq ?- (aref s 0))) args))
(flags (prog1 (cdr (assq t args))
(setq args (cdr (assq nil args))
nick (pop args)
file (and args (mapconcat #'identity args " ")))))
(setq args (nconc (cdr (assq nil args)) trailing))))
(nick (pop args))
(file (and args (mapconcat #'identity args " ")))
(elt (erc-dcc-member :nick nick :type 'GET :file file))
(filename (or file (plist-get elt :file) "unknown")))
(if elt

View file

@ -28,6 +28,9 @@
;; `erc-fill-mode' to switch it on. Customize `erc-fill-function' to
;; change the style.
;; TODO: redo `erc-fill-wrap-nudge' using transient after ERC drops
;; support for Emacs 27.
;;; Code:
(require 'erc)
@ -38,30 +41,18 @@
:group 'erc)
;;;###autoload(autoload 'erc-fill-mode "erc-fill" nil t)
(define-minor-mode erc-fill-mode
"Toggle ERC fill mode.
With a prefix argument ARG, enable ERC fill mode if ARG is
positive, and disable it otherwise. If called from Lisp, enable
the mode if ARG is omitted or nil.
(define-erc-module fill nil
"Manage filling in ERC buffers.
ERC fill mode is a global minor mode. When enabled, messages in
the channel buffers are filled."
:global t
(if erc-fill-mode
(erc-fill-enable)
(erc-fill-disable)))
(defun erc-fill-enable ()
"Setup hooks for `erc-fill-mode'."
(interactive)
(add-hook 'erc-insert-modify-hook #'erc-fill)
(add-hook 'erc-send-modify-hook #'erc-fill))
(defun erc-fill-disable ()
"Cleanup hooks, disable `erc-fill-mode'."
(interactive)
(remove-hook 'erc-insert-modify-hook #'erc-fill)
(remove-hook 'erc-send-modify-hook #'erc-fill))
;; FIXME ensure a consistent ordering relative to hook members from
;; other modules. Ideally, this module's processing should happen
;; after "morphological" modifications to a message's text but
;; before superficial decorations.
((add-hook 'erc-insert-modify-hook #'erc-fill)
(add-hook 'erc-send-modify-hook #'erc-fill))
((remove-hook 'erc-insert-modify-hook #'erc-fill)
(remove-hook 'erc-send-modify-hook #'erc-fill)))
(defcustom erc-fill-prefix nil
"Values used as `fill-prefix' for `erc-fill-variable'.
@ -91,16 +82,29 @@ Static Filling with `erc-fill-static-center' of 27:
These two styles are implemented using `erc-fill-variable' and
`erc-fill-static'. You can, of course, define your own filling
function. Narrowing to the region in question is in effect while your
function is called."
function is called.
A third style resembles static filling but \"wraps\" instead of
fills, thanks to `visual-line-mode' mode, which ERC automatically
enables when this option is `erc-fill-wrap' or when
`erc-fill-wrap-mode' is active. Set `erc-fill-static-center' to
your preferred initial \"prefix\" width. For adjusting the width
during a session, see the command `erc-fill-wrap-nudge'."
:type '(choice (const :tag "Variable Filling" erc-fill-variable)
(const :tag "Static Filling" erc-fill-static)
(const :tag "Dynamic word-wrap" erc-fill-wrap)
function))
(defcustom erc-fill-static-center 27
"Column around which all statically filled messages will be centered.
This column denotes the point where the ` ' character between
<nickname> and the entered text will be put, thus aligning nick
names right and text left."
"Number of columns to \"outdent\" the first line of a message.
During early message handing, ERC prepends a span of
non-whitespace characters to every message, such as a bracketed
\"<nickname>\" or an `erc-notice-prefix'. The
`erc-fill-function' variants `erc-fill-static' and
`erc-fill-wrap' look to this option to determine the amount of
padding to apply to that portion until the filled (or wrapped)
message content aligns with the indicated column. See also
https://en.wikipedia.org/wiki/Hanging_indent."
:type 'integer)
(defcustom erc-fill-variable-maximum-indentation 17
@ -130,7 +134,7 @@ You can put this on `erc-insert-modify-hook' and/or `erc-send-modify-hook'."
(defun erc-fill-static ()
"Fills a text such that messages start at column `erc-fill-static-center'."
(save-match-data
(save-restriction
(goto-char (point-min))
(looking-at "^\\(\\S-+\\)")
(let ((nick (match-string 1)))
@ -167,6 +171,343 @@ You can put this on `erc-insert-modify-hook' and/or `erc-send-modify-hook'."
(erc-fill-regarding-timestamp))))
(erc-restore-text-properties)))
(defvar-local erc-fill--wrap-value nil)
(defvar-local erc-fill--wrap-visual-keys nil)
(defcustom erc-fill-wrap-use-pixels t
"Whether to calculate padding in pixels when possible.
A value of nil means ERC should use columns, which may happen
regardless, depending on the Emacs version. This option only
matters when `erc-fill-wrap-mode' is enabled."
:package-version '(ERC . "5.6") ; FIXME sync on release
:type 'boolean)
(defcustom erc-fill-wrap-visual-keys 'non-input
"Whether to retain keys defined by `visual-line-mode'.
A value of t tells ERC to use movement commands defined by
`visual-line-mode' everywhere in an ERC buffer along with visual
editing commands in the input area. A value of nil means to
never do so. A value of `non-input' tells ERC to act like the
value is nil in the input area and t elsewhere. This option only
plays a role when `erc-fill-wrap-mode' is enabled."
:package-version '(ERC . "5.6") ; FIXME sync on release
:type '(choice (const nil) (const t) (const non-input)))
(defcustom erc-fill-wrap-merge t
"Whether to consolidate messages from the same speaker.
This tells ERC to omit redundant speaker labels for subsequent
messages less than a day apart."
:package-version '(ERC . "5.6") ; FIXME sync on release
:type 'boolean)
(defun erc-fill--wrap-move (normal-cmd visual-cmd arg)
(funcall (pcase erc-fill--wrap-visual-keys
('non-input
(if (>= (point) erc-input-marker) normal-cmd visual-cmd))
('t visual-cmd)
(_ normal-cmd))
arg))
(defun erc-fill--wrap-kill-line (arg)
"Defer to `kill-line' or `kill-visual-line'."
(interactive "P")
;; ERC buffers are read-only outside of the input area, but we run
;; `kill-line' anyway so that users can see the error.
(erc-fill--wrap-move #'kill-line #'kill-visual-line arg))
(defun erc-fill--wrap-beginning-of-line (arg)
"Defer to `move-beginning-of-line' or `beginning-of-visual-line'."
(interactive "^p")
(let ((inhibit-field-text-motion t))
(erc-fill--wrap-move #'move-beginning-of-line
#'beginning-of-visual-line arg))
(if (get-text-property (point) 'erc-prompt)
(goto-char erc-input-marker)
;; Mimic what `move-beginning-of-line' does with invisible text.
(when-let ((erc-fill-wrap-merge)
(empty (get-text-property (point) 'display))
((string-empty-p empty)))
(goto-char (text-property-not-all (point) (pos-eol) 'display empty)))))
(defun erc-fill--wrap-end-of-line (arg)
"Defer to `move-end-of-line' or `end-of-visual-line'."
(interactive "^p")
(erc-fill--wrap-move #'move-end-of-line #'end-of-visual-line arg))
(defun erc-fill-wrap-cycle-visual-movement (arg)
"Cycle through `erc-fill-wrap-visual-keys' styles ARG times.
Go from nil to t to `non-input' and back around, but set internal
state instead of mutating `erc-fill-wrap-visual-keys'. When ARG
is 0, reset to value of `erc-fill-wrap-visual-keys'."
(interactive "^p")
(when (zerop arg)
(setq erc-fill--wrap-visual-keys erc-fill-wrap-visual-keys))
(while (not (zerop arg))
(cl-incf arg (- (abs arg)))
(setq erc-fill--wrap-visual-keys (pcase erc-fill--wrap-visual-keys
('nil t)
('t 'non-input)
('non-input nil))))
(message "erc-fill-wrap movement: %S" erc-fill--wrap-visual-keys))
(defvar-keymap erc-fill-wrap-mode-map ; Compat 29
:doc "Keymap for ERC's `fill-wrap' module."
:parent visual-line-mode-map
"<remap> <kill-line>" #'erc-fill--wrap-kill-line
"<remap> <move-end-of-line>" #'erc-fill--wrap-end-of-line
"<remap> <move-beginning-of-line>" #'erc-fill--wrap-beginning-of-line
"C-c a" #'erc-fill-wrap-cycle-visual-movement
;; Not sure if this is problematic because `erc-bol' takes no args.
"<remap> <erc-bol>" #'erc-fill--wrap-beginning-of-line)
(defvar erc-match-mode)
(defvar erc-button-mode)
(defvar erc-match--hide-fools-offset-bounds)
(defun erc-fill--make-module-dependency-msg (module)
(concat "Enabling default global module `" module "' needed by local"
" module `fill-wrap'. This will impact \C-]all\C-] ERC"
" sessions. Add `" module "' to `erc-modules' to avoid this"
" warning. See Info:\"(erc) Modules\" for more."))
;;;###autoload(put 'fill-wrap 'erc--feature 'erc-fill)
(define-erc-module fill-wrap nil
"Fill style leveraging `visual-line-mode'.
This module displays nickname labels for speakers as overhanging
leftward (and thus right-aligned) to a common offset, as
determined by the option `erc-fill-static-center'. It depends on
the `fill' and `button' modules and assumes the option
`erc-insert-timestamp-function' is `erc-insert-timestamp-right'
or `erc-insert-timestamp-left-and-right' (recommended) so that it
can display right-hand stamps in the right margin. A value of
`erc-insert-timestamp-left' is unsupported. This local module
depends on the global `fill' module. To use it, either include
`fill-wrap' in `erc-modules' or set `erc-fill-function' to
`erc-fill-wrap' (recommended). You can also manually invoke one
of the minor-mode toggles as usual."
((let (msg)
(unless erc-fill-mode
(unless (memq 'fill erc-modules)
(setq msg
;; FIXME use `erc-button--display-error-notice-with-keys'
;; when bug#60933 is ready.
(erc-fill--make-module-dependency-msg "fill")))
(erc-fill-mode +1))
(when erc-fill-wrap-merge
(require 'erc-button)
(unless erc-button-mode
(unless (memq 'button erc-modules)
(setq msg (concat msg (and msg " ")
(erc-fill--make-module-dependency-msg "button"))))
(erc-with-server-buffer
(erc-button-mode +1)))
(add-hook 'erc-button--prev-next-predicate-functions
#'erc-fill--wrap-merged-button-p nil t))
;; Set local value of user option (can we avoid this somehow?)
(unless (eq erc-fill-function #'erc-fill-wrap)
(setq-local erc-fill-function #'erc-fill-wrap))
(when-let* ((vars (or erc--server-reconnecting erc--target-priors))
((alist-get 'erc-fill-wrap-mode vars)))
(setq erc-fill--wrap-visual-keys (alist-get 'erc-fill--wrap-visual-keys
vars)
erc-fill--wrap-value (alist-get 'erc-fill--wrap-value vars)))
(add-function :filter-args (local 'erc-stamp--insert-date-function)
#'erc-fill--wrap-stamp-insert-prefixed-date)
(when (or erc-stamp-mode (memq 'stamp erc-modules))
(erc-stamp--display-margin-mode +1))
(when (or (bound-and-true-p erc-match-mode) (memq 'match erc-modules))
(require 'erc-match)
(setq erc-match--hide-fools-offset-bounds t))
(setq erc-fill--wrap-value
(or erc-fill--wrap-value erc-fill-static-center))
(visual-line-mode +1)
(unless (local-variable-p 'erc-fill--wrap-visual-keys)
(setq erc-fill--wrap-visual-keys erc-fill-wrap-visual-keys))
(when msg
(erc-display-error-notice nil msg))))
((when erc-stamp--display-margin-mode
(erc-stamp--display-margin-mode -1))
(kill-local-variable 'erc-fill--wrap-value)
(kill-local-variable 'erc-fill-function)
(kill-local-variable 'erc-fill--wrap-visual-keys)
(remove-hook 'erc-button--prev-next-predicate-functions
#'erc-fill--wrap-merged-button-p t)
(remove-function (local 'erc-stamp--insert-date-function)
#'erc-fill--wrap-stamp-insert-prefixed-date)
(visual-line-mode -1))
'local)
(defvar-local erc-fill--wrap-length-function nil
"Function to determine length of overhanging characters.
It should return an EXPR as defined by the Info node `(elisp)
Pixel Specification'. This value should represent the width of
the overhang with all faces applied, including any enclosing
brackets (which are not normally fontified) and a trailing space.
It can also return nil to tell ERC to fall back to the default
behavior of taking the length from the first \"word\". This
variable can be converted to a public one if needed by third
parties.")
(defvar-local erc-fill--wrap-last-msg nil)
(defvar-local erc-fill--wrap-max-lull (* 24 60 60))
(defun erc-fill--wrap-continued-message-p ()
(prog1 (and-let*
((m (or erc-fill--wrap-last-msg
(setq erc-fill--wrap-last-msg (point-min-marker))
nil))
((< (1+ (point-min)) (- (point) 2)))
(props (save-restriction
(widen)
(when (eq 'erc-timestamp (field-at-pos m))
(set-marker m (field-end m)))
(and (eq 'PRIVMSG (get-text-property m 'erc-command))
(not (eq (get-text-property m 'font-lock-face)
'erc-action-face))
(cons (get-text-property m 'erc-timestamp)
(get-text-property (1+ m) 'erc-data)))))
(ts (pop props))
((not (time-less-p (erc-stamp--current-time) ts)))
((time-less-p (time-subtract (erc-stamp--current-time) ts)
erc-fill--wrap-max-lull))
(nick (buffer-substring-no-properties
(1+ (point-min)) (- (point) 2)))
(props)
((erc-nick-equal-p (car props) nick))))
(set-marker erc-fill--wrap-last-msg (point-min))))
(defun erc-fill--wrap-stamp-insert-prefixed-date (args)
"Apply `line-prefix' property to args."
(let* ((ts-left (car args)))
(put-text-property 0 (length ts-left) 'line-prefix
`(space :width
(- erc-fill--wrap-value
,(length (string-trim-left ts-left))))
ts-left))
args)
(defun erc-fill-wrap ()
"Use text props to mimic the effect of `erc-fill-static'.
See `erc-fill-wrap-mode' for details."
(unless erc-fill-wrap-mode
(erc-fill-wrap-mode +1))
(save-excursion
(goto-char (point-min))
(let ((len (or (and erc-fill--wrap-length-function
(funcall erc-fill--wrap-length-function))
(progn
(skip-syntax-forward "^-")
(forward-char)
;; Using the `invisible' property might make more
;; sense, but that would require coordination
;; with other modules, like `erc-match'.
(cond ((and erc-fill-wrap-merge
(erc-fill--wrap-continued-message-p))
(put-text-property (point-min) (point)
'display "")
0)
((and erc-fill-wrap-use-pixels
(fboundp 'buffer-text-pixel-size))
(save-restriction
(narrow-to-region (point-min) (point))
(list (car (buffer-text-pixel-size)))))
(t (- (point) (point-min))))))))
;; Leaving out the final newline doesn't seem to affect anything.
(erc-put-text-properties (point-min) (point-max)
'(line-prefix wrap-prefix) nil
`((space :width (- erc-fill--wrap-value ,len))
(space :width erc-fill--wrap-value))))))
;; FIXME use own text property to avoid false positives.
(defun erc-fill--wrap-merged-button-p (point)
(equal "" (get-text-property point 'display)))
;; This is an experimental helper for third-party modules. You could,
;; for example, use this to automatically resize the prefix to a
;; fraction of the window's width on some event change. Another use
;; case would be to fix lines affected by toggling a display-oriented
;; mode, like `display-line-numbers-mode'.
(defun erc-fill--wrap-fix (&optional value)
"Re-wrap from `point-min' to `point-max'.
That is, recalculate the width of all accessible lines and reset
local prefix VALUE when non-nil."
(save-excursion
(when value
(setq erc-fill--wrap-value value))
(let ((inhibit-field-text-motion t)
(inhibit-read-only t))
(goto-char (point-min))
(while (and (zerop (forward-line))
(< (point) (min (point-max) erc-insert-marker)))
(save-restriction
(narrow-to-region (line-beginning-position) (line-end-position))
(erc-fill-wrap))))))
(defun erc-fill--wrap-nudge (arg)
(when (zerop arg)
(setq arg (- erc-fill-static-center erc-fill--wrap-value)))
(cl-incf erc-fill--wrap-value arg)
arg)
(defun erc-fill-wrap-nudge (arg)
"Adjust `erc-fill-wrap' by ARG columns.
Offer to repeat command in a manner similar to
`text-scale-adjust'.
\\`=' Increase indentation by one column
\\`-' Decrease indentation by one column
\\`0' Reset indentation to the default
\\`+' Shift right margin rightward (shrink) by one column
\\`_' Shift right margin leftward (grow) by one column
\\`)' Reset the right margin to the default
Note that misalignment may occur when messages contain
decorations applied by third-party modules. See
`erc-fill--wrap-fix' for a temporary workaround."
(interactive "p")
(unless erc-fill--wrap-value
(cl-assert (not erc-fill-wrap-mode))
(user-error "Minor mode `erc-fill-wrap-mode' disabled"))
(unless (get-buffer-window)
(user-error "Command called in an undisplayed buffer"))
(let* ((total (erc-fill--wrap-nudge arg))
(win-ratio (/ (float (- (window-point) (window-start)))
(- (window-end nil t) (window-start)))))
(when (zerop arg)
(setq arg 1))
(erc-compat-call
set-transient-map
(let ((map (make-sparse-keymap)))
(dolist (key '(?= ?- ?0))
(let ((a (pcase key
(?0 0)
(?- (- (abs arg)))
(_ (abs arg)))))
(define-key map (vector (list key))
(lambda ()
(interactive)
(cl-incf total (erc-fill--wrap-nudge a))
(recenter (round (* win-ratio (window-height))))))))
(dolist (key '(?\) ?_ ?+))
(let ((a (pcase key
(?\) 0)
(?_ (- (abs arg)))
(?+ (abs arg)))))
(define-key map (vector (list key))
(lambda ()
(interactive)
(erc-stamp--adjust-right-margin (- a))
(recenter (round (* win-ratio (window-height))))))))
map)
t
(lambda ()
(message "Fill prefix: %d (%+d col%s)"
erc-fill--wrap-value total (if (> (abs total) 1) "s" "")))
"Use %k for further adjustment"
1)
(recenter (round (* win-ratio (window-height))))))
(defun erc-fill-regarding-timestamp ()
"Fills a text such that messages start at column `erc-fill-static-center'."
(fill-region (point-min) (point-max) t t)

View file

@ -29,30 +29,13 @@
;;; Code:
;;; Imenu support
(eval-when-compile (require 'cl-lib))
(require 'erc-common)
(require 'erc)
(defvar erc-controls-highlight-regexp)
(defvar erc-controls-remove-regexp)
(defvar erc-input-marker)
(defvar erc-insert-marker)
(defvar erc-server-process)
(defvar erc-modules)
(defvar erc-log-p)
(declare-function fringe-columns "fringe" (side &optional real))
(declare-function pulse-available-p "pulse" nil)
(declare-function pulse-momentary-highlight-overlay "pulse" (o &optional face))
(declare-function erc-buffer-list "erc" (&optional predicate proc))
(declare-function erc-error "erc" (&rest args))
(declare-function erc-extract-command-from-line "erc" (line))
(declare-function erc-beg-of-input-line "erc" nil)
(defun erc-imenu-setup ()
"Setup Imenu support in an ERC buffer."
(setq-local imenu-create-index-function #'erc-create-imenu-index))
(add-hook 'erc-mode-hook #'erc-imenu-setup)
(autoload 'erc-create-imenu-index "erc-imenu" "Imenu index creation function")
;;; Automatically scroll to bottom
(defcustom erc-input-line-position nil
@ -65,6 +48,7 @@ argument to `recenter'."
:group 'erc-display
:type '(choice integer (const nil)))
;;;###autoload(autoload 'erc-scrolltobottom-mode "erc-goodies" nil t)
(define-erc-module scrolltobottom nil
"This mode causes the prompt to stay at the end of the window."
((add-hook 'erc-mode-hook #'erc-add-scroll-to-bottom)
@ -116,6 +100,7 @@ variable `erc-input-line-position'."
(recenter (or erc-input-line-position -1)))))))
;;; Make read only
;;;###autoload(autoload 'erc-readonly-mode "erc-goodies" nil t)
(define-erc-module readonly nil
"This mode causes all inserted text to be read-only."
((add-hook 'erc-insert-post-hook #'erc-make-read-only)
@ -131,6 +116,7 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'."
(put-text-property (point-min) (point-max) 'rear-nonsticky t))
;;; Move to prompt when typing text
;;;###autoload(autoload 'erc-move-to-prompt-mode "erc-goodies" nil t)
(define-erc-module move-to-prompt nil
"This mode causes the point to be moved to the prompt when typing text."
((add-hook 'erc-mode-hook #'erc-move-to-prompt-setup)
@ -155,11 +141,160 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'."
(add-hook 'pre-command-hook #'erc-move-to-prompt nil t))
;;; Keep place in unvisited channels
;;;###autoload(autoload 'erc-keep-place-mode "erc-goodies" nil t)
(define-erc-module keep-place nil
"Leave point above un-viewed text in other channels."
((add-hook 'erc-insert-pre-hook #'erc-keep-place))
((remove-hook 'erc-insert-pre-hook #'erc-keep-place)))
(defcustom erc-keep-place-indicator-style t
"Flavor of visual indicator applied to kept place.
For use with the `keep-place-indicator' module. A value of `arrow'
displays an arrow in the left fringe or margin. When it's
`face', ERC adds the face `erc-keep-place-indicator-line' to the
appropriate line. A value of t does both."
:group 'erc
:package-version '(ERC . "5.6")
:type '(choice (const t) (const server) (const target)))
(defcustom erc-keep-place-indicator-buffer-type t
"ERC buffer type in which to display `keep-place-indicator'.
A value of t means \"all\" ERC buffers."
:group 'erc
:package-version '(ERC . "5.6")
:type '(choice (const t) (const server) (const target)))
(defcustom erc-keep-place-indicator-follow nil
"Whether to sync visual kept place to window's top when reading.
For use with `erc-keep-place-indicator-mode'."
:group 'erc
:package-version '(ERC . "5.6")
:type 'boolean)
(defface erc-keep-place-indicator-line
'((((class color) (min-colors 88) (background light)
(supports :underline (:style wave)))
(:underline (:color "PaleGreen3" :style wave)))
(((class color) (min-colors 88) (background dark)
(supports :underline (:style wave)))
(:underline (:color "PaleGreen1" :style wave)))
(t :underline t))
"Face for option `erc-keep-place-indicator-style'."
:group 'erc-faces)
(defface erc-keep-place-indicator-arrow
'((((class color) (min-colors 88) (background light))
(:foreground "PaleGreen3"))
(((class color) (min-colors 88) (background dark))
(:foreground "PaleGreen1"))
(t :inherit fringe))
"Face for arrow value of option `erc-keep-place-indicator-style'."
:group 'erc-faces)
(defvar-local erc--keep-place-indicator-overlay nil
"Overlay for `erc-keep-place-indicator-mode'.")
(defun erc--keep-place-indicator-on-window-configuration-change ()
"Maybe sync `erc--keep-place-indicator-overlay'.
Specifically, do so unless switching to or from another window in
the active frame."
(when erc-keep-place-indicator-follow
(unless (or (minibuffer-window-active-p (minibuffer-window))
(eq (window-old-buffer) (current-buffer)))
(when (< (overlay-end erc--keep-place-indicator-overlay)
(window-start)
erc-insert-marker)
(erc-keep-place-move (window-start))))))
(defun erc--keep-place-indicator-setup ()
"Initialize buffer for maintaining `erc--keep-place-indicator-overlay'."
(require 'fringe)
(setq erc--keep-place-indicator-overlay
(if-let* ((vars (or erc--server-reconnecting erc--target-priors))
((alist-get 'erc-keep-place-indicator-mode vars)))
(alist-get 'erc--keep-place-indicator-overlay vars)
(make-overlay 0 0)))
(add-hook 'window-configuration-change-hook
#'erc--keep-place-indicator-on-window-configuration-change nil t)
(when-let* (((memq erc-keep-place-indicator-style '(t arrow)))
(display (if (zerop (fringe-columns 'left))
`((margin left-margin) ,overlay-arrow-string)
'(left-fringe right-triangle
erc-keep-place-indicator-arrow)))
(bef (propertize " " 'display display)))
(overlay-put erc--keep-place-indicator-overlay 'before-string bef))
(when (memq erc-keep-place-indicator-style '(t face))
(overlay-put erc--keep-place-indicator-overlay 'face
'erc-keep-place-indicator-line)))
;;;###autoload(put 'keep-place-indicator 'erc--feature 'erc-goodies)
(define-erc-module keep-place-indicator nil
"`keep-place' with a fringe arrow and/or highlighted face."
((unless erc-keep-place-mode
(unless (memq 'keep-place erc-modules)
;; FIXME use `erc-button--display-error-notice-with-keys'
;; to display this message when bug#60933 is ready.
(erc-display-error-notice
nil (concat
"Local module `keep-place-indicator' needs module `keep-place'."
" Enabling now. This will affect \C-]all\C-] ERC sessions."
" Add `keep-place' to `erc-modules' to silence this message.")))
(erc-keep-place-mode +1))
(if (pcase erc-keep-place-indicator-buffer-type
('target erc--target)
('server (not erc--target))
('t t))
(erc--keep-place-indicator-setup)
(setq erc-keep-place-indicator-mode nil)))
((when erc--keep-place-indicator-overlay
(delete-overlay erc--keep-place-indicator-overlay)
(remove-hook 'window-configuration-change-hook
#'erc--keep-place-indicator-on-window-configuration-change t)
(kill-local-variable 'erc--keep-place-indicator-overlay)))
'local)
(defun erc-keep-place-move (pos)
"Move keep-place indicator to current line or POS.
For use with `keep-place-indicator' module. When called
interactively, interpret POS as an offset. Specifically, when
POS is a raw prefix arg, like (4), move the indicator to the
window's last line. When it's the minus sign, put it on the
window's first line. Interpret an integer as an offset in lines."
(interactive
(progn
(unless erc-keep-place-indicator-mode
(user-error "`erc-keep-place-indicator-mode' not enabled"))
(list (pcase current-prefix-arg
((and (pred integerp) v)
(save-excursion
(let ((inhibit-field-text-motion t))
(forward-line v)
(point))))
(`(,_) (1- (min erc-insert-marker (window-end))))
('- (min (1- erc-insert-marker) (window-start)))))))
(save-excursion
(let ((inhibit-field-text-motion t))
(when pos
(goto-char pos))
(move-overlay erc--keep-place-indicator-overlay
(line-beginning-position)
(line-end-position)))))
(defun erc-keep-place-goto ()
"Jump to keep-place indicator.
For use with `keep-place-indicator' module."
(interactive
(prog1 nil
(unless erc-keep-place-indicator-mode
(user-error "`erc-keep-place-indicator-mode' not enabled"))
(deactivate-mark)
(push-mark)))
(goto-char (overlay-start erc--keep-place-indicator-overlay))
(recenter (truncate (* (window-height) 0.25)) t)
(require 'pulse)
(when (pulse-available-p)
(pulse-momentary-highlight-overlay erc--keep-place-indicator-overlay)))
(defun erc-keep-place (_ignored)
"Move point away from the last line in a non-selected ERC buffer."
(when (and (not (eq (window-buffer (selected-window))
@ -168,6 +303,11 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'."
(deactivate-mark)
(goto-char (erc-beg-of-input-line))
(forward-line -1)
(when erc-keep-place-indicator-mode
(unless (or (minibuffer-window-active-p (selected-window))
(and (frame-visible-p (selected-frame))
(get-buffer-window (current-buffer) (selected-frame))))
(erc-keep-place-move nil)))
;; if `switch-to-buffer-preserve-window-point' is set,
;; we cannot rely on point being saved, and must commit
;; it to window-prev-buffers.
@ -193,12 +333,14 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'."
If a command's function symbol is in this list, the typed command
does not appear in the ERC buffer after the user presses ENTER.")
;;;###autoload(autoload 'erc-noncommands-mode "erc-goodies" nil t)
(define-erc-module noncommands nil
"This mode distinguishes non-commands.
Commands listed in `erc-insert-this' know how to display
themselves."
((add-hook 'erc-pre-send-functions #'erc-send-distinguish-noncommands))
((remove-hook 'erc-pre-send-functions #'erc-send-distinguish-noncommands)))
((add-hook 'erc--input-review-functions #'erc-send-distinguish-noncommands))
((remove-hook 'erc--input-review-functions
#'erc-send-distinguish-noncommands)))
(defun erc-send-distinguish-noncommands (state)
"If STR is an ERC non-command, set `insertp' in STATE to nil."
@ -251,6 +393,12 @@ The value `erc-interpret-controls-p' must also be t for this to work."
"ERC inverse face."
:group 'erc-faces)
(defface erc-spoiler-face
'((((background light)) :foreground "DimGray" :background "DimGray")
(((background dark)) :foreground "LightGray" :background "LightGray"))
"ERC spoiler face."
:group 'erc-faces)
(defface erc-underline-face '((t :underline t))
"ERC underline face."
:group 'erc-faces)
@ -353,19 +501,38 @@ The value `erc-interpret-controls-p' must also be t for this to work."
"ERC face."
:group 'erc-faces)
;; https://lists.gnu.org/archive/html/emacs-erc/2021-07/msg00005.html
(defvar erc--controls-additional-colors
["#470000" "#472100" "#474700" "#324700" "#004700" "#00472c"
"#004747" "#002747" "#000047" "#2e0047" "#470047" "#47002a"
"#740000" "#743a00" "#747400" "#517400" "#007400" "#007449"
"#007474" "#004074" "#000074" "#4b0074" "#740074" "#740045"
"#b50000" "#b56300" "#b5b500" "#7db500" "#00b500" "#00b571"
"#00b5b5" "#0063b5" "#0000b5" "#7500b5" "#b500b5" "#b5006b"
"#ff0000" "#ff8c00" "#ffff00" "#b2ff00" "#00ff00" "#00ffa0"
"#00ffff" "#008cff" "#0000ff" "#a500ff" "#ff00ff" "#ff0098"
"#ff5959" "#ffb459" "#ffff71" "#cfff60" "#6fff6f" "#65ffc9"
"#6dffff" "#59b4ff" "#5959ff" "#c459ff" "#ff66ff" "#ff59bc"
"#ff9c9c" "#ffd39c" "#ffff9c" "#e2ff9c" "#9cff9c" "#9cffdb"
"#9cffff" "#9cd3ff" "#9c9cff" "#dc9cff" "#ff9cff" "#ff94d3"
"#000000" "#131313" "#282828" "#363636" "#4d4d4d" "#656565"
"#818181" "#9f9f9f" "#bcbcbc" "#e2e2e2" "#ffffff"])
(defun erc-get-bg-color-face (n)
"Fetches the right face for background color N (0-15)."
(if (stringp n) (setq n (string-to-number n)))
(if (not (numberp n))
(prog1 'default
(erc-error "erc-get-bg-color-face: n is NaN: %S" n))
(when (> n 16)
(when (> n 99)
(erc-log (format " Wrong color: %s" n))
(setq n (mod n 16)))
(cond
((and (>= n 0) (< n 16))
(intern (concat "bg:erc-color-face" (number-to-string n))))
(t (erc-log (format " Wrong color: %s" n)) 'default))))
((< 15 n 99)
(list :background (aref erc--controls-additional-colors (- n 16))))
(t (erc-log (format " Wrong color: %s" n)) '(default)))))
(defun erc-get-fg-color-face (n)
"Fetches the right face for foreground color N (0-15)."
@ -373,20 +540,44 @@ The value `erc-interpret-controls-p' must also be t for this to work."
(if (not (numberp n))
(prog1 'default
(erc-error "erc-get-fg-color-face: n is NaN: %S" n))
(when (> n 16)
(when (> n 99)
(erc-log (format " Wrong color: %s" n))
(setq n (mod n 16)))
(cond
((and (>= n 0) (< n 16))
(intern (concat "fg:erc-color-face" (number-to-string n))))
(t (erc-log (format " Wrong color: %s" n)) 'default))))
((< 15 n 99)
(list :foreground (aref erc--controls-additional-colors (- n 16))))
(t (erc-log (format " Wrong color: %s" n)) '(default)))))
;;;###autoload(autoload 'erc-irccontrols-mode "erc-goodies" nil t)
(define-erc-module irccontrols nil
"This mode enables the interpretation of IRC control chars."
((add-hook 'erc-insert-modify-hook #'erc-controls-highlight)
(add-hook 'erc-send-modify-hook #'erc-controls-highlight))
(add-hook 'erc-send-modify-hook #'erc-controls-highlight)
(erc--modify-local-map t "C-c C-c" #'erc-toggle-interpret-controls))
((remove-hook 'erc-insert-modify-hook #'erc-controls-highlight)
(remove-hook 'erc-send-modify-hook #'erc-controls-highlight)))
(remove-hook 'erc-send-modify-hook #'erc-controls-highlight)
(erc--modify-local-map nil "C-c C-c" #'erc-toggle-interpret-controls)))
;; These patterns were moved here to circumvent compiler warnings but
;; otherwise translated verbatim from their original string-literal
;; definitions (minus a small bug fix to satisfy newly added tests).
(defvar erc-controls-remove-regexp
(rx (or ?\C-b ?\C-\] ?\C-_ ?\C-v ?\C-g ?\C-o
(: ?\C-c (? (any "0-9")) (? (any "0-9"))
(? (group ?, (any "0-9") (? (any "0-9")))))))
"Regular expression matching control characters to remove.")
;; Before the change to `rx', group 3 used to be a sibling of group 2.
;; This was assumed to be a bug. A few minor simplifications were
;; also performed. If incorrect, please admonish.
(defvar erc-controls-highlight-regexp
(rx (group (or ?\C-b ?\C-\] ?\C-v ?\C-_ ?\C-g ?\C-o
(: ?\C-c (? (group (** 1 2 (any "0-9")))
(? (group ?, (group (** 1 2 (any "0-9")))))))))
(group (* (not (any ?\C-b ?\C-c ?\C-g ?\n ?\C-o ?\C-v ?\C-\] ?\C-_)))))
"Regular expression matching control chars to highlight.")
(defun erc-controls-interpret (str)
"Return a copy of STR after dealing with IRC control characters.
@ -440,6 +631,7 @@ See `erc-interpret-controls-p' and `erc-interpret-mirc-color' for options."
s))
(t s)))))
;;;###autoload
(defun erc-controls-strip (str)
"Return a copy of STR with all IRC control characters removed."
(when str
@ -448,16 +640,6 @@ See `erc-interpret-controls-p' and `erc-interpret-mirc-color' for options."
(setq s (replace-match "" nil nil s)))
s)))
(defvar erc-controls-remove-regexp
"\C-b\\|\C-]\\|\C-_\\|\C-v\\|\C-g\\|\C-o\\|\C-c[0-9]?[0-9]?\\(,[0-9][0-9]?\\)?"
"Regular expression which matches control characters to remove.")
(defvar erc-controls-highlight-regexp
(concat "\\(\C-b\\|\C-]\\|\C-v\\|\C-_\\|\C-g\\|\C-o\\|"
"\C-c\\([0-9][0-9]?\\)?\\(,\\([0-9][0-9]?\\)\\)?\\)"
"\\([^\C-b\C-]\C-v\C-_\C-c\C-g\C-o\n]*\\)")
"Regular expression which matches control chars and the text to highlight.")
(defun erc-controls-highlight ()
"Highlight IRC control chars in the buffer.
This is useful for `erc-insert-modify-hook' and `erc-send-modify-hook'.
@ -514,6 +696,13 @@ Also see `erc-interpret-controls-p' and `erc-interpret-mirc-color'."
"Prepend properties from IRC control characters between FROM and TO.
If optional argument STR is provided, apply to STR, otherwise prepend properties
to a region in the current buffer."
(if (and fg bg (equal fg bg))
(progn
(setq fg 'erc-spoiler-face
bg nil)
(put-text-property from to 'mouse-face 'erc-inverse-face str))
(when fg (setq fg (erc-get-fg-color-face fg)))
(when bg (setq bg (erc-get-bg-color-face bg))))
(font-lock-prepend-text-property
from
to
@ -531,10 +720,10 @@ to a region in the current buffer."
'(erc-underline-face)
nil)
(if fg
(list (erc-get-fg-color-face fg))
(list fg)
nil)
(if bg
(list (erc-get-bg-color-face bg))
(list bg)
nil))
str)
str)
@ -553,6 +742,7 @@ Else interpretation is turned off."
(if erc-interpret-controls-p "ON" "OFF")))
;; Smiley
;;;###autoload(autoload 'erc-smiley-mode "erc-goodies" nil t)
(define-erc-module smiley nil
"This mode translates text-smileys such as :-) into pictures.
This requires the function `smiley-region', which is defined in
@ -569,6 +759,7 @@ This function should be used with `erc-insert-modify-hook'."
(smiley-region (point-min) (point-max))))
;; Unmorse
;;;###autoload(autoload 'erc-unmorse-mode "erc-goodies" nil t)
(define-erc-module unmorse nil
"This mode causes morse code in the current channel to be unmorsed."
((add-hook 'erc-insert-modify-hook #'erc-unmorse))
@ -611,3 +802,7 @@ servers. If called from a program, PROC specifies the server process."
(provide 'erc-goodies)
;;; erc-goodies.el ends here
;; Local Variables:
;; generated-autoload-file: "erc-loaddefs.el"
;; End:

Some files were not shown because too many files have changed in this diff Show more