changed concating file and dirs into expand-file-name, and other minor improvements

This commit is contained in:
Ian Griffin 2023-09-22 00:19:53 +08:00
parent efa4fd373e
commit 2a73871d40
12 changed files with 68 additions and 31 deletions

View File

@ -9,6 +9,10 @@ This configuration works best on a GNU/Linux Platform, other platforms are untes
Obviously, a full Emacs distribution needs to be installed.
Other external dependencies is (usually) specified in their configuration.
*** Mail
For RMail to work, a mail syncer like mbsync needs to be installed.
And for emacs RMail to be able to read mbsync maildir format, GNU Mailutils is also needed to be installed
*** Language Servers
For Language servers to work, the language servers needs to be installed separately, for example, in Fedora Linux, the required language servers can be installed by running the command below

View File

@ -22,8 +22,8 @@
;; as the writer has no access to actual news servers,
;; and so gnus is used as a mail reader instead of UUCP news
(require 'imap)
(setq gnus-select-method `
(nnimap ,(cdr (assoc 'name main-mail-server))
(setq gnus-select-method
`(nnimap ,(cdr (assoc 'name main-mail-server))
(nnimap-address ,(cdr (assoc 'imap-url main-mail-server)))
(nnimap-server-port ,(cdr (assoc 'imap-port main-mail-server)))
(nnimap-stream ,(cdr (assoc 'imap-stream main-mail-server)))
@ -31,8 +31,7 @@
gnus-secondary-select-methods
`((nnmaildir "local"
(directory
,(concat (safe-getenv "HOME" user-home-dir-path)
"/.local/mails/disroot/")))))
,(expand-file-name ".local/mails/disroot/" (safe-getenv "HOME" user-home-path))))))
;;
;; Demon

View File

@ -18,5 +18,5 @@
(let ((config-file-pattern "\\.org$"))
(mapc #'org-babel-load-file
(directory-files
(concat user-emacs-config-directory "/init.org.d")
(expand-file-name "init.org.d" user-emacs-config-directory)
t config-file-pattern)))

View File

@ -13,21 +13,21 @@ Functions needed at the start of the configuration
set the directory for emacs and it's apps to put stuff.
#+begin_src emacs-lisp
(setq user-emacs-directory
(concat (safe-getenv "XDG_DATA_HOME" "~/.local/share") "/emacs"))
(expand-file-name "emacs" (safe-getenv "XDG_DATA_HOME" "~/.local/share")))
#+end_src
* Custom File
This emacs feature is currently not used since a way to integrate this feature into this kind of configuration.
#+begin_src emacs-lisp
(setq custom-file (concat user-emacs-directory "/custom.el"))
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
#+end_src
* Personal File
This file stores variables containing personal information, and is not distributed.
A sample of this file though is included in this config to be used
#+begin_src emacs-lisp
(let ((personal-file-path (concat user-emacs-config-directory "/personal.org"))
(sample-personal-file-path (concat user-emacs-config-directory "/personal-sample.org")))
(let ((personal-file-path (expand-file-name "personal.org" user-emacs-config-directory))
(sample-personal-file-path (expand-file-name "/personal-sample.org" user-emacs-config-directory )))
;; load main personal file if it exists
(if (file-exists-p personal-file-path)

View File

@ -13,7 +13,7 @@ this speeds up emacs startup
** Set Package Directory
#+begin_src emacs-lisp
(setq package-user-dir (concat (safe-getenv "XDG_DATA_HOME" "~/.local/share") "/emacs/packages"))
(setq package-user-dir (expand-file-name "emacs/packages" (safe-getenv "XDG_DATA_HOME" "~/.local/share")))
#+end_src
** Add package sources

View File

@ -63,7 +63,7 @@ Make header and document title fonts bigger for better visibility.
:custom
(org-hide-emphasis-markers nil)
(org-agenda-files
`(,(concat (safe-getenv "HOME" user-home-path) "/shared/org")))
`(,(expand-file-name "shared/org" (safe-getenv "HOME" user-home-path))))
:config
;; font setup

View File

@ -8,7 +8,7 @@ this file/section configures the UI settings
#+begin_src emacs-lisp
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode 1)
(scroll-bar-mode -1)
#+end_src
* Maximize
@ -19,7 +19,24 @@ this file/section configures the UI settings
;; (add-hook 'window-setup-hook 'toggle-frame-maximized t)
#+END_SRC
* Window Size
Set the default window size when making a new frame
#+begin_src emacs-lisp
(defun set-window-size ()
(add-to-list 'default-frame-alist '(width . 80))
(add-to-list 'default-frame-alist '(height . 40))
(add-to-list 'initial-frame-alist '(width . 80))
(add-to-list 'initial-frame-alist '(height . 40)))
#+end_src
run the function at startup of a frame
#+begin_src emacs-lisp
(when (display-graphic-p)
(set-window-size))
(add-hook 'before-make-frame-hook 'set-window-size)
#+end_src
* Fringes
Fringes are the small gap at the side of emacs.

View File

@ -22,6 +22,13 @@ Tree-sitter Syntax Highlighting website]]
:after tree-sitter)
#+end_src
* Imenu-list
Imenu, the tool to get function names in source codes in emacs, displayed and constantly updated in a separate buffer
#+begin_src emacs-lisp
(use-package imenu-list
:commands (imenu-list-minor-mode))
#+end_src
* Neotree
Tree-based explorer for Emacs
@ -30,10 +37,11 @@ Tree-based explorer for Emacs
:hook (neotree-mode . (lambda ()
(setq mode-line-format nil)
(redraw-display)))
:config
(setq neo-theme 'arrows)
(setq neo-window-fixed-size nil)
(setq neo-smart-open t)
:custom
(neotheme 'arrows)
(neo-window-fixed-size t)
(neo-smart-open t)
(neo-window-width 22)
:bind
("M-0" . neotree-toggle))

View File

@ -22,7 +22,8 @@ machine smtp.example.com login jamie@example.com password verysecurepass port 58
* Gnus Config
Tell gnus to read ~gnus.el~ from the config dir.
#+begin_src emacs-lisp
(setq gnus-init-file (concat user-emacs-config-directory "/gnus.el"))
(setq gnus-init-file (expand-file-name "gnus.el" user-emacs-config-directory))
; (setq gnus-init-file "/home/iang/.config/emacs/gnus.el")
#+end_src
other configuration on gnus is on the ~gnus.el~ file.
@ -39,11 +40,11 @@ And those external programs are;
** Configuration
#+begin_src emacs-lisp
(setq rmail-primary-inbox-list
`( ,(concat "maildir://" (concat (safe-getenv "HOME" user-home-path) "/.local/mails/disroot/INBOX"))
`( ,(concat "maildir://" (expand-file-name ".local/mails/disroot/INBOX" (safe-getenv "HOME" user-home-path)))
"/var/spool/mail/iang")
rmail-preserve-inbox 1
rmail-mime-prefer-html nil
rmail-file-name (concat user-emacs-directory "/mails/inbox"))
rmail-file-name (expand-file-name "mails/inbox" user-emacs-directory))
#+end_src
* SMTP Mail Config

View File

@ -13,10 +13,7 @@
(company-mode))
#+end_src
* Built-in Modes
** hook default settings to configured language modes
#+begin_src emacs-lisp
(let ((langs '("sh" "c++" "mhtml" "java" "js" "python" "latex")))
@ -26,12 +23,12 @@
** add LSP server program names to eglot's configuration
#+begin_src emacs-lisp
(let ((server-programs '((c++-mode . ("clangd"))
(mhtml-mode . ("html-language-server"))
(java-mode . ("jdtls"))
(js-mode . ("typescript-language-server"))
(python-mode . ("pyright"))
(latex-mode . ("texlab")))))
(let ((server-programs '((c++-mode . ("clangd" "--stdio"))
(mhtml-mode . ("html-language-server" "--stdio"))
(java-mode . ("jdtls" "--stdio"))
(js-mode . ("typescript-language-server" "--stdio"))
(python-mode . ("pyright-langserver" "--stdio"))
(latex-mode . ("texlab" "--stdio")))))
(setq eglot-server-programs (append server-programs eglot-server-programs)))
#+end_src
@ -67,3 +64,13 @@
:init
(setq markdown-command "multimarkdown"))
#+end_src
** Python Pyenv
python venv manager
#+begin_src emacs-lisp
(use-package pyvenv
:commands (pyvenv-mode pyvenv-activate pyvenv-workon pyvenv-exec-shell pyvenv-virtual-env)
:hook (python-mode . pyvenv-mode))
#+end_src

View File

@ -121,7 +121,7 @@ Elfeed is a emacs package for reading RSS Web News.
elfeed
elfeed-update
:custom
(elfeed-db-directory (concat user-emacs-directory "/elfeed")
(elfeed-db-directory (expand-file-name "elfeed" user-emacs-directory)
"location for elfeed to put it's database")
(elfeed-feeds '(("https://feeds.bbci.co.uk/news/technology/rss.xml" bbc technology)
("https://feeds.feedburner.com/rsscna/engnews" taiwan central focustaiwan)

View File

@ -1,8 +1,9 @@
* Things to Improve in this configuration
** To Fix
- [ ] set chinese font
- [X] stop using custom file
- [X] separate font config
- [X] add optimizations ==> dolist
- [X] org-mode indentation
** Add
- [ ] use gnus
- [X] use gnus