Subject: bug#18992: 24.4; describe-mode

From: Drew Adams <[email-masked]>
Date: Sat, 8 Nov 2014 08:42:12 -0800 (PST)

> > However, in contrast to major-modes, minor mode names tend to be
> > much longer, so we can get some long lines like:
> >
> > Global-Edit-Server-Edit minor mode (`global-edit-server-edit-
> > mode'; no indicator):
> 
> Yes, that violates *Help* conventions.  It is better to use this
> (or similar): ...

Actually, we should do similarly for the major mode, even if major
mode names (including `mode-name') *tend* to be shorter.  It is good
behavior for functions printing unknown stuff to *Help* to ensure
that lines are not too long, when possible.

Something like this:

(princ " mode")
(let* ((mode       major-mode)
       (file-name  (find-lisp-object-file-name mode nil)))
  (when file-name
    (princ (concat " defined in `"
                   (file-name-nondirectory file-name) "'"))
    (with-current-buffer standard-output ; Hyperlink to library.
      (save-excursion (re-search-backward "`\\([^`']+\\)'" nil t)
                      (help-xref-button 1 'help-function-def
                                        mode file-name))))
  (with-current-buffer standard-output
    (insert (format " (`%s'):\n" mode))
    (save-excursion
      (fill-region-as-paragraph
        (line-beginning-position 0) (line-end-position 0) nil t t))))