emacs display of page break char


Xah wrote:

• Usability Problems Of Emacs's Mode Documentation

On Feb 25, 7:04 am, "Drew Adams" wrote:
> > > * Get rid of convention of using ^L (ascii 12) for page break
> > > marker.
> > Is there a way to draw a sort of horizontal line for the ASCII 12
> > symbol instead of printing "^L"? I'm talking about X version.
> Yes.
> Code: http://www.emacswiki.org/emacs/pp-c-l.el
> Description: http://www.emacswiki.org/emacs/PrettyControlL
> You can customize the appearance.
> The screenshot shows the default appearance.

Thanks Drew and others.

I have currently these code:

;; code by Kevin Rodgers. 2009-02-25
(defun describe-major-mode ()
"Show inline doc for current major-mode."
(describe-function major-mode))

;; display page delimiter “^L” as a horizontal line. Code by Sébastien Vauban. 2009-02-25
(or standard-display-table
standard-display-table (make-display-table)))
(aset standard-display-table ?\f (vconcat "\n" (make-vector 60 ?-) "^L\n"))

;; Display the “^L” page break mark as a horizontal line
;; from http://www.emacswiki.org/emacs/OverlayControlL , 2009-02-25
;; code by Andre Riemann
(lambda ()
(font-lock-add-keywords nil
`((,page-delimiter ;; variable with the regexp (usually "^\f" or "^^L")
(prog1 nil
;; don't display ^L
(compose-region (match-beginning 0) (match-end 0) "")
;; make an overlay (like in hl-line)
(let ((pdl (make-overlay (line-beginning-position)
(line-beginning-position 2))))
;; :background has to be different from the background color
;; gray1 here is just a little different from black
(overlay-put pdl 'face '(:underline "gray30" :background "gray1"))
(overlay-put pdl 'modification-hooks
;; these arguments are received from modification-hooks
'((lambda (overlay after-p begin end &optional length)
(delete-overlay overlay))))
(overlay-put pdl 'insert-in-front-hooks
'((lambda (overlay after-p begin end &optional length)
(delete-overlay overlay)))))) t)))))

(haven't tried Drew's PrettyControlL, the Andre code i just tried first)

If people think this is a problem, please perhaps file a bug report to FSF. (Alt+x report-emacs-bug)

There are many diverse solutions on the web, but they need to become part of emacs out of the box.

∑ http://xahlee.org/


No comments:

Post a Comment