[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Term as a login shell
From: |
Robert Pluim |
Subject: |
Re: Term as a login shell |
Date: |
Mon, 15 Jul 2019 16:12:29 +0200 |
>>>>> On Mon, 15 Jul 2019 14:22:40 +0200, Ergus via help-gnu-emacs
>>>>> <help-gnu-emacs@gnu.org> said:
Ergus> Hi:
Ergus> I am using term, but some of my functionalities require the shell to
be
Ergus> a login shell (to use lmod for example).
Ergus> Usually we do that by passing the option `--login' to the shell
command,
Ergus> what's the proper way to start the normal `term' as a login shell by
Ergus> default?. An option I don't find in the manual maybe?
Ergus> multi-term has a variable called multi-term-program-switches, but I
Ergus> don't use multi-term.
Term doesnʼt have a user option for that, but itʼs easy enough to come
up with a variant of `term' that does the right thing:
(defun term-login (program)
(interactive (list (read-from-minibuffer "Run program: "
(or explicit-shell-file-name
(getenv "ESHELL")
shell-file-name))))
(set-buffer (make-term "terminal" program nil "--login"))
(term-mode)
(term-char-mode)
(switch-to-buffer "*terminal*"))
You can M-x report-emacs-bug to request that it be possible to either
specify a default set of switches to use, or that `term' be taught to
prompt for switches if called with a prefix argument or similar.
Robert