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