diff options
| author | F. Jason Park | 2023-10-18 23:20:07 -0700 |
|---|---|---|
| committer | F. Jason Park | 2023-10-20 14:53:24 -0700 |
| commit | bcebda5eec2166e475579c2aa2ee425aeabbb505 (patch) | |
| tree | cfc3e9646f1d30639bae321292da52c3bf974dd1 /lisp/erc | |
| parent | 47612514a9e04d6f41568c3f0cdeae837c2eae19 (diff) | |
| download | emacs-bcebda5eec2166e475579c2aa2ee425aeabbb505.tar.gz emacs-bcebda5eec2166e475579c2aa2ee425aeabbb505.zip | |
Respect user markers in erc-insert-timestamp-left
* lisp/erc/erc-stamp.el (erc-insert-timestamp-left): Convert to normal
function, a mere wrapper that defers to existing generic variants, in
order to dissuade users from adding their own methods, which could
complicate troubleshooting, etc.
(erc--insert-timestamp-left): Rename both methods using internal
double-hyphen convention. In `erc-stamp--display-margin-mode'
implementation, don't displace third-party markers.
* test/lisp/erc/erc-scenarios-stamp.el: New file. (Bug#60936)
Diffstat (limited to 'lisp/erc')
| -rw-r--r-- | lisp/erc/erc-stamp.el | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index c8fd7c35392..b515513dcb7 100644 --- a/lisp/erc/erc-stamp.el +++ b/lisp/erc/erc-stamp.el | |||
| @@ -492,8 +492,11 @@ and `erc-stamp--margin-left-p', before activating the mode." | |||
| 492 | (put-text-property erc-insert-marker (1- erc-input-marker) | 492 | (put-text-property erc-insert-marker (1- erc-input-marker) |
| 493 | 'display `((margin left-margin) ,prompt)))) | 493 | 'display `((margin left-margin) ,prompt)))) |
| 494 | 494 | ||
| 495 | (cl-defmethod erc-insert-timestamp-left (string) | 495 | (defun erc-insert-timestamp-left (string) |
| 496 | "Insert timestamps at the beginning of the line." | 496 | "Insert timestamps at the beginning of the line." |
| 497 | (erc--insert-timestamp-left string)) | ||
| 498 | |||
| 499 | (cl-defmethod erc--insert-timestamp-left (string) | ||
| 497 | (goto-char (point-min)) | 500 | (goto-char (point-min)) |
| 498 | (let* ((ignore-p (and erc-timestamp-only-if-changed-flag | 501 | (let* ((ignore-p (and erc-timestamp-only-if-changed-flag |
| 499 | (string-equal string erc-timestamp-last-inserted))) | 502 | (string-equal string erc-timestamp-last-inserted))) |
| @@ -504,13 +507,12 @@ and `erc-stamp--margin-left-p', before activating the mode." | |||
| 504 | (erc-put-text-property 0 len 'invisible erc-stamp--invisible-property s) | 507 | (erc-put-text-property 0 len 'invisible erc-stamp--invisible-property s) |
| 505 | (insert s))) | 508 | (insert s))) |
| 506 | 509 | ||
| 507 | (cl-defmethod erc-insert-timestamp-left | 510 | (cl-defmethod erc--insert-timestamp-left |
| 508 | (string &context (erc-stamp--display-margin-mode (eql t))) | 511 | (string &context (erc-stamp--display-margin-mode (eql t))) |
| 509 | (unless (and erc-timestamp-only-if-changed-flag | 512 | (unless (and erc-timestamp-only-if-changed-flag |
| 510 | (string-equal string erc-timestamp-last-inserted)) | 513 | (string-equal string erc-timestamp-last-inserted)) |
| 511 | (goto-char (point-min)) | 514 | (goto-char (point-min)) |
| 512 | (insert-before-markers-and-inherit | 515 | (insert-and-inherit (setq erc-timestamp-last-inserted string)) |
| 513 | (setq erc-timestamp-last-inserted string)) | ||
| 514 | (dolist (p erc-stamp--inherited-props) | 516 | (dolist (p erc-stamp--inherited-props) |
| 515 | (when-let ((v (get-text-property (point) p))) | 517 | (when-let ((v (get-text-property (point) p))) |
| 516 | (put-text-property (point-min) (point) p v))) | 518 | (put-text-property (point-min) (point) p v))) |