From ceb703a085b668676085d794124d69fd6ff52cf1 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Sun, 22 Jun 2025 23:02:25 +0200 Subject: [PATCH] add autoloads, clean up dashboard, load indent-guide for python --- settings/gui-settings.el | 108 +++++++++++++++------------------------ 1 file changed, 40 insertions(+), 68 deletions(-) diff --git a/settings/gui-settings.el b/settings/gui-settings.el index 46160ac9..566a0d0b 100644 --- a/settings/gui-settings.el +++ b/settings/gui-settings.el @@ -160,8 +160,13 @@ DISPLAY-START: `integer', e.g. 3820" (gnuplot-mode) (my-view-gnuplot)))) +;; not working +;; (when (display-graphic-p) +;; (setq mode-line-format nil)) + (use-package awesome-tray - ;;:after my-theme + :defer nil + :after my-theme :hook (after-init . awesome-tray-mode) :config (setq awesome-tray-info-padding-right 1) @@ -317,7 +322,8 @@ DISPLAY-START: `integer', e.g. 3820" :config (setq doc-view-continuous t)) -(use-package restart-emacs) +(use-package restart-emacs + :commands (restart-emacs restart-emacs-start-new-emacs)) (use-package page-break-lines :delight (page-break-lines-mode "Pb") ;; "\u24C5\uFF42" @@ -330,8 +336,9 @@ DISPLAY-START: `integer', e.g. 3820" :defer t) (use-package all-the-icons - :defer t + :defer nil :if (display-graphic-p) + :init (require 'all-the-icons-autoloads) :config (when (and (not (my-font-installed-p "all-the-icons")) (window-system)) @@ -340,8 +347,11 @@ DISPLAY-START: `integer', e.g. 3820" )) (use-package dashboard + :defer nil :delight (dashboard-mode "Db") ;; "\u01F153 - :hook (after-init . dashboard-setup-startup-hook) ;; activate `dashboard' + :after (all-the-icons) + :commands (dashboard-mode) + :init (require 'dashboard-autoloads) :config ;; see `dashboad-widget' (setq dashboard-icon-type 'all-the-icons) @@ -354,7 +364,9 @@ DISPLAY-START: `integer', e.g. 3820" (bookmarks . "bookmark") (agenda . "calendar") (projects . "rocket") - (registers . "database"))) + (registers . "database") + (custom . "versions") + )) (setq dashboard-startupify-list '(dashboard-insert-banner dashboard-insert-newline @@ -367,6 +379,21 @@ DISPLAY-START: `integer', e.g. 3820" dashboard-insert-items dashboard-insert-newline dashboard-insert-footer)) + (setq dashboard-items '(;; (recents . 10) ;; slow + (bookmarks . 5) + ;; (projects . 5) ;; projectile or project.el + ;; (agenda . 5) ;; will open org file (requires org-mode etc.) + (registers . 5) + (custom . 5) + )) + (setq dashboard-item-shortcuts + '((recents . "r") + (bookmarks . "m") + (projects . "p") + (agenda . "a") + (registers . "e") + (custom . "b"))) + (if (display-graphic-p) (let () (require 'all-the-icons) @@ -444,19 +471,7 @@ DISPLAY-START: `integer', e.g. 3820" ("" "My-Help" "my-help" (lambda (&rest _) (my-help)) dashboard-navigator "" "") ("" "Restart" "restart-emacs" (lambda (&rest _) (restart-emacs)) dashboard-navigator "" "") ))))) - (setq dashboard-items '((recents . 10) - (bookmarks . 5) - ;; (projects . 5) - (agenda . 5) - (registers . 5) - (custom . 5))) - (setq dashboard-item-shortcuts - '((recents . "r") - (bookmarks . "m") - (projects . "p") - (agenda . "a") - (registers . "e") - (custom . "b"))) + ;; because we use `use-package' include `use-package-statistics' if ;; computed (setq dashboard-init-info @@ -475,52 +490,9 @@ DISPLAY-START: `integer', e.g. 3820" (format "Emacs started in %s" time) (format "%d packages loaded in %s" package-count time))))) + ;; ;; custom section - - ;; overwrite to supress an inserted whitespace if a pre-defined - ;; heading is not found. This is used to include own icon, e.g. in - ;; front of executing `dashboard-insert-section'. - (defun dashboard-insert-heading (heading &optional shortcut) - "Insert a widget HEADING in dashboard buffer, adding SHORTCUT if provided." - (when (and (display-graphic-p) dashboard-set-heading-icons) - ;; Try loading `all-the-icons' - (unless (or (fboundp 'all-the-icons-octicon) - (require 'all-the-icons nil 'noerror)) - (error "Package `all-the-icons' isn't installed")) - - (insert (cond - ((string-equal heading "Recent Files:") - (all-the-icons-octicon (cdr (assoc 'recents dashboard-heading-icons)) - :height 1.2 :v-adjust 0.0 :face 'dashboard-heading)) - ((string-equal heading "Bookmarks:") - (all-the-icons-octicon (cdr (assoc 'bookmarks dashboard-heading-icons)) - :height 1.2 :v-adjust 0.0 :face 'dashboard-heading)) - ((or (string-equal heading "Agenda for today:") - (string-equal heading "Agenda for the coming week:")) - (all-the-icons-octicon (cdr (assoc 'agenda dashboard-heading-icons)) - :height 1.2 :v-adjust 0.0 :face 'dashboard-heading)) - ((string-equal heading "Registers:") - (all-the-icons-octicon (cdr (assoc 'registers dashboard-heading-icons)) - :height 1.2 :v-adjust 0.0 :face 'dashboard-heading)) - ((string-equal heading "Projects:") - (all-the-icons-octicon (cdr (assoc 'projects dashboard-heading-icons)) - :height 1.2 :v-adjust 0.0 :face 'dashboard-heading)) - ;; (t " "))) ;; REMOVED - (t ""))) ;; ADDED - (insert " ")) - - (insert (propertize heading 'face 'dashboard-heading)) - - ;; Turn the inserted heading into an overlay, so that we may freely change - ;; its name without breaking any of the functions that expect the default name. - ;; If there isn't a suitable entry in `dashboard-item-names', - ;; we fallback to using HEADING. In that case we still want it to be an - ;; overlay to maintain consistent behavior (such as the point movement) - ;; between modified and default headings. - (let ((ov (make-overlay (- (point) (length heading)) (point) nil t))) - (overlay-put ov 'display (or (cdr (assoc heading dashboard-item-names)) heading)) - (overlay-put ov 'face 'dashboard-heading)) - (when shortcut (insert (format " (%s)" shortcut)))) + ;; ;;; define functions for the section ;; `clean-buffer-list' @@ -556,11 +528,6 @@ If INTERNAL non-nil then include internal buffers." Example `dashboard-insert-recent'. See also `dashboard-insert-section' for the sequence of elements." - ;; insert icon - (when (display-graphic-p) - (insert (all-the-icons-octicon - "versions" - :height 1.2 :v-adjust 0.0 :face 'dashboard-heading))) (dashboard-insert-section "Special Buffers:" (my-buffer-name-list-special-only) ;; (my-buffer-name-list t) @@ -570,13 +537,18 @@ See also `dashboard-insert-section' for the sequence of elements." `(lambda (&rest _) (switch-to-buffer ,el)) (abbreviate-file-name el))) (add-to-list 'dashboard-item-generators '(custom . dashboard-insert-custom)) + + (dashboard-setup-startup-hook) + (dashboard-open) ) ;; too slow if all levels are displayed for a medium large file, ;; therefore not all levels and if toggled on and mode default off (use-package indent-guide :delight (indent-guide-mode "Ig") ;; "\u24BE\uFF47" + :commands (indent-guide-mode) ;;:hook (prog-mode . indent-guide-mode) ;; problem if used in notmuch + :hook (python-mode . indent-guide-mode) :config (set-face-attribute 'indent-guide-face nil :foreground "DarkSlateGray") ;; foreground #535353 ;;(setq indent-guide-char ":")