aboutsummaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorF. Jason Park2023-07-14 06:12:30 -0700
committerF. Jason Park2023-07-22 07:33:07 -0700
commit63d8b2a59a4f395ca64adb698cdb4764d80dfbee (patch)
treebdd38bda05c4c50da66c9c9ae3c988e7396aa313 /etc
parentd09464e50482a792cc11c20916167d3f62637c2d (diff)
downloademacs-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-NEWS20
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.
104While this option has always offered to right-align stamps via the 104While 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
106to a number indicating an offset from the right edge. And when set to 106to a number indicating an offset from the right edge. Users of the
107the symbol 'margin', it displays stamps in the right margin, although, 107'log' module may want to customize 'erc-log-filter-function' to
108at the moment, this is mostly intended for use by other modules, such
109as 'fill-wrap', described above. For both these variants, users of
110the '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
112appearing in their saved logs. 109appearing in their saved logs.
113 110
@@ -228,7 +225,8 @@ Chiefly, 'rear-sticky' has been replaced by 'erc-command', which
228records the IRC command (or numeric) associated with a message. Less 225records the IRC command (or numeric) associated with a message. Less
229impactfully, the value of the 'field' property for ERC's prompt has 226impactfully, the value of the 'field' property for ERC's prompt has
230changed from 't' to the more useful 'erc-prompt', although the 227changed from 't' to the more useful 'erc-prompt', although the
231property of the same name has been retained. 228property 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.
234Built-in and third-party modules rely on certain hooks for adjusting 232Built-in and third-party modules rely on certain hooks for adjusting
@@ -261,6 +259,16 @@ Additionally, the 'stamp' module now merges its 'invisible' property
261with existing ones, when present, and it includes all white space 259with existing ones, when present, and it includes all white space
262around stamps when doing so. 260around stamps when doing so.
263 261
262Moreover, such "propertizing" of surrounding white space now extends
263to all 'stamp'-applied properties, like 'field', in all intervening
264space between message text and timestamps. This constitutes a
265breaking change from the perspective of detecting a timestamp's
266bounds. For example, ERC has always propertized leading space before
267right-sided stamps on the same line as message text but not those
268folded onto the next line. This inconsistency made stamp detection
269overly complex and produced uneven results when toggling stamp
270visibility.
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.
265Associating built-in modules with Custom groups and provided library 273Associating built-in modules with Custom groups and provided library
266features has improved. More specifically, a module's group now enjoys 274features has improved. More specifically, a module's group now enjoys