1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
;;; utils.el --- Utility functions and dashboard -*- lexical-binding: t -*-
;; Copyright (C) 2026 Cytrogen
;; This file contains:
;; - Custom dashboard and startup screen
;; - File and system utilities
;; - Diagnostic and troubleshooting functions
;; - General helper functions
;;; Commentary:
;; Collection of utility functions and the custom dashboard that provides
;; a GTD-focused startup experience.
;;; Code:
;; File Utilities
;; File operation helper functions
(defun my/open-init-file ()
"Open the Emacs init.el file."
(interactive)
(find-file user-init-file))
(defun my/reload-init-file ()
"Reload the Emacs init.el file."
(interactive)
(load-file user-init-file)
(message "Init file reloaded."))
;; Custom Dashboard
;; GTD-focused startup screen
(defun my/show-dashboard ()
"Display comprehensive Emacs manual/dashboard from manual.org."
(interactive)
(let ((buf (get-buffer-create "*Cytrogen's Home*"))
(manual-file (expand-file-name "manual.org" user-emacs-directory)))
(with-current-buffer buf
(let ((inhibit-read-only t))
(erase-buffer)
(if (file-exists-p manual-file)
(insert-file-contents manual-file)
(insert "#+TITLE: Emacs 使用指南\n\n")
(insert (format "manual.org 文件未找到: %s\n" manual-file)))
(org-mode)
(when (fboundp 'my/org-mode-visual-setup)
(my/org-mode-visual-setup))
(org-indent-mode 1)
(visual-line-mode 1)
(read-only-mode 1)
(org-overview)
(goto-char (point-min))
(while (and (not (eobp))
(get-char-property (point) 'invisible))
(forward-line 1))))
(switch-to-buffer buf)))
;; Dashboard startup configuration
(setq inhibit-startup-screen t)
(add-hook 'emacs-startup-hook #'my/show-dashboard)
;; System Diagnostics
;; Troubleshooting and status functions
;; General Utilities
;; Miscellaneous helper functions
(provide 'utils)
;;; utils.el ends here