diff options
| author | F. Jason Park | 2023-04-26 07:05:49 -0700 |
|---|---|---|
| committer | F. Jason Park | 2023-05-05 17:18:01 -0700 |
| commit | 2641dfd4b4334942282358b50d74f75424ebf4fa (patch) | |
| tree | 0084983ccf1409308723ee753764193099aa96f0 | |
| parent | 90a9c7b7b594dfcdc985541eb366e5684136c3ec (diff) | |
| download | emacs-2641dfd4b4334942282358b50d74f75424ebf4fa.tar.gz emacs-2641dfd4b4334942282358b50d74f75424ebf4fa.zip | |
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.
| -rw-r--r-- | lisp/erc/erc-fill.el | 12 | ||||
| -rw-r--r-- | lisp/erc/erc-match.el | 2 | ||||
| -rw-r--r-- | lisp/erc/erc-stamp.el | 10 |
3 files changed, 18 insertions, 6 deletions
diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el index 7b6495f9f3f..a56134d8188 100644 --- a/lisp/erc/erc-fill.el +++ b/lisp/erc/erc-fill.el | |||
| @@ -221,8 +221,13 @@ messages less than a day apart." | |||
| 221 | (let ((inhibit-field-text-motion t)) | 221 | (let ((inhibit-field-text-motion t)) |
| 222 | (erc-fill--wrap-move #'move-beginning-of-line | 222 | (erc-fill--wrap-move #'move-beginning-of-line |
| 223 | #'beginning-of-visual-line arg)) | 223 | #'beginning-of-visual-line arg)) |
| 224 | (when (get-text-property (point) 'erc-prompt) | 224 | (if (get-text-property (point) 'erc-prompt) |
| 225 | (goto-char erc-input-marker))) | 225 | (goto-char erc-input-marker) |
| 226 | ;; Mimic what `move-beginning-of-line' does with invisible text. | ||
| 227 | (when-let ((erc-fill-wrap-merge) | ||
| 228 | (empty (get-text-property (point) 'display)) | ||
| 229 | ((string-empty-p empty))) | ||
| 230 | (goto-char (text-property-not-all (point) (pos-eol) 'display empty))))) | ||
| 226 | 231 | ||
| 227 | (defun erc-fill--wrap-end-of-line (arg) | 232 | (defun erc-fill--wrap-end-of-line (arg) |
| 228 | "Defer to `move-end-of-line' or `end-of-visual-line'." | 233 | "Defer to `move-end-of-line' or `end-of-visual-line'." |
| @@ -389,6 +394,9 @@ See `erc-fill-wrap-mode' for details." | |||
| 389 | (progn | 394 | (progn |
| 390 | (skip-syntax-forward "^-") | 395 | (skip-syntax-forward "^-") |
| 391 | (forward-char) | 396 | (forward-char) |
| 397 | ;; Using the `invisible' property might make more | ||
| 398 | ;; sense, but that would require coordination | ||
| 399 | ;; with other modules, like `erc-match'. | ||
| 392 | (cond ((and erc-fill-wrap-merge | 400 | (cond ((and erc-fill-wrap-merge |
| 393 | (erc-fill--wrap-continued-message-p)) | 401 | (erc-fill--wrap-continued-message-p)) |
| 394 | (put-text-property (point-min) (point) | 402 | (put-text-property (point-min) (point) |
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el index 82b821503a8..c08a640260c 100644 --- a/lisp/erc/erc-match.el +++ b/lisp/erc/erc-match.el | |||
| @@ -654,6 +654,8 @@ See `erc-log-match-format'." | |||
| 654 | 654 | ||
| 655 | (defvar-local erc-match--hide-fools-offset-bounds nil) | 655 | (defvar-local erc-match--hide-fools-offset-bounds nil) |
| 656 | 656 | ||
| 657 | ;; FIXME this should merge with instead of overwrite existing | ||
| 658 | ;; `invisible' values. | ||
| 657 | (defun erc-hide-fools (match-type _nickuserhost _message) | 659 | (defun erc-hide-fools (match-type _nickuserhost _message) |
| 658 | "Hide foolish comments. | 660 | "Hide foolish comments. |
| 659 | This function should be called from `erc-text-matched-hook'." | 661 | This function should be called from `erc-text-matched-hook'." |
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index 61f289a8753..f90a8fc50b1 100644 --- a/lisp/erc/erc-stamp.el +++ b/lisp/erc/erc-stamp.el | |||
| @@ -198,13 +198,15 @@ may not be unique, `equal'-wise." | |||
| 198 | 198 | ||
| 199 | This function is meant to be called from `erc-insert-modify-hook' | 199 | This function is meant to be called from `erc-insert-modify-hook' |
| 200 | or `erc-send-modify-hook'." | 200 | or `erc-send-modify-hook'." |
| 201 | (unless (get-text-property (point-min) 'invisible) | 201 | (progn ; remove this `progn' on next major refactor |
| 202 | (let* ((ct (erc-stamp--current-time)) | 202 | (let* ((ct (erc-stamp--current-time)) |
| 203 | (invisible (get-text-property (point-min) 'invisible)) | ||
| 203 | (erc-stamp--current-time ct)) | 204 | (erc-stamp--current-time ct)) |
| 204 | (funcall erc-insert-timestamp-function | 205 | (unless invisible |
| 205 | (erc-format-timestamp ct erc-timestamp-format)) | 206 | (funcall erc-insert-timestamp-function |
| 207 | (erc-format-timestamp ct erc-timestamp-format))) | ||
| 206 | ;; FIXME this will error when advice has been applied. | 208 | ;; FIXME this will error when advice has been applied. |
| 207 | (when (and (fboundp erc-insert-away-timestamp-function) | 209 | (when (and (not invisible) (fboundp erc-insert-away-timestamp-function) |
| 208 | erc-away-timestamp-format | 210 | erc-away-timestamp-format |
| 209 | (erc-away-time) | 211 | (erc-away-time) |
| 210 | (not erc-timestamp-format)) | 212 | (not erc-timestamp-format)) |