Update page-break-lines.el to latest version

This commit is contained in:
Maximilian Wolff 2020-02-24 12:02:18 +01:00
parent 5735221365
commit fcb79bf55b
No known key found for this signature in database
GPG key ID: 2DD07025BFDBD89A

View file

@ -63,26 +63,28 @@
:prefix "page-break-lines-" :prefix "page-break-lines-"
:group 'faces) :group 'faces)
;;;###autoload
(defcustom page-break-lines-char ?─ (defcustom page-break-lines-char ?─
"Character used to render page break lines." "Character used to render page break lines."
:type 'character :type 'character
:group 'page-break-lines) :group 'page-break-lines)
;;;###autoload
(defcustom page-break-lines-lighter " PgLn" (defcustom page-break-lines-lighter " PgLn"
"Mode-line indicator for `page-break-lines-mode'." "Mode-line indicator for `page-break-lines-mode'."
:type '(choice (const :tag "No lighter" "") string) :type '(choice (const :tag "No lighter" "") string)
:group 'page-break-lines) :group 'page-break-lines)
;;;###autoload (defcustom page-break-lines-max-width nil
"If non-nil, maximum width (in characters) of page break indicator.
If nil, indicator will span the width of the frame."
:type '(choice integer (const :tag "Full width" nil))
:group 'page-break-lines)
(defcustom page-break-lines-modes (defcustom page-break-lines-modes
'(emacs-lisp-mode lisp-mode scheme-mode compilation-mode outline-mode help-mode) '(emacs-lisp-mode lisp-mode scheme-mode compilation-mode outline-mode help-mode)
"Modes in which to enable `page-break-lines-mode'." "Modes in which to enable `page-break-lines-mode'."
:type '(repeat symbol) :type '(repeat symbol)
:group 'page-break-lines) :group 'page-break-lines)
;;;###autoload
(defface page-break-lines (defface page-break-lines
'((t :inherit font-lock-comment-face :bold nil :italic nil)) '((t :inherit font-lock-comment-face :bold nil :italic nil))
"Face used to colorize page break lines. "Face used to colorize page break lines.
@ -98,7 +100,7 @@ displayed as a junk character."
"Toggle Page Break Lines mode. "Toggle Page Break Lines mode.
In Page Break mode, page breaks (^L characters) are displayed as a In Page Break mode, page breaks (^L characters) are displayed as a
horizontal line of `page-break-string-char' characters." horizontal line of `page-break-lines-char' characters."
:lighter page-break-lines-lighter :lighter page-break-lines-lighter
:group 'page-break-lines :group 'page-break-lines
(page-break-lines--update-display-tables)) (page-break-lines--update-display-tables))
@ -133,11 +135,14 @@ its display table will be modified as necessary."
0))) 0)))
(width (- (/ wwidth-pix (frame-char-width) cwidth) (width (- (/ wwidth-pix (frame-char-width) cwidth)
(if (display-graphic-p) 0 1))) (if (display-graphic-p) 0 1)))
(width (if page-break-lines-max-width
(min width page-break-lines-max-width)
width))
(glyph (make-glyph-code page-break-lines-char 'page-break-lines)) (glyph (make-glyph-code page-break-lines-char 'page-break-lines))
(new-display-entry (vconcat (make-list width glyph)))) (new-display-entry (vconcat (make-list width glyph))))
(unless (equal new-display-entry (elt buffer-display-table ?\^L)) (unless (equal new-display-entry (elt buffer-display-table ?\^L))
(aset buffer-display-table ?\^L new-display-entry))))) (aset buffer-display-table ?\^L new-display-entry)))))
(when (and (member major-mode page-break-lines-modes) (when (and (apply 'derived-mode-p page-break-lines-modes)
buffer-display-table) buffer-display-table)
(aset buffer-display-table ?\^L nil)))))) (aset buffer-display-table ?\^L nil))))))
@ -165,10 +170,5 @@ When `major-mode' is listed in `page-break-lines-modes', then
(provide 'page-break-lines) (provide 'page-break-lines)
;; Local Variables:
;; coding: utf-8
;; checkdoc-minor-mode: t
;; End: ;; End:
;;; page-break-lines.el ends here ;;; page-break-lines.el ends here