diff options
| author | F. Jason Park | 2023-04-10 00:08:37 -0700 |
|---|---|---|
| committer | F. Jason Park | 2023-04-10 13:42:29 -0700 |
| commit | 7c034f65fdca0293ba6c54f2574f12372a256183 (patch) | |
| tree | 3ccd482ffac63365f7c57117f8d674c0cede81aa | |
| parent | cb4f4dd89131e5a8956c788fee7ede65f13b2a69 (diff) | |
| download | emacs-7c034f65fdca0293ba6c54f2574f12372a256183.tar.gz emacs-7c034f65fdca0293ba6c54f2574f12372a256183.zip | |
Take better care when setting margins in erc-stamp
* lisp/erc/erc-stamp.el (erc-stamp--adjust-right-margin,
erc-stamp--display-margin-mode): Prefer setting
`fringes-outside-margins' to hiding right margin, and check whether
current buffer is showing before adjusting anything. (Bug#60936.)
| -rw-r--r-- | lisp/erc/erc-stamp.el | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index 8bca9bdb56b..61f289a8753 100644 --- a/lisp/erc/erc-stamp.el +++ b/lisp/erc/erc-stamp.el | |||
| @@ -302,10 +302,9 @@ or one col more than the `string-width' of | |||
| 302 | (current-time) | 302 | (current-time) |
| 303 | erc-timestamp-format))))) | 303 | erc-timestamp-format))))) |
| 304 | (+ right-margin-width cols)))) | 304 | (+ right-margin-width cols)))) |
| 305 | (setq right-margin-width width | 305 | (setq right-margin-width width) |
| 306 | right-fringe-width 0) | 306 | (when (eq (current-buffer) (window-buffer)) |
| 307 | (set-window-margins nil left-margin-width width) | 307 | (set-window-margins nil left-margin-width width)))) |
| 308 | (set-window-fringes nil left-fringe-width 0))) | ||
| 309 | 308 | ||
| 310 | ;;;###autoload | 309 | ;;;###autoload |
| 311 | (defun erc-stamp-prefix-log-filter (text) | 310 | (defun erc-stamp-prefix-log-filter (text) |
| @@ -344,6 +343,9 @@ message text so that stamps will be visible when yanked." | |||
| 344 | :interactive nil | 343 | :interactive nil |
| 345 | (if erc-stamp--display-margin-mode | 344 | (if erc-stamp--display-margin-mode |
| 346 | (progn | 345 | (progn |
| 346 | (setq fringes-outside-margins t) | ||
| 347 | (when (eq (current-buffer) (window-buffer)) | ||
| 348 | (set-window-buffer (selected-window) (current-buffer))) | ||
| 347 | (erc-stamp--adjust-right-margin 0) | 349 | (erc-stamp--adjust-right-margin 0) |
| 348 | (add-function :filter-return (local 'filter-buffer-substring-function) | 350 | (add-function :filter-return (local 'filter-buffer-substring-function) |
| 349 | #'erc--remove-text-properties) | 351 | #'erc--remove-text-properties) |
| @@ -354,9 +356,10 @@ message text so that stamps will be visible when yanked." | |||
| 354 | (remove-function (local 'erc-insert-timestamp-function) | 356 | (remove-function (local 'erc-insert-timestamp-function) |
| 355 | #'erc-stamp--display-margin-force) | 357 | #'erc-stamp--display-margin-force) |
| 356 | (kill-local-variable 'right-margin-width) | 358 | (kill-local-variable 'right-margin-width) |
| 357 | (kill-local-variable 'right-fringe-width) | 359 | (kill-local-variable 'fringes-outside-margins) |
| 358 | (set-window-margins nil left-margin-width nil) | 360 | (when (eq (current-buffer) (window-buffer)) |
| 359 | (set-window-fringes nil left-fringe-width nil))) | 361 | (set-window-margins nil left-margin-width nil) |
| 362 | (set-window-buffer (selected-window) (current-buffer))))) | ||
| 360 | 363 | ||
| 361 | (defun erc-insert-timestamp-left (string) | 364 | (defun erc-insert-timestamp-left (string) |
| 362 | "Insert timestamps at the beginning of the line." | 365 | "Insert timestamps at the beginning of the line." |