[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/page-break-lines 29f9314f8e 47/80: Handle the new native d
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/page-break-lines 29f9314f8e 47/80: Handle the new native display-line-number functionality |
Date: |
Tue, 5 Sep 2023 04:03:07 -0400 (EDT) |
branch: elpa/page-break-lines
commit 29f9314f8e7bd5ab087ff085d5f1d451a8549d43
Author: Steve Purcell <steve@sanityinc.com>
Commit: Steve Purcell <steve@sanityinc.com>
Handle the new native display-line-number functionality
Fixes #16
---
page-break-lines.el | 45 +++++++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 20 deletions(-)
diff --git a/page-break-lines.el b/page-break-lines.el
index d964a5b802..53cf9ea7bc 100644
--- a/page-break-lines.el
+++ b/page-break-lines.el
@@ -107,7 +107,8 @@ horizontal line of `page-break-string-char' characters."
(dolist (hook '(window-configuration-change-hook
window-size-change-functions
- after-setting-font-hook))
+ after-setting-font-hook
+ display-line-numbers-mode-hook))
(add-hook hook 'page-break-lines--update-display-tables))
@@ -117,28 +118,32 @@ horizontal line of `page-break-string-char' characters."
If the buffer inside WINDOW has `page-break-lines-mode' enabled,
its display table will be modified as necessary."
(with-current-buffer (window-buffer window)
- (if page-break-lines-mode
- (progn
- (unless buffer-display-table
- (setq buffer-display-table (make-display-table)))
- (let ((default-height (face-attribute 'default :height nil
'default)))
- (set-face-attribute 'page-break-lines nil :height default-height)
- (let* ((cwidth (char-width page-break-lines-char))
- (wwidth (window-width window))
- (width (if (zerop (% wwidth cwidth))
- (1- (/ wwidth cwidth))
- (/ wwidth cwidth)))
- (glyph (make-glyph-code page-break-lines-char
'page-break-lines))
- (new-display-entry (vconcat (make-list width glyph))))
- (unless (equal new-display-entry (elt buffer-display-table ?\^L))
- (aset buffer-display-table ?\^L new-display-entry)))))
- (when (and (member major-mode page-break-lines-modes)
- buffer-display-table)
- (aset buffer-display-table ?\^L nil)))))
+ (with-selected-window window
+ (if page-break-lines-mode
+ (progn
+ (unless buffer-display-table
+ (setq buffer-display-table (make-display-table)))
+ (let ((default-height (face-attribute 'default :height nil
'default)))
+ (set-face-attribute 'page-break-lines nil :height default-height)
+ (let* ((cwidth (char-width page-break-lines-char))
+ (wwidth (- (window-width)
+ (if (bound-and-true-p display-line-numbers)
+ (+ (line-number-display-width) 2)
+ 0)
+ (if (display-graphic-p) 0 1)))
+ (width (/ wwidth cwidth))
+ (glyph (make-glyph-code page-break-lines-char
'page-break-lines))
+ (new-display-entry (vconcat (make-list width glyph))))
+ (unless (equal new-display-entry (elt buffer-display-table
?\^L))
+ (aset buffer-display-table ?\^L new-display-entry)))))
+ (when (and (member major-mode page-break-lines-modes)
+ buffer-display-table)
+ (aset buffer-display-table ?\^L nil))))))
(defun page-break-lines--update-display-tables (&optional frame)
"Function called for updating display table in windows of FRAME."
- (mapc 'page-break-lines--update-display-table (window-list frame
'no-minibuffer)))
+ (unless (minibufferp)
+ (mapc 'page-break-lines--update-display-table (window-list frame
'no-minibuffer))))
- [nongnu] elpa/page-break-lines 614293efeb 56/80: Fix docstring reference to page-break-lines-char, (continued)
- [nongnu] elpa/page-break-lines 614293efeb 56/80: Fix docstring reference to page-break-lines-char, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines b8082232c5 45/80: Autoload customizable variables, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines 610dbdc9d3 51/80: Perform width calculations pixel-wise to increase accuracy, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines 913732ad06 49/80: Fix minor package-lint issues, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines 314b397910 67/80: Revert "Prefer set-display-table-slot to raw aset", ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines ba4f69f4af 69/80: Add README reference to Emacs “pages” and their bindings, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines 34cd91d841 73/80: Fix other link, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines e9fe243810 32/80: Prefer Package-Version header to Version, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines 2b8b800e1d 36/80: Merge pull request #8 from peniblec/mode-line-indicator, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines a550e8d534 65/80: Add CI, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines 29f9314f8e 47/80: Handle the new native display-line-number functionality,
ELPA Syncer <=
- [nongnu] elpa/page-break-lines 4e5034de4b 43/80: Adjust the length according to the width of page-break-lines-char, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines 6f19d894bd 59/80: Merge pull request #22 from camdez/max-width, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines 28783cd6b8 76/80: Replace deprecated function name in README, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines f8c4cd7fc6 68/80: Add Emacs 27.1 to CI, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines cff419b126 01/80: Initial commit, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines a74fba388e 04/80: Convert to separate minor-mode and global-minor-mode variants., ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines 24fee30edf 70/80: Merge pull request #32 from MicahElliott/master, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines d310e75652 05/80: Rename face from page-break-lines-face to page-break-lines, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines 58c0dd0ace 10/80: Add blog/twitter links, ELPA Syncer, 2023/09/05
- [nongnu] elpa/page-break-lines 908581b869 23/80: Shorten rule width slightly when word-wrap is on (see #5), ELPA Syncer, 2023/09/05