2013-09-12 20:15:53 +00:00
|
|
|
;;; em-banner.el --- sample module that displays a login banner -*- lexical-binding:t -*-
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2017-01-01 03:14:01 +00:00
|
|
|
;; Copyright (C) 1999-2017 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
|
2017-09-13 22:52:52 +00:00
|
|
|
;; along with GNU Emacs. If not, see <https://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
|
Silence many eshell compilation warnings
* lisp/eshell/em-tramp.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/em-xtra.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/esh-ext.el: Adjust requires.
(eshell-parse-command, eshell-close-handles): Autoload.
* lisp/eshell/esh-io.el: Adjust requires.
(eshell-output-filter): Autoload.
* lisp/eshell/esh-util.el: No need to load tramp when compiling.
(tramp-file-name-structure, ange-ftp-ls, ange-ftp-file-modtime): Declare.
(eshell-parse-ange-ls): Require ange-ftp and tramp.
* lisp/eshell/em-alias.el, lisp/eshell/em-banner.el, lisp/eshell/em-basic.el:
* lisp/eshell/em-cmpl.el, lisp/eshell/em-glob.el, lisp/eshell/em-pred.el:
* lisp/eshell/em-prompt.el, lisp/eshell/em-rebind.el, lisp/eshell/em-smart.el:
* lisp/eshell/em-term.el, lisp/eshell/esh-arg.el, lisp/eshell/esh-mode.el:
* lisp/eshell/esh-opt.el, lisp/eshell/esh-proc.el:
* lisp/eshell/esh-var.el: Adjust requires.
* lisp/eshell/eshell.el: Do not require esh-util twice.
(eshell-add-input-to-history): Declare.
(eshell-command): Check history module is active before using it.
2013-05-23 04:57:27 +00:00
|
|
|
(require 'cl-lib))
|
2007-12-05 06:59:48 +00:00
|
|
|
|
|
|
|
(require 'esh-util)
|
Silence many eshell compilation warnings
* lisp/eshell/em-tramp.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/em-xtra.el: Adjust requires.
(eshell-parse-command): Autoload.
* lisp/eshell/esh-ext.el: Adjust requires.
(eshell-parse-command, eshell-close-handles): Autoload.
* lisp/eshell/esh-io.el: Adjust requires.
(eshell-output-filter): Autoload.
* lisp/eshell/esh-util.el: No need to load tramp when compiling.
(tramp-file-name-structure, ange-ftp-ls, ange-ftp-file-modtime): Declare.
(eshell-parse-ange-ls): Require ange-ftp and tramp.
* lisp/eshell/em-alias.el, lisp/eshell/em-banner.el, lisp/eshell/em-basic.el:
* lisp/eshell/em-cmpl.el, lisp/eshell/em-glob.el, lisp/eshell/em-pred.el:
* lisp/eshell/em-prompt.el, lisp/eshell/em-rebind.el, lisp/eshell/em-smart.el:
* lisp/eshell/em-term.el, lisp/eshell/esh-arg.el, lisp/eshell/esh-mode.el:
* lisp/eshell/esh-opt.el, lisp/eshell/esh-proc.el:
* lisp/eshell/esh-var.el: Adjust requires.
* lisp/eshell/eshell.el: Do not require esh-util twice.
(eshell-add-input-to-history): Declare.
(eshell-command): Check history module is active before using it.
2013-05-23 04:57:27 +00:00
|
|
|
(require 'esh-mode)
|
|
|
|
(require 'eshell)
|
2007-12-05 06:59:48 +00:00
|
|
|
|
2008-05-21 03:51:08 +00:00
|
|
|
;;;###autoload
|
Replace eshell-defgroup with plain defgroup
Borrowing a trick from vc-sccs.el, wrap the defgroup in a progn
so that the whole thing ends up in the generated autoload file,
esh-groups.el.
* em-alias.el, em-banner.el, em-basic.el, em-cmpl.el, em-dirs.el:
* em-glob.el, em-hist.el, em-ls.el, em-pred.el, em-prompt.el:
* em-rebind.el, em-script.el, em-smart.el, em-term.el, em-unix.el:
* em-xtra.el: Replace eshell-defgroup with (progn (defgroup.
* eshell.el (eshell-defgroup): Remove alias.
2012-06-27 07:08:06 +00:00
|
|
|
(progn
|
|
|
|
(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")
|
Replace eshell-defgroup with plain defgroup
Borrowing a trick from vc-sccs.el, wrap the defgroup in a progn
so that the whole thing ends up in the generated autoload file,
esh-groups.el.
* em-alias.el, em-banner.el, em-basic.el, em-cmpl.el, em-dirs.el:
* em-glob.el, em-hist.el, em-ls.el, em-pred.el, em-prompt.el:
* em-rebind.el, em-script.el, em-smart.el, em-term.el, em-unix.el:
* em-xtra.el: Replace eshell-defgroup with (progn (defgroup.
* eshell.el (eshell-defgroup): Remove alias.
2012-06-27 07:08:06 +00:00
|
|
|
:group 'eshell-module))
|
2007-12-05 06:59:48 +00:00
|
|
|
|
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)
|
|
|
|
|
2011-03-05 04:11:05 +00:00
|
|
|
(defcustom eshell-banner-load-hook nil
|
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."
|
2011-03-05 04:11:05 +00:00
|
|
|
:version "24.1" ; removed eshell-banner-initialize
|
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
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(cl-assert eshell-mode)
|
|
|
|
(cl-assert eshell-banner-message)
|
2000-06-23 05:24:10 +00:00
|
|
|
(let ((msg (eval eshell-banner-message)))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(cl-assert msg)
|
2000-06-23 05:24:10 +00:00
|
|
|
(eshell-interactive-print 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
|