comparison lisp/help-fns.el @ 91795:bfe257ff864c

2008-02-11 Drew Adams <drew.adams@oracle.com> * help.el (describe-key): Joined some split lines to facilitate filling. * help-fns.el (describe-function-1): Fill text of overlong lines.
author Bastien Guerry <bzg@altern.org>
date Tue, 12 Feb 2008 07:10:49 +0000
parents 107ccd98fa12
children a1afa11e3c51
comparison
equal deleted inserted replaced
91794:9eba563b95d7 91795:bfe257ff864c
265 ;; Get the real definition. 265 ;; Get the real definition.
266 (def (if (symbolp real-function) 266 (def (if (symbolp real-function)
267 (symbol-function real-function) 267 (symbol-function real-function)
268 function)) 268 function))
269 file-name string 269 file-name string
270 (beg (if (commandp def) "an interactive " "a "))) 270 (beg (if (commandp def) "an interactive " "a "))
271 (pt1 (with-current-buffer (help-buffer) (point))))
271 (setq string 272 (setq string
272 (cond ((or (stringp def) 273 (cond ((or (stringp def)
273 (vectorp def)) 274 (vectorp def))
274 "a keyboard macro") 275 "a keyboard macro")
275 ((subrp def) 276 ((subrp def)
346 (with-current-buffer standard-output 347 (with-current-buffer standard-output
347 (save-excursion 348 (save-excursion
348 (re-search-backward "`\\([^`']+\\)'" nil t) 349 (re-search-backward "`\\([^`']+\\)'" nil t)
349 (help-xref-button 1 'help-function-def real-function file-name)))) 350 (help-xref-button 1 'help-function-def real-function file-name))))
350 (princ ".") 351 (princ ".")
351 (terpri) 352 (with-current-buffer (help-buffer)
353 (fill-region-as-paragraph (save-excursion (goto-char pt1) (forward-line 0) (point))
354 (point)))
355 (terpri)(terpri)
352 (when (commandp function) 356 (when (commandp function)
357 (let ((pt2 (with-current-buffer (help-buffer) (point))))
353 (if (and (eq function 'self-insert-command) 358 (if (and (eq function 'self-insert-command)
354 (eq (key-binding "a") 'self-insert-command) 359 (eq (key-binding "a") 'self-insert-command)
355 (eq (key-binding "b") 'self-insert-command) 360 (eq (key-binding "b") 'self-insert-command)
356 (eq (key-binding "c") 'self-insert-command)) 361 (eq (key-binding "c") 'self-insert-command))
357 (princ "It is bound to many ordinary text characters.\n") 362 (princ "It is bound to many ordinary text characters.\n")
367 (princ "It is remapped to `") 372 (princ "It is remapped to `")
368 (princ (symbol-name remapped)) 373 (princ (symbol-name remapped))
369 (princ "'")) 374 (princ "'"))
370 375
371 (when keys 376 (when keys
372 (princ (if remapped " which is bound to " "It is bound to ")) 377 (princ (if remapped ", which is bound to " "It is bound to "))
373 ;; If lots of ordinary text characters run this command, 378 ;; If lots of ordinary text characters run this command,
374 ;; don't mention them one by one. 379 ;; don't mention them one by one.
375 (if (< (length non-modified-keys) 10) 380 (if (< (length non-modified-keys) 10)
376 (princ (mapconcat 'key-description keys ", ")) 381 (princ (mapconcat 'key-description keys ", "))
377 (dolist (key non-modified-keys) 382 (dolist (key non-modified-keys)
381 (princ (mapconcat 'key-description keys ", ")) 386 (princ (mapconcat 'key-description keys ", "))
382 (princ ", and many ordinary text characters")) 387 (princ ", and many ordinary text characters"))
383 (princ "many ordinary text characters")))) 388 (princ "many ordinary text characters"))))
384 (when (or remapped keys non-modified-keys) 389 (when (or remapped keys non-modified-keys)
385 (princ ".") 390 (princ ".")
386 (terpri))))) 391 (terpri))))
392 (with-current-buffer (help-buffer) (fill-region-as-paragraph pt2 (point)))
393 (terpri)))
387 (let* ((arglist (help-function-arglist def)) 394 (let* ((arglist (help-function-arglist def))
388 (doc (documentation function)) 395 (doc (documentation function))
389 (usage (help-split-fundoc doc function))) 396 (usage (help-split-fundoc doc function)))
390 (with-current-buffer standard-output 397 (with-current-buffer standard-output
391 ;; If definition is a keymap, skip arglist note. 398 ;; If definition is a keymap, skip arglist note.