Mercurial > hg > xemacs-beta
comparison lisp/help.el @ 2030:488b2f76d852
[xemacs-hg @ 2004-04-19 08:54:47 by stephent]
assorted improvements in ./lisp/
<87llkswdr6.fsf@tleepslib.sk.tsukuba.ac.jp>
<87pta4we6g.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Mon, 19 Apr 2004 08:54:50 +0000 |
parents | fb556d2c7344 |
children | 67e24d0cc80f |
comparison
equal
deleted
inserted
replaced
2029:7a9919388e87 | 2030:488b2f76d852 |
---|---|
459 | 459 |
460 (defvar help-buffer-list nil | 460 (defvar help-buffer-list nil |
461 "List of help buffers used by `help-register-and-maybe-prune-excess'") | 461 "List of help buffers used by `help-register-and-maybe-prune-excess'") |
462 | 462 |
463 (defun help-register-and-maybe-prune-excess (newbuf) | 463 (defun help-register-and-maybe-prune-excess (newbuf) |
464 "Register use of a help buffer and possibly kill any excess ones." | 464 "Register help buffer named NEWBUF and possibly kill excess ones." |
465 ;; don't let client code pass us bogus NEWBUF---if it gets in the list, | |
466 ;; help can become unusable | |
467 (unless (stringp newbuf) | |
468 (error 'wrong-type-argument "help buffer name must be string" newbuf)) | |
465 ;; remove new buffer from list | 469 ;; remove new buffer from list |
466 (setq help-buffer-list (remove newbuf help-buffer-list)) | 470 (setq help-buffer-list (remove newbuf help-buffer-list)) |
467 ;; maybe kill excess help buffers | 471 ;; maybe kill excess help buffers |
468 (if (and (integerp help-max-help-buffers) | 472 (if (and (integerp help-max-help-buffers) |
469 (> (length help-buffer-list) help-max-help-buffers)) | 473 (> (length help-buffer-list) help-max-help-buffers)) |
485 ;; push new buffer | 489 ;; push new buffer |
486 (setq help-buffer-list (cons newbuf help-buffer-list))) | 490 (setq help-buffer-list (cons newbuf help-buffer-list))) |
487 | 491 |
488 (defvar help-buffer-prefix-string "Help" | 492 (defvar help-buffer-prefix-string "Help" |
489 "Initial string to use in constructing help buffer names. | 493 "Initial string to use in constructing help buffer names. |
490 You should never set this directory, only let-bind it.") | 494 You should never set this directly, only let-bind it.") |
491 | 495 |
492 (defun help-buffer-name (name) | 496 (defun help-buffer-name (name) |
493 "Return a name for a Help buffer using string NAME for context." | 497 "Return a name for a Help buffer using string NAME for context." |
494 (if (and (integerp help-max-help-buffers) | 498 (if (and (integerp help-max-help-buffers) |
495 (> help-max-help-buffers 0) | 499 (> help-max-help-buffers 0) |
526 | 530 |
527 (make-variable-buffer-local 'help-window-config) | 531 (make-variable-buffer-local 'help-window-config) |
528 (put 'help-window-config 'permanent-local t) | 532 (put 'help-window-config 'permanent-local t) |
529 | 533 |
530 (defmacro with-displaying-temp-buffer (name &rest body) | 534 (defmacro with-displaying-temp-buffer (name &rest body) |
531 "Form which makes a help buffer with given NAME and evaluates BODY there. | 535 "Make a help buffer with given NAME and evaluate BODY, sending stdout there. |
532 | 536 |
533 Use this function for displaying information in temporary buffers, where the | 537 Use this function for displaying information in temporary buffers, where the |
534 user will typically view the information and then exit using | 538 user will typically view the information and then exit using |
535 \\<temp-buffer-mode-map>\\[help-mode-quit]. | 539 \\<temp-buffer-mode-map>\\[help-mode-quit]. |
536 | 540 |
537 The buffer is put into the mode specified in `mode-for-temp-buffer'." | 541 On exit from this form, the buffer is put into the mode specified in |
542 `mode-for-temp-buffer' and displayed, typically in a popup window. Ie, | |
543 the buffer is a scratchpad which is displayed all at once in formatted | |
544 form. | |
545 | |
546 N.B. Write to this buffer with functions like `princ', not `insert'." | |
538 `(let* ((winconfig (current-window-configuration)) | 547 `(let* ((winconfig (current-window-configuration)) |
539 (was-one-window (one-window-p)) | 548 (was-one-window (one-window-p)) |
540 (buffer-name ,name) | 549 (buffer-name ,name) |
541 (help-not-visible | 550 (help-not-visible |
542 (not (and (windows-of-buffer buffer-name) ;shortcut | 551 (not (and (windows-of-buffer buffer-name) ;shortcut |