help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: usability problem of emacs describe-mode


From: Xah Lee
Subject: Re: usability problem of emacs describe-mode
Date: Wed, 25 Feb 2009 11:30:35 -0800 (PST)
User-agent: G2/1.0

On Feb 25, 7:04 am, "Drew Adams" <address@hidden> 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."
  (interactive)
  (describe-function major-mode))

;; display page delimiter “^L” as a horizontal line. Code by Sébastien
Vauban. 2009-02-25
(or standard-display-table
    (setq
     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
(add-hook
 'after-change-major-mode-hook
 (lambda ()
   (font-lock-add-keywords nil
    `((,page-delimiter ;; variable with the regexp (usually "^\f" or
"^^L")
        0
        (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 happened
to 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.

  Xah
∑ http://xahlee.org/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]