From efa2d5e78e0c3e022344e175589e5045cb837ad9 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Sun, 6 Jul 2025 21:39:24 +0200 Subject: [PATCH] add autoloads --- early-init.el | 60 ++++++++++++++---- lisp/nerd-icons/nerd-icons-autoloads.el | 83 +++++++++++++++++++++++++ lisp/update-autoloads.el | 1 + 3 files changed, 133 insertions(+), 11 deletions(-) create mode 100644 lisp/nerd-icons/nerd-icons-autoloads.el diff --git a/early-init.el b/early-init.el index 378934e9..00f2d5e9 100644 --- a/early-init.el +++ b/early-init.el @@ -55,25 +55,43 @@ Fallbacks to `user-emacs-directory' if this file is not loaded.") ;; path where settings files are kept (add-to-list 'load-path (concat config-dir "settings")) ;; add personal elisp lib dir, for manually installed packages - (defun add-to-load-path-with-subdirs (base &optional exclude-list include-list autoloads) + (defun add-to-load-path-with-subdirs (base &optional exclude-list include-list) "This will add all first level dirs from BASE and exclude the ones in EXCLUDE-LIST, while for the dirs in INCLUDE-LIST, it will add all the first level dirs of that dir too. - Example: (add-to-list-with-subdirs \"~/.emacs.d\" '(\".\" \"..\" \"backup\") '(\"vendor\" \"my-lisp\"))" - (add-to-list 'load-path base) + Example: (add-to-load-path-with-subdirs \"~/.emacs.d\" '(\".\" \"..\" \"backup\") '(\"vendor\" \"my-lisp\"))" + (add-to-list 'load-path base t) ;; append so shipped packages are loaded first (dolist (f (directory-files base)) (let ((name (concat base "/" f))) (when (and (file-directory-p name) (not (member f exclude-list))) - (add-to-list 'load-path name) - (when autoloads - (let ((fileal (concat name "/" (file-name-base name) "-autoloads.el")) - (nameal (concat (file-name-base name) "-autoloads"))) - (when (file-exists-p fileal) - (require (intern nameal) fileal) ))) + (add-to-list 'load-path name t) ;; append so shipped packages are loaded first (when (member f include-list) (add-to-load-path-with-subdirs name exclude-list include-list)))))) - (add-to-load-path-with-subdirs (concat config-dir "lisp") '("." ".." "0patches") nil t)) + (add-to-load-path-with-subdirs (concat config-dir "lisp") '("." ".." "0patches") nil) + ;; load autoloads, not combined with function above because we need + ;; load-path filled first and then we can load all autoloads, to + ;; prevent loading parts from emacs buit-in packages. (for example + ;; one custom packages refences to org features but custom org is + ;; not yet in the load-path and therefore would load built-in org + ;; instead) + (defun load-autoloads (base &optional exclude-list include-list) + "This will load all autoloads from all first level dirs from BASE and + exclude the ones in EXCLUDE-LIST, while for the dirs in INCLUDE-LIST, + it will load all the first level dirs of that dir too. + Example: (load-autoloads \"~/.emacs.d\" '(\".\" \"..\" \"backup\") '(\"vendor\" \"my-lisp\"))" + (dolist (f (directory-files base)) + (let ((name (concat base "/" f))) + (when (and (file-directory-p name) + (not (member f exclude-list))) + (let ((fileal (concat name "/" (file-name-base name) "-autoloads.el")) + (nameal (concat (file-name-base name) "-autoloads"))) + (when (file-exists-p fileal) + (require (intern nameal) fileal) )) + (when (member f include-list) + (add-to-load-path-with-subdirs-autoloads name exclude-list include-list)))))) + (load-autoloads (concat config-dir "lisp") '("." ".." "0patches") nil) + ) ;;; Load pre-early-init.el @@ -440,7 +458,7 @@ startup phase.") (add-to-list 'initial-frame-alist '(background-color . "#1e1e1e")) (add-to-list 'initial-frame-alist '(foreground-color . "#b2b2b2")) -(when (display-graphic-p) +(when (featurep 'frame) ;; Custom functions/hooks for persisting/loading frame geometry upon save/load (defvar my-frame-geometry-file (concat user-cache-directory "frame-geometry.el")) (defun my-frame-geometry-save () @@ -506,6 +524,26 @@ startup phase.") ;;; Load post-early-init.el ;; (load (expand-file-name "post-early-init.el" user-emacs-directory) :no-error :no-message) +;; (setq use-default-font-for-symbols nil) +;; (defvar my-fontset +;; (create-fontset-from-fontset-spec standard-fontset-spec) +;; "Standard fontset for user.") +;; ;;(add-to-list 'default-frame-alist (cons 'font my-fontset)) +;; ;;(add-to-list 'initial-frame-alist (cons 'font my-fontset)) +;; (set-fontset-font my-fontset 'latin +;; (font-spec :family "NotoSansM Nerd Font Mono") +;; nil 'prepend) +;; (set-fontset-font my-fontset 'unicode +;; (font-spec :family "NotoSansM Nerd Font Mono") +;; nil 'prepend) +;; (dolist (charset '(kana han cjk-misc hangul kanbun bopomofo)) +;; (set-fontset-font my-fontset charset +;; (font-spec :family "Noto Sans Mono CJK SC") +;; nil 'prepend)) +;; (set-fontset-font my-fontset ?✿ (font-spec :family "Symbols Nerd Font Mono") nil 'prepend) + +;; (add-to-list 'default-frame-alist '(font . my-fontset)) + (provide 'early-init) diff --git a/lisp/nerd-icons/nerd-icons-autoloads.el b/lisp/nerd-icons/nerd-icons-autoloads.el new file mode 100644 index 00000000..2d571996 --- /dev/null +++ b/lisp/nerd-icons/nerd-icons-autoloads.el @@ -0,0 +1,83 @@ +;;; nerd-icons-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + +;;; Code: + +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + + + +;;; Generated autoloads from nerd-icons.el + +(autoload 'nerd-icons-install-fonts "nerd-icons" "\ +Helper function to download and install the latests fonts based on OS. +The provided Nerd Font is Symbols Nerd Font Mono. +When PFX is non-nil, ignore the prompt and just install + +(fn &optional PFX)" t) +(autoload 'nerd-icons-insert "nerd-icons" "\ +Interactive icon insertion function. +When Prefix ARG is non-nil, insert the propertized icon. +When GLYPH-SET is non-nil, limit the candidates to the icon set matching it. + +(fn &optional ARG GLYPH-SET)" t) +(autoload 'nerd-icons-icon-for-dir "nerd-icons" "\ +Get the formatted icon for DIR. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions. + +(fn DIR &rest ARG-OVERRIDES)") +(autoload 'nerd-icons-icon-for-file "nerd-icons" "\ +Get the formatted icon for FILE. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions. + +(fn FILE &rest ARG-OVERRIDES)") +(autoload 'nerd-icons-icon-for-extension "nerd-icons" "\ +Get the formatted icon for EXT. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions. + +(fn EXT &rest ARG-OVERRIDES)") +(autoload 'nerd-icons-icon-for-mode "nerd-icons" "\ +Get the formatted icon for MODE. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions. + +(fn MODE &rest ARG-OVERRIDES)") +(autoload 'nerd-icons-icon-for-url "nerd-icons" "\ +Get the formatted icon for URL. +If an icon for URL isn't found in `nerd-icons-url-alist', a globe is used. +ARG-OVERRIDES should be a plist containining `:height', +`:v-adjust' or `:face' properties like in the normal icon +inserting functions. + +(fn URL &rest ARG-OVERRIDES)") +(autoload 'nerd-icons-icon-for-buffer "nerd-icons" "\ +Get the formatted icon for the current buffer. + +This function prioritises the use of the buffers file extension to +discern the icon when its `major-mode' matches its auto mode, +otherwise it will use the buffers `major-mode' to decide its +icon.") +(register-definition-prefixes "nerd-icons" '("nerd-icons-")) + +;;; End of scraped data + +(provide 'nerd-icons-autoloads) + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; no-native-compile: t +;; coding: utf-8-emacs-unix +;; End: + +;;; nerd-icons-autoloads.el ends here diff --git a/lisp/update-autoloads.el b/lisp/update-autoloads.el index 38d26bc6..20438dcf 100644 --- a/lisp/update-autoloads.el +++ b/lisp/update-autoloads.el @@ -51,6 +51,7 @@ (package-generate-autoloads "ivy" (concat config-dir "lisp/ivy")) (package-generate-autoloads "ivy-rich" (concat config-dir "lisp/ivy-rich")) (package-generate-autoloads "my" (concat config-dir "lisp/my")) + (package-generate-autoloads "nerd-icons" (concat config-dir "lisp/nerd-icons")) (package-generate-autoloads "olivetti" (concat config-dir "lisp/olivetti")) ;; (package-generate-autoloads "org" (concat config-dir "lisp/org")) ;; already org-loaddefs.el (package-generate-autoloads "org-appear" (concat config-dir "lisp/org-appear"))