2001-07-15 19:53:53 +00:00
|
|
|
;;; em-banner.el --- sample module that displays a login banner
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2011-01-25 04:08:28 +00:00
|
|
|
;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2000-10-16 12:27:09 +00:00
|
|
|
;; Author: John Wiegley <johnw@gnu.org>
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 03:36:21 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-06-23 05:24:10 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:36:21 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 03:36:21 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; There is nothing to be done or configured in order to use this
|
|
|
|
;; module, other than to select it by customizing the variable
|
|
|
|
;; `eshell-modules-list'. It will then display a version information
|
|
|
|
;; message whenever Eshell is loaded.
|
|
|
|
;;
|
|
|
|
;; This code is only an example of a how to write a well-formed
|
|
|
|
;; extension module for Eshell. The better way to display login text
|
|
|
|
;; is to use the `eshell-script' module, and to echo the desired
|
|
|
|
;; strings from the user's `eshell-login-script' file.
|
|
|
|
;;
|
|
|
|
;; There is one configuration variable, which demonstrates how to
|
|
|
|
;; properly define a customization variable in an extension module.
|
|
|
|
;; In this case, it allows the user to change the string which
|
|
|
|
;; displays at login time.
|
|
|
|
|
2007-12-05 06:59:48 +00:00
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(eval-when-compile
|
|
|
|
(require 'cl)
|
|
|
|
(require 'esh-mode)
|
|
|
|
(require 'eshell))
|
|
|
|
|
|
|
|
(require 'esh-util)
|
|
|
|
|
2008-05-21 03:51:08 +00:00
|
|
|
;;;###autoload
|
|
|
|
(eshell-defgroup eshell-banner nil
|
2007-12-05 06:59:48 +00:00
|
|
|
"This sample module displays a welcome banner at login.
|
|
|
|
It exists so that others wishing to create their own Eshell extension
|
|
|
|
modules may have a simple template to begin with."
|
|
|
|
:tag "Login banner"
|
|
|
|
;; :link '(info-link "(eshell)Login banner")
|
|
|
|
:group 'eshell-module)
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;; User Variables:
|
|
|
|
|
|
|
|
(defcustom eshell-banner-message "Welcome to the Emacs shell\n\n"
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 21:51:55 +00:00
|
|
|
"The banner message to be displayed when Eshell is loaded.
|
2000-06-23 05:24:10 +00:00
|
|
|
This can be any sexp, and should end with at least two newlines."
|
|
|
|
:type 'sexp
|
|
|
|
:group 'eshell-banner)
|
|
|
|
|
|
|
|
(put 'eshell-banner-message 'risky-local-variable t)
|
|
|
|
|
|
|
|
(defcustom eshell-banner-load-hook '(eshell-banner-initialize)
|
Cosmetic doc fixes for eshell.
* eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
* eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
* eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
* eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
* eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
* eshell/esh-cmd.el, eshell/esh-ext.el, eshell/esh-io.el:
* eshell/esh-mode.el, eshell/esh-proc.el, eshell/esh-test.el:
* eshell/esh-util.el, eshell/esh-var.el:
Remove leading `*' from docs of faces and defcustoms.
2010-09-25 21:51:55 +00:00
|
|
|
"A list of functions to run when `eshell-banner' is loaded."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'hook
|
|
|
|
:group 'eshell-banner)
|
|
|
|
|
|
|
|
(defun eshell-banner-initialize ()
|
|
|
|
"Output a welcome banner on initialization."
|
|
|
|
;; it's important to use `eshell-interactive-print' rather than
|
|
|
|
;; `insert', because `insert' doesn't know how to interact with the
|
|
|
|
;; I/O code used by Eshell
|
|
|
|
(unless eshell-non-interactive-p
|
|
|
|
(assert eshell-mode)
|
|
|
|
(assert eshell-banner-message)
|
|
|
|
(let ((msg (eval eshell-banner-message)))
|
|
|
|
(assert msg)
|
|
|
|
(eshell-interactive-print msg))))
|
|
|
|
|
|
|
|
(eshell-deftest banner banner-displayed
|
|
|
|
"Startup banner is displayed at point-min"
|
|
|
|
(assert eshell-banner-message)
|
|
|
|
(let ((msg (eval eshell-banner-message)))
|
|
|
|
(assert msg)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(looking-at msg)))
|
|
|
|
|
2007-12-05 06:59:48 +00:00
|
|
|
(provide 'em-banner)
|
|
|
|
|
2008-05-21 03:51:08 +00:00
|
|
|
;; Local Variables:
|
|
|
|
;; generated-autoload-file: "esh-groups.el"
|
|
|
|
;; End:
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;; em-banner.el ends here
|