;;; 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