diff options
| author | F. Jason Park | 2023-07-14 06:12:30 -0700 |
|---|---|---|
| committer | F. Jason Park | 2023-07-22 07:33:07 -0700 |
| commit | 63d8b2a59a4f395ca64adb698cdb4764d80dfbee (patch) | |
| tree | bdd38bda05c4c50da66c9c9ae3c988e7396aa313 /etc | |
| parent | d09464e50482a792cc11c20916167d3f62637c2d (diff) | |
| download | emacs-63d8b2a59a4f395ca64adb698cdb4764d80dfbee.tar.gz emacs-63d8b2a59a4f395ca64adb698cdb4764d80dfbee.zip | |
Make erc-fill-wrap work with left-sided stamps
* etc/ERC-NEWS: Remove all mention of option `erc-timestamp-align-to'
supporting a value of `margin', which has been abandoned. Do mention
leading white space before stamps now having stamp-related properties.
* lisp/erc/erc-backend.el (erc--reveal-prompt, erc--conceal-prompt):
New generic functions with default implementations factored out from
`erc--unhide-prompt' and `erc--hide-prompt'.
(erc--prompt-hidden-p): New internal predicate function.
(erc--unhide-prompt): Defer to `erc--reveal-prompt', and set
`erc-prompt' text property to t.
(erc--hide-prompt): Defer to `erc--conceal-prompt', and set
`erc-prompt' text property to `hidden'.
* lisp/erc/erc-compat.el (erc-compat--29-browse-url-irc): Don't
use `function-equal'.
* lisp/erc/erc-fill.el (erc-fill-wrap-margin-width,
erc-fill-wrap-margin-side): New options to control side and initial
width of `fill-wrap' margin.
(erc-fill--wrap-beginning-of-line): Fix bug involving non-string
valued `display' props.
(erc-fill-wrap-toggle-truncate-lines): New command to re-enable
`visual-line-mode' when toggling off `truncate-lines'.
(erc-fill-wrap-mode-map): Remap `toggle-truncate-lines' to
`erc-fill-wrap-toggle-truncate-lines'.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Update doc string, persist a few local vars, and conditionally set
`erc-stamp--margin-left-p'. When deactivating, disable
`visual-line-mode' first.
(erc-fill--wrap-continued-message-p): Use `erc-speaker' instead of
heuristics when comparing nicks between consecutive messages.
(erc-fill-wrap-nudge): Update doc string and account for left-sided
stamps.
(erc-timestamp-offset): Add comment regarding conditional guard based
on function-valued option.
* lisp/erc/erc-stamp.el (erc-timestamp-use-align-to): Remove value
variant `margin', which was originally intended to be new in ERC 5.6.
This functionality was all but useless without the internal minor mode
`erc-stamp--display-margin-mode' active.
(erc-stamp-right-margin-width): Remove unused option new in 5.6.
(erc-stamp--display-margin-force): Remove unused function.
(erc-stamp--margin-width, erc-stamp--margin-left-p): New internal
variables.
(erc-stamp--init-margins-on-connect): New function for initializing
mode-managed margin after connecting.
(erc-stamp--adjust-right-margin, erc-stamp--adjust-margin): Rename
function to latter and accommodate left-hand stamps.
(erc-stamp--inherited-props): Move definition higher up in same file.
(erc-stamp--display-margin-mode): Update function name, and adjust
setup and teardown to accommodate left-handed stamps. Don't add
advice around `erc-insert-timestamp-function'.
(erc-stamp--last-prompt, erc-stamp--display-prompt-in-left-margin):
New function and helper var to convert a normal inserted prompt so
that it appears in the left margin.
(erc-stamp--refresh-left-margin-prompt): Helper for other modules to
quickly refresh prompt outside of insert hooks.
(erc--reveal-prompt, erc--conceal-prompt): New implementations for
when `erc-stamp--display-margin-mode' is active.
(erc-insert-timestamp-left): Convert to generic function and provide
implementation for `erc-stamp--display-margin-mode'.
(erc-stamp--omit-properties-on-folded-lines): New variable, an escape
hatch for propertizing white space before right-side stamps folded
over onto another line.
(erc-insert-timestamp-right): Don't expect `erc-timestamp-align-to' to
ever be the symbol `margin'. Move handling for that case to one
contingent on the internal minor mode `erc-stamp--display-margin-mode'
being active. Add text properties preceding stamps that occupy a line
by their lonesome. See related news entry for rationale. This is
arguably a breaking change.
* lisp/erc/erc.el (erc--refresh-prompt-hook): New hook variable for
modules to adjust prompt properties whenever it's refreshed.
(erc--refresh-prompt): Fix bug in which user-defined prompt functions
failed to hide when quitting in server buffers. Run new hook
`erc--refresh-prompt-hook'.
(erc-display-prompt): Add comment noting that the text property
`erc-prompt' now actually matters: it's t while a session is running
and `hidden' when disconnected.
* test/lisp/erc/erc-fill-tests.el (erc-fill--left-hand-stamps): New
test.
* test/lisp/erc/erc-stamp-tests.el
(erc-stamp-tests--use-align-to--nil,
erc-stamp-tests--use-align-to--t): New functions forged from old test
bodies to allow optionally asserting pre-5.6 behavior regarding
leading white space on right-hand stamps that exist on their own line.
(erc-timestamp-use-align-to--nil, erc-timestamp-use-align-to--t):
Parameterize with compatibility flag.
(erc-timestamp-use-align-to--margin,
erc-stamp--display-margin-mode--right): Rename test to latter.
* test/lisp/erc/erc-tests.el (erc-hide-prompt): Add some assertions
for new possible value of `erc-prompt' text property.
* test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: New test
data file. (Bug#60936)
Diffstat (limited to 'etc')
| -rw-r--r-- | etc/ERC-NEWS | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS index 4c881e32ab4..13e49a9123d 100644 --- a/etc/ERC-NEWS +++ b/etc/ERC-NEWS | |||
| @@ -103,11 +103,8 @@ side window. Hit '<RET>' over a nick to spawn a "/QUERY" or a | |||
| 103 | ** The option 'erc-timestamp-use-align-to' is more versatile. | 103 | ** The option 'erc-timestamp-use-align-to' is more versatile. |
| 104 | While this option has always offered to right-align stamps via the | 104 | While this option has always offered to right-align stamps via the |
| 105 | 'display' text property, it's now more effective at doing so when set | 105 | 'display' text property, it's now more effective at doing so when set |
| 106 | to a number indicating an offset from the right edge. And when set to | 106 | to a number indicating an offset from the right edge. Users of the |
| 107 | the symbol 'margin', it displays stamps in the right margin, although, | 107 | 'log' module may want to customize 'erc-log-filter-function' to |
| 108 | at the moment, this is mostly intended for use by other modules, such | ||
| 109 | as 'fill-wrap', described above. For both these variants, users of | ||
| 110 | the 'log' module may want to customize 'erc-log-filter-function' to | ||
| 111 | 'erc-stamp-prefix-log-filter' to avoid ragged right-hand stamps | 108 | 'erc-stamp-prefix-log-filter' to avoid ragged right-hand stamps |
| 112 | appearing in their saved logs. | 109 | appearing in their saved logs. |
| 113 | 110 | ||
| @@ -228,7 +225,8 @@ Chiefly, 'rear-sticky' has been replaced by 'erc-command', which | |||
| 228 | records the IRC command (or numeric) associated with a message. Less | 225 | records the IRC command (or numeric) associated with a message. Less |
| 229 | impactfully, the value of the 'field' property for ERC's prompt has | 226 | impactfully, the value of the 'field' property for ERC's prompt has |
| 230 | changed from 't' to the more useful 'erc-prompt', although the | 227 | changed from 't' to the more useful 'erc-prompt', although the |
| 231 | property of the same name has been retained. | 228 | property of the same name has been retained and now has a value of |
| 229 | 'hidden' when disconnected. | ||
| 232 | 230 | ||
| 233 | *** Members of insert- and send-related hooks have been reordered. | 231 | *** Members of insert- and send-related hooks have been reordered. |
| 234 | Built-in and third-party modules rely on certain hooks for adjusting | 232 | Built-in and third-party modules rely on certain hooks for adjusting |
| @@ -261,6 +259,16 @@ Additionally, the 'stamp' module now merges its 'invisible' property | |||
| 261 | with existing ones, when present, and it includes all white space | 259 | with existing ones, when present, and it includes all white space |
| 262 | around stamps when doing so. | 260 | around stamps when doing so. |
| 263 | 261 | ||
| 262 | Moreover, such "propertizing" of surrounding white space now extends | ||
| 263 | to all 'stamp'-applied properties, like 'field', in all intervening | ||
| 264 | space between message text and timestamps. This constitutes a | ||
| 265 | breaking change from the perspective of detecting a timestamp's | ||
| 266 | bounds. For example, ERC has always propertized leading space before | ||
| 267 | right-sided stamps on the same line as message text but not those | ||
| 268 | folded onto the next line. This inconsistency made stamp detection | ||
| 269 | overly complex and produced uneven results when toggling stamp | ||
| 270 | visibility. | ||
| 271 | |||
| 264 | *** The role of a module's Custom group is now more clearly defined. | 272 | *** The role of a module's Custom group is now more clearly defined. |
| 265 | Associating built-in modules with Custom groups and provided library | 273 | Associating built-in modules with Custom groups and provided library |
| 266 | features has improved. More specifically, a module's group now enjoys | 274 | features has improved. More specifically, a module's group now enjoys |