diff options
| author | F. Jason Park <jp@neverwas.me> | 2023-04-26 07:05:49 -0700 |
|---|---|---|
| committer | F. Jason Park <jp@neverwas.me> | 2023-05-05 17:18:01 -0700 |
| commit | 2641dfd4b4334942282358b50d74f75424ebf4fa (patch) | |
| tree | 0084983ccf1409308723ee753764193099aa96f0 | |
| parent | 90a9c7b7b594dfcdc985541eb366e5684136c3ec (diff) | |
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." (let ((inhibit-field-text-motion t)) (erc-fill--wrap-move #'move-beginning-of-line #'beginning-of-visual-line arg)) - (when (get-text-property (point) 'erc-prompt) - (goto-char erc-input-marker))) + (if (get-text-property (point) 'erc-prompt) + (goto-char erc-input-marker) + ;; Mimic what `move-beginning-of-line' does with invisible text. + (when-let ((erc-fill-wrap-merge) + (empty (get-text-property (point) 'display)) + ((string-empty-p empty))) + (goto-char (text-property-not-all (point) (pos-eol) 'display empty))))) (defun erc-fill--wrap-end-of-line (arg) "Defer to `move-end-of-line' or `end-of-visual-line'." @@ -389,6 +394,9 @@ See `erc-fill-wrap-mode' for details." (progn (skip-syntax-forward "^-") (forward-char) + ;; Using the `invisible' property might make more + ;; sense, but that would require coordination + ;; with other modules, like `erc-match'. (cond ((and erc-fill-wrap-merge (erc-fill--wrap-continued-message-p)) (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'." (defvar-local erc-match--hide-fools-offset-bounds nil) +;; FIXME this should merge with instead of overwrite existing +;; `invisible' values. (defun erc-hide-fools (match-type _nickuserhost _message) "Hide foolish comments. 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." This function is meant to be called from `erc-insert-modify-hook' or `erc-send-modify-hook'." - (unless (get-text-property (point-min) 'invisible) + (progn ; remove this `progn' on next major refactor (let* ((ct (erc-stamp--current-time)) + (invisible (get-text-property (point-min) 'invisible)) (erc-stamp--current-time ct)) - (funcall erc-insert-timestamp-function - (erc-format-timestamp ct erc-timestamp-format)) + (unless invisible + (funcall erc-insert-timestamp-function + (erc-format-timestamp ct erc-timestamp-format))) ;; FIXME this will error when advice has been applied. - (when (and (fboundp erc-insert-away-timestamp-function) + (when (and (not invisible) (fboundp erc-insert-away-timestamp-function) erc-away-timestamp-format (erc-away-time) (not erc-timestamp-format)) |
