Mercurial > emacs
annotate lisp/eshell/em-banner.el @ 64244:118ee9a8f53a
Fix typos.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Tue, 12 Jul 2005 06:18:38 +0000 |
parents | 18a818a2ee7c |
children | 34bd8e434dd7 f9a65d7ebd29 |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
32526
diff
changeset
|
1 ;;; em-banner.el --- sample module that displays a login banner |
29876 | 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 | |
64085 | 21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 ;; Boston, MA 02110-1301, USA. | |
29876 | 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" | |
54566
b73ba8cc2d91
* eshell/em-banner.el (eshell-banner):
Juri Linkov <juri@jurta.org>
parents:
52401
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 | |
52401 | 92 ;;; arch-tag: e738b4ef-8671-42ae-a757-291779b92491 |
29876 | 93 ;;; em-banner.el ends here |