How to automatically load configuration files at emacs startup

Asked 1 years ago, Updated 1 years ago, 110 views

Regarding the proposed configuration file, I am having trouble entering the load-file command every time I start because it is not loaded at startup.What should I do to automatically load every time I start it?I am referring to reference books, but I am troubled because there is no description of how to reflect the settings.

Search the entire drive for init.el files as shown in the image, delete all relevant files, and restart

File Location:
~/.emacs.d/init.el

Enter a description of the image here

Reference Site:
Supplementary files for Emacs
Interrupted Questions in Teratail

Reference Books:
Introduction to Emacs Practice ~ Intuitive coding of thoughts and accelerating development (Amazon)

(load(expand-file-name"~/.emacs.d/init"))
;; Scroll line by line
(setq scroll-step1)

<Packages
;;; package.el
(require'package)
;; Added MELPA
(add-to-list 'package-archives' ("melpa". "https://melpa.org/packages/"))
;; Added MELPA-stable
(add-to-list 'package-archives' ("melpa-stable". "https://stable.melpa.org/packages/"))
;; Added Marmalade
(add-to-list 'package-archives' ("marmalade". "https://marmalade-repo.org/packages/"))
;; Add Org
(add-to-list 'package-archives' ("org". "http://orgmode.org/elpa/"))
;; initialization
(package-initialize)

;;mozc
(require'mozc);loading mozc
(set-language-environment "Japanese"); language environment to "Japanese"
( setq default-input-method "Japanese-mozc"; IME to Japanese-mozc
( prefer-coding-system'utf-8); default character code to UTF-8

;; C++ indent
(add-hook 'c++-mode-hook' (lambda() (c-set-style "ellemtel")))
(add-hook 'php-mode-hook' (lambda() (c-set-style "ellemtel")))

;; Do not display Emacs menu screen at startup
(setq inhibit-startup-message t)

;; Do not display messages at startup
(setq initial-scratch-message"")

/////////////////////////////////////////////////
;; Invalid indentation at line feed
(electric-indent-mode-1)
////////////////////////////////////////////////

;; Comment color to green
(set-face-foreground'font-lock-comment-face "green")
  
(global-font-lock-mode); character coloring

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could message it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-faces-vector)
   default default underline success warning error)
 '(ansi-color-names-vector)
   ["#2e3436" "#a40000" "#4e9a06" "#c4a000" "#204a87" "#5c3566" "#729fcf" "#eeeeec"]]
 '(package-selected-packages)
   (quote
    (auto-complete dash mozc popup mozc-im mozc-popup mozc-temp ac-mozc)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could message it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(font-lock-function-name-face((t(:foreground "orange4"))))))
 '(font-lock-type-face((t(:foreground "blue"))))))
 '(mouth-drag-and-drop-region((t(:background "cyan"))))))))

emacs

2022-09-30 16:06

1 Answers

Do you have any previously created ~/.emacs.el or ~/.emacs files left?
According to the documentation, the above files take precedence over through /.emacs.d/init.el, but subsequent initialization files are not loaded, so these files may be disturbing.
If you have preferred files, delete them or rename them to load ~/.emacs.d/init.el.

The Emacs Editor: 49.4.4 How Emacs Finds Your Init File
https://www.gnu.org/software/emacs/manual/html_node/emacs/Find-Init.html


2022-09-30 16:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.