Po Lu [Wed, 19 Jul 2023 04:46:02 +0000 (12:46 +0800)]
Update Android port
* build-aux/makecounter.sh (curcount): Rename `counter' to
`emacs_shortlisp_counter'.
* doc/emacs/input.texi (Touchscreens): Document
`touch-screen-extend-selection'.
* doc/lispref/commands.texi (Touchscreen Events): Document
`touchscreen-restart-drag'.
* lisp/touch-screen.el (touch-screen-extend-selection): New user
option.
(touch-screen-restart-drag): New function.
(touch-screen-handle-point-update): Handle `restart-drag'
gestures.
(touch-screen-handle-touch): Check if the prerequisites for
extending a previous drag gesture are met, and generate such
events if so.
(touch-screen-translate-touch): Update doc string.
* src/Makefile.in (otherobj): Remove BUILD_COUNTER_OBJ.
($(lispsource)/international/charprop.el):
(%.elc): Don't depend on bootstrap-emacs if cross configuring
for Android.
(libemacs.so): Directly depend on and link with
BUILD_COUNTER_OBJ.
Po Lu [Wed, 19 Jul 2023 01:53:58 +0000 (09:53 +0800)]
Make sure Android builds are redumped upon changes to shortlisp
* build-aux/makecounter.sh: New script.
* src/Makefile.in (abs_top_builddir): New variable.
(BUILD_COUNTER_OBJ): Define to build-counter.o
if compiling for Android.
(build-counter.c): New target. Generate this file using
makecounter.sh upon changes to lisp.mk or shortlisp.
(lisp.mk): Make and load relative to abs_top_builddir.
(emacs$(EXEEXT)): Adjust acordingly.
(mostlyclean): Remove build-counter.c.
Po Lu [Wed, 19 Jul 2023 00:21:43 +0000 (08:21 +0800)]
Improve reliability of minor mode menu dispatch
* lisp/mouse.el (minor-mode-menu-from-indicator): Instead of using the
word at point, search for a matching enabled minor mode from the
beginning of the string object when mode-line-compact is enabled.
Po Lu [Tue, 18 Jul 2023 08:15:05 +0000 (16:15 +0800)]
Fix display of minor mode menus when mode-line-compact is enabled
* lisp/mouse.el (minor-mode-menu-from-indicator): New arg
WINDOW. If INDICATOR is a string object and mode-line-compat is
enabled within WINDOW, use the symbol within the object at its
position instead.
(mouse-minor-mode-menu): Pass posn-object and posn-window to
minor-mode-menu-from-indicator.
Po Lu [Tue, 18 Jul 2023 05:24:36 +0000 (13:24 +0800)]
Update Android port
* lisp/touch-screen.el (touch-screen-hold)
(touch-screen-handle-point-up): Don't select inactive minibuffer
windows.
(touch-screen-handle-point-update): Improve detection of left
and right edges.
Po Lu [Tue, 18 Jul 2023 02:12:40 +0000 (10:12 +0800)]
Update Android port
* doc/lispref/commands.texi (Touchscreen Events): Describe
treatment of canceled touch sequences during touch event
translation.
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Update JNI
prototypes.
* java/org/gnu/emacs/EmacsWindow.java (motionEvent): Set
cancelation flag in events sent where appropriate.
* lisp/touch-screen.el (touch-screen-handle-point-update):
Improve treatment of horizontal scrolling near window edges.
(touch-screen-handle-touch): Don't handle point up if the touch
sequence has been canceled.
* src/android.c (sendTouchDown, sendTouchUp, sendTouchMove): New
argument `flags'.
* src/androidgui.h (enum android_touch_event_flags): New enum.
(struct android_touch_event): New field `flags'.
* src/androidterm.c (handle_one_android_event): Report
cancelation in TOUCHSCREEN_END_EVENTs.
* src/keyboard.c (make_lispy_event): Fix botched merge.
Po Lu [Tue, 18 Jul 2023 01:27:27 +0000 (09:27 +0800)]
Expose the ``cancellation'' of touch events to Lisp
* doc/lispref/commands.texi (Touchscreen Events):
* etc/NEWS: Describe new event parameter `canceled'.
* src/keyboard.c (make_lispy_event) <TOUCHSCREEN_END_EVENT>:
If event->modifiers, set canceled to t.
* src/termhooks.h (enum event_kind): Describe meaning of
modifiers in TOUCHSCREEN_END_EVENTs.
* src/xfns.c (setup_xi_event_mask): Select for
XI_TouchOwnership.
* src/xterm.c (xi_link_touch_point): Round X and Y and clear
ownership.
(xi_unlink_touch_point): Return 1 if the touch point is not
owned by Emacs, 2 otherwise.
(handle_one_xevent): Handle XI_TouchOwnership events and report
ownership correctly.
* src/xterm.h (enum xi_touch_ownership): New enum. Write
commentary on XI touch sequence ownership.
(struct xi_touch_point_t): Use integer X and Y. New field
`ownership'. Adjust for alignment.
Delete vc-deduce-fileset-1, taking advantage of set-buffer
* lisp/vc/vc.el (vc-deduce-fileset): Set buffer to the base
buffer, if any (bug#63949). That's to replace the more complex
previous strategy. vc-deduce-fileset is allowed to change the
current buffer, so why not do it for that case.
(vc-deduce-fileset-1): Delete, moving the meat of the logic back
to vc-deduce-fileset.
Like in `tab-bar-format-align-right', use `add-face-text-property' to
add 'mode-line' face on the `rest-str' string for `string-pixel-width'
to calculate the correct pixel width (bug#62606).
The Emacs regexp engine interprets character ranges from ASCII to raw
bytes, such as [a-\xfe], as not including non-ASCII Unicode at all;
ranges from non-ACII Unicode to raw bytes, such as [ü-\x91], are
ignored entirely.
To make rx produce a translation that works as intended, split ranges
that that go from ordinary characters to raw bytes. Such ranges may
appear from set manipulation and regexp optimisation.
* lisp/emacs-lisp/rx.el (rx--generate-alt): Split intervals that
straddle the char-raw boundary when rendering a string regexp from an
interval set.
* test/lisp/emacs-lisp/rx-tests.el (rx-char-any-raw-byte):
Add test cases.
Po Lu [Mon, 17 Jul 2023 12:42:56 +0000 (20:42 +0800)]
Don't deliver touch or pinch events from master or slave devices
* src/xfns.c (setup_xi_event_mask): Select for gesture events on
only master devices if safe.
* src/xterm.c (handle_one_xevent): Deliver touchscreen events
only from direct slave devices, and gesture events only from
master pointers.
Po Lu [Mon, 17 Jul 2023 06:28:20 +0000 (14:28 +0800)]
Update Android port
* doc/lispref/commands.texi (Touchscreen Events): Document
meaning of `mouse-1-menu-command'.
* lisp/mouse.el (minor-mode-menu-from-indicator): New arg EVENT.
Give it to popup-menu.
(mouse-minor-mode-menu): Use posn specified within EVENT.
* lisp/touch-screen.el (touch-screen-handle-touch): Fix
interactive translation. Treat commands labeled
`mouse-1-menu-command' like ordinary keymaps.
Po Lu [Mon, 17 Jul 2023 05:58:32 +0000 (13:58 +0800)]
Update Android port
* doc/lispref/commands.texi (Touchscreen Events): Document
changes to simple translation.
* lisp/touch-screen.el (touch-screen-handle-point-up): Generate
`down-mouse-1' if the current gesture is `mouse-1-menu'.
(touch-screen-handle-touch): If binding is a keymap, set state
to `mouse-1-menu' and wait for point to be released before
generating down-mouse-1.
Po Lu [Mon, 17 Jul 2023 04:58:29 +0000 (12:58 +0800)]
Improve word selection behavior
* lisp/tab-bar.el (tab-bar-map): Don't bind touch-screen-drag.
* lisp/touch-screen.el (touch-screen-drag): Extend the region
based on the position of the mark, not the position of point
relative to EVENT.
(touch-screen-translate-touch): Don't generate virtual function
keys for non-mouse events.
(function-key-map): Remove redundant definitions.
* src/keyboard.c (read_key_sequence): Don't generate *-bar
prefix keys for mock input (such as input from function key
translation.)
Po Lu [Mon, 17 Jul 2023 01:46:37 +0000 (09:46 +0800)]
Improve touch screen support
* doc/emacs/input.texi (Touchscreens): Document the new feature
for people who have trouble dragging to word boundaries.
* lisp/touch-screen.el (touch-screen-word-select): New
defcustom.
(touch-screen-word-select-bounds)
(touch-screen-word-select-initial-word): New variable
definitions.
(touch-screen-hold): If `touch-screen-word-select', select the
word around EVENT.
(touch-screen-drag): If `touch-screen-word-select', extend the
region to the next word boundary if the character under point
constitutes a word.
(touch-screen-handle-point-update, touch-screen-handle-touch)
(touch-screen-translate-touch): Fix doc strings and fill
comments.
Po Lu [Sun, 16 Jul 2023 07:30:01 +0000 (15:30 +0800)]
Improve touch-screen support
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices): Correctly
capitalize subsection name.
(Touchscreens): Document additional translation.
* doc/lispref/commands.texi (Touchscreen Events): Document that
`touchscreen-end' events now have prefix keys. Also, describe
mouse emulation and `touchscreen-scroll' events.
* doc/lispref/keymaps.texi (Translation Keymaps): Document
`current-key-remap-sequence'.
* lisp/touch-screen.el (touch-screen-translate-prompt): New
function.
(touch-screen-scroll): New command. Bind to
`touchscreen-scroll'.
(touch-screen-handle-point-update, touch-screen-handle-point-up)
(touch-screen-handle-touch): Refactor to actually translate
touch screen event sequences, as opposed to looking up commands
and executing them.
(touch-screen-translate-touch): New function. Bind in
function-key-map to all touch screen events.
(touch-screen-drag-mode-line-1, touch-screen-drag-mode-line)
(touch-screen-tap-header-line): Remove special commands for
dragging the mode line and clicking on the header line.
* lisp/wid-edit.el (widget-button-click): Adjust accordingly.
* src/keyboard.c (access_keymap_keyremap): Bind
`current-key-remap-sequence' to the key sequence being remapped.
(keyremap_step): Give fkey->start and fkey->end to
access_keymap_keyremap.
(head_table): Add imaginary prefix to touchscreen-end events as
well.
(syms_of_keyboard): New variable Vcurrent_key_remap_sequence.
Stefan Monnier [Sat, 15 Jul 2023 15:41:32 +0000 (11:41 -0400)]
sgml-mode.el: Cosmetic fixes
* lisp/textmodes/sgml-mode.el: Prefer #' to quote function names.
(sgml-font-lock-keywords-1, sgml-font-lock-syntactic-face):
Refer to font-lock faces rather than their variables.
(sgml-mode-facemenu-add-face-function): Remove redundant arg to `mapconcat`.
(sgml-electric-tag-pair-before-change-function): Remove left-over
debugging messages (bug#64636).
Eli Zaretskii [Sat, 15 Jul 2023 09:30:14 +0000 (05:30 -0400)]
Merge from origin/emacs-29
7ac947f34c7 ; * src/lisp.h (struct Lisp_Overlay): Update commentary (... 9bc93c7996c Replace duplicate text from epa.texi by a reference 74cc1d27f1f Add basic usage information and fix references f24bdbfaf57 Add concept index, title-case structure titles 0165b50b0ff ; * lisp/emacs-lisp/lisp.el (raise-sexp): Fix typo in doc... 4cf33b6bd02 ; * doc/misc/modus-themes.org: Fix whitespace (bug#64548). 4821da1ad7f Fix show-paren-mode when the parentheses is partially vis... 419b4d44914 ; Improve documentation of with-restriction be34e8294af ; * admin/git-bisect-start: Update failing commits 8e06809fccd Merge branch 'scratch/bug64391' into emacs-29 dbac8076057 * lisp/net/tramp.el (tramp-get-buffer-string): Stabilize. 01fb898420f Simplify after adding internal function to enter a labele... b741dc7fcde Add internal function to enter a labeled restriction
Ignore quit while getting interprogram paste in kill-new
On X, if the current selection owner is not responding to selection
requests, the user may want to take ownership of the selection. The
obvious way to do this is to kill some text (which a user might also
be doing just as part of normal editing at the time the selection
owner becomes nonresponsive). However, if
save-interprogram-paste-before-kill is non-nil, then killing text will
hang until the user quits, and this quit will abort the entire
kill-new, preventing the user from taking ownership of the selection.
Now instead if the user quits while we are attempting to retrieve the
selection from hanging owner, we will proceed to take ownership of the
selection as normal, resolving the problem.
(One example of a selction owner that might not be responding to
selection requests is another instance of Emacs itself; while Emacs is
blocked in call-process or Lisp execution, it currently does not
respond to selection requests.)
* lisp/simple.el (kill-new): Ignore quit while getting interprogram
paste (bug#64423)
* lisp/progmodes/python.el (python--list-imports): Prefer to
use an exit status >1.
(python--list-imports-check-status): New function to check
status of Python script.
(python--do-isort): Fix wrong status check introduced with 6295d7abdd4. (Bug#64406)
* configure.ac (netbsd): Don't set TERMINFO=no unless the termcap
library is either -ltermcap or -lcurses. This prevents aborts
because on recent versions of NetBSD libtermcap is actually a
symlink to libterminfo. (Bug#64577)
Support displaying function name in the header line
In some languages, the function name as displayed in the mode-line by
which-func-mode can be quite long. It's useful to be able to display
it in the header-line instead. Let's support that.
* lisp/progmodes/which-func.el (which-func-display)
(which-func--use-header-line, which-func--use-mode-line):
Add. (Bug#64533)
(which-func-try-to-enable): Support 'which-func--use-header-line'.
(which-func--disable): Add, to support 'which-func--use-header-line'.
(which-func-ff-hook, which-func-update-1): Use 'which-func--disable'.
Łukasz Stelmach [Tue, 13 Jun 2023 11:26:39 +0000 (13:26 +0200)]
Show SHA-256 digest of a public key in 'nsm-format-certificate'
* lisp/net/nsm.el (nsm-format-certificate): Show public key
digest (SHA-256 if available). Displaying the digest enables
users to verify the certificate with other tools like 'gnutls-cli'
which present much more detailed information.
* src/gnutls (emacs_gnutls_certificate_details): Export SHA-256
public key digest if supported by GnuTLS. (Bug#64043)
Po Lu [Sat, 15 Jul 2023 01:53:22 +0000 (09:53 +0800)]
Update Android port
* doc/emacs/android.texi (Android): Add new node to menu.
(Android Environment): Add footnote pointing to new node.
(Android Software): New node.
* doc/emacs/emacs.texi (Top): Add new node to menu.
* java/AndroidManifest.xml.in (manifest): Fix location of
sharedUserId property.
* java/INSTALL: Improve documentation of shared user ID
support.
Po Lu [Fri, 14 Jul 2023 12:30:30 +0000 (20:30 +0800)]
Make --with-shared-user-id work
* configure.ac (ANDROID_SHARED_USER_NAME): New variable.
Substitute it.
* java/AndroidManifest.xml.in: Set `sharedUserLabel' if a shared
user ID is enabled.
* java/res/values/strings.xml (shared_user_name): New string
resource.
This adds a section for documenting all the optional modules.
Do not merge to master. This is a backport of f2981a1681d.
* doc/misc/eshell.texi (Extension modules): Move explanation about
writing modules to...
(Writing a module): ... here.
(Module testing): Remove. Testing an Eshell module doesn't require
any special documentation.
(Key binding, Smart scrolling, Electric forward slash): Move under...
(Optional modules): ... here.
(Directory handling, Terminal emulation): Remove. These modules are
enabled by default, and so are documented above.
(Tramp extensions, Extra built-in commands): New sections.
F. Jason Park [Thu, 13 Jul 2023 06:53:06 +0000 (23:53 -0700)]
Decouple keep-place-indicator from global ERC module
* etc/ERC-NEWS: Let users know that `keep-place-indicator' is a wholly
separate module from `keep-place'.
* lisp/erc/erc-goodies.el (erc-keep-place-indicator-setup): Perform
some housekeeping on `erc-keep-place-mode'.
(erc-keep-place-indicator-mode, erc-keep-place-indicator-enable,
erc-keep-place-indicator-disable): Take precautions to work around the
activation state of global module `keep-place', but no longer depend
on it.
(erc--keep-place-indicator-on-global-module): New function to ensure
`erc-keep-place' runs exactly once on `erc-insert-pre-hook',
regardless of whether module `keep-place' is active.
* test/lisp/erc/erc-goodies-tests.el
(erc-goodies-tests--assert-kp-indicator-on,
erc-goodies-tests--assert-kp-indicator-off,
erc-goodies-tests--kp-indicator-populate,
erc-goodies-tests--keep-place-indicator): New helper functions.
(erc-keep-place-indicator-mode,
erc-keep-place-indicator-mode--no-global): Factor out some common
logic and rename former to latter.
(erc-keep-place-indicator-mode--global): New test. (Bug#59943)
F. Jason Park [Thu, 29 Jun 2023 14:12:46 +0000 (07:12 -0700)]
Improve walkthrough and sample config in ERC manual
* doc/misc/erc.texi: Improve "Sample Session" and "Sample
Configuration" sections. Move introductory paragraph detailing the
history of official GNU IRC channels to the "History" chapter (from
"Sample Sessoin"), and leave a link in its place. Silence strange
warning in "Getting Help and Reporting Bugs" about lack of punctuation
after xref.
F. Jason Park [Thu, 4 May 2023 07:01:11 +0000 (00:01 -0700)]
Add mini modules bufbar and nickbar to ERC
* doc/misc/erc.texi: Add `bufbar' and `nickbar' to known modules.
Also add `keep-place', which was missing, and remove `bbdb', which is
not part of ERC. Add new section "Auxiliary Modules" for listing
experimental modules or those typically managed by some other feature.
* erc/ERC-NEWS: Mention new mini modules for libraries
erc-status-sidebar.el and erc-speedbar.el.
* lisp/erc/erc.el (erc-modules): Add `bufbar' and `nickbar' to
selection of offered modules.
* test/lisp/erc/erc-tests.el (erc-tests--modules): Add `bufbar' and
`nickbar'. (Bug#63595)
F. Jason Park [Thu, 4 May 2023 07:01:11 +0000 (00:01 -0700)]
Add erc-status-sidebar integration to erc-speedbar
* lisp/erc/erc-speedbar.el: Require `erc-button' atop file and don't
bother loading `dframe', which `speedbar' handles for us.
(erc-speedbar): Explain that `nickbar' is the module for this group
and library for the benefit of those who run M-x customize-group.
(erc-speedbar-nicknames-window-width): New option.
(erc-speedbar-hide-mode-topic): New option determining whether to hide
the mode and topic.
(erc-speedbar-my-nick-face): New option for determining face to use
when displaying user's current nick.
(erc-speedbar-browser): Call `erc-install-speedbar-variables'
explicitly and remove top-level `with-eval-after-load'.
(erc-speedbar-insert-target): Add parenthesized channel count after
channel name in server and channel views.
(erc-speedbar-expand-channel): Hide mode and topic depending on option
`erc-speedbar-hide-mode-topic' and pass buffer to
`erc-speedbar-insert-user'.
(erc-speedbar--nick-face-function): New internal function-valued
variable.
(erc-speedbar--highlight-self-and-ops): New function to serve as
default value for `erc-speedbar--nick-face-function'.
(erc-speedbar--on-click): Dispatch `erc-nick-popup' after trimming
status chars.
(erc-speedbar-insert-user): Revise doc string. Call
`erc-speedbar--nick-face-function' to determine face. Change
token for both expansion and on-click text props. Assign
`erc-speedbar--on-click' as the mouse handler for nick items.
(erc-speedbar--buffer-options): Variable to override options locally
in speedbar buffer.
(erc-speedbar--hidden-speedbar-frame): Add variable to hold original
`speedbar-frame' before spoofing by setting to selected frame
containing window showing ERC buffer.
(erc-speedbar--emulate-sidebar-set-window-preserve-size,
erc-speedbar--status-sidebar-mode--unhook): Add function
to ensure status sidebar is showing correctly and helper to
unregister from hook on teardown.
(erc-speedbar--emulate-sidebar): Add function to control sidebar
nicknames setup.
(erc-speedbar--toggle-nicknames-sidebar): Add toggle function
for speedbar or emulated sidebar.
(erc-speedbar--ensure): Add helper function to show speedbar if it's
hidden or create one if none exists.
(erc-nickbar-mode, erc-nickbar-enable, erc-nickbar-disable):
Add new mini module.
(erc-speedbar--dframe-controlled) Add function to overwrite
`speedbar-frame-mode' as `dframe-controlled' in speedbar buffer.
(erc-speedbar-toggle-nicknames-window-lock,
erc-speedbar-close-nicknames-window): Add commands to close speedbar
window and toggle its cyclability.
(erc-speedbar--compose-nicks-face): Add helper for nicks integration.
* test/lisp/erc/erc-scenarios-status-sidebar.el
(erc-scenarios-status-sidebar--nickbar): New test. (Bug#63595)
F. Jason Park [Thu, 4 May 2023 07:01:11 +0000 (00:01 -0700)]
Add preset styles to erc-status-sidebar
* lisp/erc/erc-networks.el (erc-networks--rename-server-buffer): Store
`erc-networks--id' in process object's plist.
* lisp/erc/erc-status-sidebar.el (erc-status-sidebar): Change group
parent from `convenience' to `erc'.
(erc-status-sidebar-channel-format): Mention in doc string that it
depends on new option `erc-status-sidebar-style'.
(erc-status-sidebar-highlight-active-buffer): New option to control
whether the current window's target is highlighted in the status bar.
(erc-status-sidebar-style): New option to determine whether servers
and queries also appear in the sidebar.
(erc-status-sidebar-click-display-action,
erc-status-sidebar-singular): New options.
(erc-status-sidebar-get-window): Consider
`erc-status-sidebar-singular'.
(erc-status-sidebar-open): Fix toggle functionality that somehow fell
through the cracks after the adoption of the package into ERC proper.
(erc-bufbar-mode, erc-bufbar-enable, erc-bufbar-disable): New module
named `bufbar' instead of `sidebar', which is more easily confusable
with `speedbar'. The preferred name, `status-sidebar' was unavailable
because its minor-mode would have been `erc-status-sidebar-mode',
which is already taken by the major mode used for status-bar buffers
themselves.
(erc-status-sidebar-toggle): Ignore `erc-status-sidebar-singular'.
(erc-status-sidebar--trimpat, erc-status-sidebar--prechan): Add helper
vars for new sorting function, allowing it to honor the existing
interface, which only expects one argument.
(erc-status-sidebar-prefer-target-as-name): New function for
determining buffer name, preferring targets for target buffers.
(erc-status-sidebar-get-channame): Use internal API to help determine
name of buffer in sidebar.
(erc-status-sidebar-prefer-target-as-name,
erc-status-sidebar--show-disconnected,
erc-status-sidebar-all-target-buffers,
erc-status-sidebar-default-allsort): Add new naming and sorting
functions and associated helper functions and variables.
(erc-status-sidebar--active-marker,
erc-status-sidebar--set-active-line): New variable and function for
highlighting the active target in the status bar.
(erc-status-sidebar-default-insert,
erc-status-sidebar-pad-hierarchy): New functions for visiting various
stages of buffer modification when rendering sidebar.
(erc-status-sidebar-refresh): Consider presets and new options when
rendering sidebar.
(erc-status-sidebar-kill): Disable `erc-bufbar-mode' when active.
(erc-status-sidebar-click): Appeal to option
`erc-status-sidebar-display-action' for `pop-to-buffer' action.
(erc-status-sidebar-scroll-up, erc-status-sidebar-scroll-down,
erc-status-sidebar-recenter): Add commands to scroll and
recenter sidebar from a target buffer's window.
(erc-status-sidebar-set-window-preserve-size): Ignore
`erc-status-sidebar-singular'.
(erc-status-sidebar-mode): Make non-interactive to avoid confusion
when folks run "M-x erc-status-sidebar-mode" expecting a module
toggle.
* test/lisp/erc/erc-scenarios-status-sidebar.el: New file.
* test/lisp/erc/resources/base/gapless-connect/foonet.eld: Fix wrong
manifest for channel and extend PASS timeout. (Bug#63595)
F. Jason Park [Mon, 15 May 2023 07:16:00 +0000 (00:16 -0700)]
Allow ERC's module toggles access to the prefix arg
* lisp/erc/erc-common.el (erc--module-toggle-prefix-arg): Add internal
variable for preserving the `arg' passed to a module's minor-mode
toggle, which was previously discarded. Doing this lets modules that
are more interactive in nature overload their mode toggles with
alternate behaviors.
(define-erc-module): Bind `erc--module-toggle-prefix-arg' to the `arg'
parameter, which is normally defined inside a `define-minor-mode' body
form.
* test/lisp/erc/erc-tests.el (define-erc-module--global,
define-erc-module--local): Expect activation body to be wrapped by a
let form binding `erc--module-toggle-prefix-arg'. (Bug#63595)
F. Jason Park [Thu, 18 May 2023 02:48:02 +0000 (19:48 -0700)]
Fix buffer-mismatch bug in erc-scroll-to-bottom
* lisp/erc/erc-goodies.el (erc-scroll-to-bottom): Only `recenter' when
the selected window's buffer is current. Previously, the module
`scrolltobottom' signaled an "Error in `post-command-hook'" when a
user clicked a channel indicator in the mode line from a window
showing another ERC buffer.
* lisp/erc/erc-track.el (erc-track--switch-fallback-blockers): New
internal variable used by `erc-track--switch-buffer' in deciding
whether to set `erc-track-last-non-erc-buffer' to the current buffer.
(erc-track--switch-buffer): Consult list of `buffer-match-p'
conditions in `erc-track--switch-fallback-blockers' to decide whether
to set `erc-track-last-non-erc-buffer' to the current buffer.
(Bug#63595)
F. Jason Park [Wed, 31 May 2023 06:27:12 +0000 (23:27 -0700)]
Allow custom display-buffer actions in ERC
* doc/misc/erc.texi: Add new section under "Integrations" chapter
describing `display-buffer' Custom function choice for ERC's many
buffer-display options.
* etc/ERC-NEWS: Mention new function variant for all buffer-display
options.
* lisp/erc/erc-backend.el: Add forward declaration for
`erc--called-as-input-p' and `erc--display-context'.
(erc--server-reconnect-display-timer,
erc--server-last-reconnect-display-reset): Use new name for option
`erc-reconnect-display', now `erc-auto-reconnect-display'.
(erc--server-determine-join-display-context): New generic function to
determine value of `erc--display-context' during JOINs.
(erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a
symbol for the handler's IRC command, like `JOIN', for the benefit of
custom `display-buffer'-like functions running in `erc-setup-buffer'.
(erc-server-471, erc-server-471-functions, erc-server-473,
erc-server-473-functions): New handlers for JOIN rejections. Also
remove 471 and 473 from comment at bottom of file.
(erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN'
sets `erc-interactive-display' context.
* lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable,
erc-autojoin-disable): Kill local variable
`erc-join--requested-channels'. Add and remove
`erc-join--remove-requested-channels' to/from various server-handler
hooks for JOIN rejection numerics.
(erc-join--requested-channels): New local variable to remember
channels we've attempted to JOIN this session that haven't yet been
confirmed by the server.
(erc-join--remove-requested-channel): New JOIN rejection handler to
stop tracking channel in `erc-join--requested-channels'.
(erc--server-determine-join-display-context): module-specific
implementation of generic function for `erc-autojoin-mode'.
(erc-autojoin--join): Remember channels slated for JOIN'ing.
* lisp/erc/erc.el (erc--buffer-display-choices): New helper constant
for defining common `:type' for all buffer-display options.
(erc-buffer-display, erc-interactive-display,
erc-auto-reconnect-display, erc-receive-query-display): Use helper
`erc--buffer-display-choices' for defining `:type', which
includes a new choice for a `display-buffer'-like function.
(erc-reconnect-display, erc-auto-reconnect-display): Alias former to
latter, now the preferred name.
(erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from
former to latter. This option is new in ERC 5.6.
(erc-reconnect-display-server-buffers): New option.
(erc-buffer-do): Revise doc string.
(erc--display-context): New variable, an alist of "context tokens" to
be forwarded as the "action alist" to `erc-buffer-display' functions.
(erc-skip-displaying-selected-window-buffer): New variable, deprecated
at birth, to act as an escape hatch for folks who don't want to skip
the displaying of buffers already showing in the selected window.
(erc--display-buffer-overriding-action): Local variable allowing
modules to influence the displaying of new ERC buffers independently
of user options.
(erc-setup-buffer): Do nothing when the selected window already shows
current buffer unless user has provided a custom display function.
Accommodate new Custom choice function values, like `display-buffer'
and `pop-to-buffer'.
(erc-open): Run `erc-setup-buffer' when option
`erc-reconnect-display-server-buffers' is non-nil, even for existing
server buffers. Bind `display-buffer-overriding-action' to the value
of `erc--display-buffer-overriding-action' around calls to
`erc-setup-buffer'.
(erc-select-read-args): Add `erc--display-context' to environment.
(erc, erc-tls): Bind `erc--display-context' around calls to
`erc-select-read-args' and main body.
(erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url):
Add item for `erc-interactive-display' to `erc--display-context'.
(erc-connection-established): Update name of
`erc-reconnect-display-timeout' to
`erc-auto-reconnect-display-timeout'.
(erc-message-english-s471, erc-message-english-s473): New variables,
format templates for JOIN rejection messages.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--defwino-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred
name `erc-auto-reconnect-display' for `erc-reconnect-display'.
* test/lisp/erc/erc-scenarios-join-display-context.el: New file.
* test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix
unrealistic call to `erc-open'.
(erc-setup-buffer--custom-action): New test.
(erc-select-read-args, erc-tls, erc--interactive, erc-server-select):
Expect new environment binding for `erc--display-context'.
* test/lisp/erc/resources/join/buffer-display/mode-context.eld: New
file. (Bug#62833)
F. Jason Park [Sun, 25 Jun 2023 01:33:20 +0000 (18:33 -0700)]
Optionally combine faces in erc-display-message
* etc/ERC-NEWS: Tell module authors that `erc-display-message' can now
combine faces.
* lisp/erc/erc-button.el (erc-button--display-error-notice-with-keys):
Ask `erc-display-message' to compose `erc-notice-face' and
`erc-error-face'.
* lisp/erc/erc-match.el (erc-hide-fools): Merge `invisible' prop
`erc-match' with existing, if present, and move body to helper for
hiding matched messages.
(erc-match--hide-message): New helper function to hide messages
regardless of match type.
* lisp/erc/erc-track.el: (erc-track-faces-priority-list): Note in doc
string that faces reserved for critical messages are always
prioritized. Wrap :type declaration in macro helper to ensure
`erc-button' is loaded beforehand. Otherwise calling `setopt' with
the option's default value fails.
(erc-track--attn-faces): Add new internal variable for faces that
should always appear in the mode line, at least in the default client.
(erc-track-modified-channels, erc-track-face-priority): Prepend
`erc-track--attn-faces' to `erc-track-faces-priority-list'.
* lisp/erc/erc.el (erc-send-action): Ask `erc-display-message' to
apply both `erc-input-face' and `erc-action-face' to messages.
(erc--compose-text-properties): New internal variable to act as flag
for altering behavior of `erc-put-text-property'.
(erc--merge-prop): New function copied from `erc-button-add-face' for
general internal use with any text property by all of ERC.
(erc-display-message-highlight): Set fallback face to
`erc-default-face' the symbol instead of the string. For this to
break third-party code, callers would have to supply erroneous types
for nonexistent or undefined handlers and then explicitly check for
and depend on such misuse, which seems unlikely and therefore not
worth mentioning in etc/ERC-NEWS.
(erc-display-message): Explain how `type' param works when it's a
list. Fix code in type-as-list branch so that it optionally combines
faces instead of clobbers them.
(erc-put-text-property): Unalias from `put-text-property', but fall
back to the latter unless caller wants to combine faces, in which case,
defer to `erc--merge-prop'.
* test/lisp/erc/erc-button-tests.el
(erc-button--display-error-notice-with-keys): Expect a combined "error
notice" face. (Bug#64301)
F. Jason Park [Sun, 25 Jun 2023 01:33:20 +0000 (18:33 -0700)]
Add text props for CTCP messages and speakers in ERC
* etc/ERC-NEWS: Mention reduction in boldness of `erc-notice-face' and
`erc-action-face'.
* lisp/erc/erc-fill.el (erc-fill-spaced-commands,
erc-fill--spaced-commands): Rename former to latter and demote from
user option to internal variable.
(erc-fill): Change `erc-fill-spaced-commands' to
`erc-fill--spaced-commands'.
(erc-fill--wrap-continued-message-p): Use more precise `erc-ctcp' text
prop instead of face-based heuristic to detect CTCP ACTION message.
(erc-fill--wrap-action-dedent-p): New variable to toggle whether
`line-prefix' is applied to CTCP ACTION messages. This exists less
to accommodate user preferences and more for third-party code that
assumes the first non-whitespace span in every message is a nick.
(erc-fill-wrap): Look for `erc-speaker' property before falling back
on word at point. Use `erc-ctcp' to detect CTCP ACTION messages.
* lisp/erc/erc.el (erc-notice-face, erc-action-face): Prefer weight of
`semi-bold' when available so that buttonization is at least somewhat
perceptible in notices and action messages.
(erc-send-action): Ensure nickname passed to `erc-display-message' has
`erc-speaker' property and `erc-ctcp' ACTION property.
(erc--own-property-names): Add `erc-speaker' to lineup.
(erc-format-privmessage): Don't clobber `erc-nick-prefix-face'. That
is, retain face applied to a leading stretch of characters in the
`nick' parameter, but continue to discard trailing faces.
(erc-format-my-nick, erc-ctcp-query-ACTION): Add new text property
`erc-speaker' to the nick portion of the formatted speaker label. Do
this to assist modules, like `button' and `match', that currently
re-parse speakers in inserted messages.
(erc-process-ctcp-query): Add `erc-ctcp' property to entire message
before insertion hooks see it.
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--compare): Warn
about certain unreliable comparisons if generalizing helper for use by
other modules.
* test/lisp/erc/erc-tests.el (erc-tests--equal-including-properties):
New helper compat macro.
(erc-format-privmessage): New test. (Bug#64301)
F. Jason Park [Sat, 1 Jul 2023 06:42:01 +0000 (23:42 -0700)]
Simplify erc-button-add-nickname-buttons
* lisp/erc/erc-button.el (erc-button--nick): Remove `face' slot, which
was set to `erc-button-face' by default. It's ignored when the button
is a nick and thus useless and misleading.
(erc-button-add-nickname-buttons): Rework and reflow for readability.
Don't bind or set `erc-button' face because it's ignored when dealing
with nicks. Don't return the value of face options when calling a
`form' function because they can be nil in practice even though their
Custom type specs do not say so.
* lisp/erc/erc-common.el (erc--with-dependent-type-match): Add helper
macro for Custom :type defs that incur warnings from `setopt' due to
some missing dependency. This occurs when specifying a :type of
`face' instead of `symbol' and the option's default value includes
faces from another library that hasn't been loaded.
* lisp/erc/erc.el (erc--get-speaker-bounds): New helper function to
retrieve bounds of a speaker label when present.
* test/lisp/erc/erc-tests.el (erc--with-dependent-type-match): Add
test. (Bug#64301)