Mercurial > emacs
annotate lisp/eshell/em-banner.el @ 35454:9890c94c01ea
(isearch-lazy-highlight-initial-delay): Set default
to 0.25.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 22 Jan 2001 10:19:34 +0000 |
parents | 8e57189d61b4 |
children | 67b464da13ec |
rev | line source |
---|---|
29876 | 1 ;;; em-banner --- sample module that displays a login banner |
2 | |
29934
34b1ab9d583d
Change spelling of the Free Software Foundation.
Gerd Moellmann <gerd@gnu.org>
parents:
29876
diff
changeset
|
3 ;; Copyright (C) 1999, 2000 Free Software Foundation |
29876 | 4 |
32526 | 5 ;; Author: John Wiegley <johnw@gnu.org> |
6 | |
29876 | 7 ;; This file is part of GNU Emacs. |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
24 (provide 'em-banner) | |
25 | |
26 (eval-when-compile (require 'esh-maint)) | |
27 | |
28 (defgroup eshell-banner nil | |
29 "This sample module displays a welcome banner at login. | |
30 It exists so that others wishing to create their own Eshell extension | |
31 modules may have a simple template to begin with." | |
32 :tag "Login banner" | |
30275
009d92ce6f6c
(eshell-banner): Replace links to eshell.info with
Eli Zaretskii <eliz@gnu.org>
parents:
29934
diff
changeset
|
33 :link '(info-link "(eshell)Login banner") |
29876 | 34 :group 'eshell-module) |
35 | |
36 ;;; Commentary: | |
37 | |
38 ;; There is nothing to be done or configured in order to use this | |
39 ;; module, other than to select it by customizing the variable | |
40 ;; `eshell-modules-list'. It will then display a version information | |
41 ;; message whenever Eshell is loaded. | |
42 ;; | |
43 ;; This code is only an example of a how to write a well-formed | |
44 ;; extension module for Eshell. The better way to display login text | |
45 ;; is to use the `eshell-script' module, and to echo the desired | |
46 ;; strings from the user's `eshell-login-script' file. | |
47 ;; | |
48 ;; There is one configuration variable, which demonstrates how to | |
49 ;; properly define a customization variable in an extension module. | |
50 ;; In this case, it allows the user to change the string which | |
51 ;; displays at login time. | |
52 | |
53 ;;; User Variables: | |
54 | |
55 (defcustom eshell-banner-message "Welcome to the Emacs shell\n\n" | |
56 "*The banner message to be displayed when Eshell is loaded. | |
57 This can be any sexp, and should end with at least two newlines." | |
58 :type 'sexp | |
59 :group 'eshell-banner) | |
60 | |
61 (put 'eshell-banner-message 'risky-local-variable t) | |
62 | |
63 ;;; Code: | |
64 | |
65 (require 'esh-util) | |
66 | |
67 (defcustom eshell-banner-load-hook '(eshell-banner-initialize) | |
68 "*A list of functions to run when `eshell-banner' is loaded." | |
69 :type 'hook | |
70 :group 'eshell-banner) | |
71 | |
72 (defun eshell-banner-initialize () | |
73 "Output a welcome banner on initialization." | |
74 ;; it's important to use `eshell-interactive-print' rather than | |
75 ;; `insert', because `insert' doesn't know how to interact with the | |
76 ;; I/O code used by Eshell | |
77 (unless eshell-non-interactive-p | |
78 (assert eshell-mode) | |
79 (assert eshell-banner-message) | |
80 (let ((msg (eval eshell-banner-message))) | |
81 (assert msg) | |
82 (eshell-interactive-print msg)))) | |
83 | |
84 (eshell-deftest banner banner-displayed | |
85 "Startup banner is displayed at point-min" | |
86 (assert eshell-banner-message) | |
87 (let ((msg (eval eshell-banner-message))) | |
88 (assert msg) | |
89 (goto-char (point-min)) | |
90 (looking-at msg))) | |
91 | |
92 ;;; em-banner.el ends here |