2

I need to have Emacs open a terminal at start-up automatically (in order to use Fish in the terminal and use Emacs to for example search the Fish output).

Normally I do this with 'M-x term'.

Is there a way to make Emacs do this?

I tried adding (term) and (eshell) (as an alternative) in many combinations such as this one:

 1 (visual-line-mode 1)
  2 (global-display-line-numbers-mode 1)
  3 (scroll-bar-mode -1)
  4 (tool-bar-mode -1)
  5 (menu-bar-mode -1)
  6
  7 (require 'package)
  8 (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
  9                     (not (gnutls-available-p))))
 10        (proto (if no-ssl "http" "https")))
 11
 12   (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
 13   ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
 14   (when (< emacs-major-version 24)
 15     ;; For important compatibility libraries like cl-lib
 16     (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
 17 (package-initialize)
 18
 19 (custom-set-variables
 20  ;; custom-set-variables was added by Custom.
 21  ;; If you edit it by hand, you could mess it up, so be careful.
 22  ;; Your init file should contain only one such instance.
 23  ;; If there is more than one, they won't work right.
 24  '(custom-safe-themes
 25    (quote
 26     ("123dcd41949ac04ccbe3cab4caadec7bf0e01a6f85ffa23ff02c4102529b57dd" "53ba7affc1a77f85b89bb54bcc9fee688bab35d413db6309adfeca1890874395" "59e82a683db7129c0142b4b5a3\
    5dbbeaf8e01a4b81588f8c163bd255b76f4d21" default)))
 27  '(package-selected-packages (quote (cyberpunk-theme))))
 28 (custom-set-faces
 29  ;; custom-set-faces was added by Custom.
 30  ;; If you edit it by hand, you could mess it up, so be careful.
 31  ;; Your init file should contain only one such instance.
 32  ;; If there is more than one, they won't work right.
 33  )
 34
 35 (add-hook 'after-init-hook (lambda () (load-theme 'cyberpunk)))
 36
 37 (with-eval-after-load 'org
 38   (setq org-startup-indented t) ; Enable `org-indent-mode' by default
 39   (add-hook 'org-mode-hook #'visual-line-mode)
 40   (add-hook 'after-init-hook #'eshell))
 41
 42 (add-hook 'after-init-hook #'eshell)

This still opens nothing but the main screen anyway.

3

Start with Eshell:

(setq initial-buffer-choice #'eshell)

Start with running Bash in Term:

(setq initial-buffer-choice (lambda () (term "bash")))

C-h v initial-buffer-choice

If the value is a function, call it with no arguments and switch to the buffer that it returns.

  • Sorry, this does nothing too… The first and second one changed nothing and even when I saved the init.el with both of them together they still changed nothing. – F usedEmacs -con fused Jul 20 at 21:33
  • @FusedEmacs-confused You need to understand the variable initial-buffer-choice and some understanding of Emacs Lisp, it makes no sense to put them both to your init file since only the second will take effect. – xuchunyang Jul 20 at 23:19
  • Thank you, the second does not take effect (like I had said). – F usedEmacs -con fused Jul 21 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.