push emacs

This commit is contained in:
The-Repo-Club 2023-08-28 16:47:04 +01:00
parent c6ac5c172b
commit a3e72311b3
No known key found for this signature in database
GPG Key ID: E30EC2FBFB05C44F
13 changed files with 2394 additions and 718 deletions

Binary file not shown.

View File

@ -1,220 +1,8 @@
(defvar elpaca-installer-version 0.5)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil
:files (:defaults (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
(default-directory repo))
(add-to-list 'load-path (if (file-exists-p build) build repo))
(unless (file-exists-p repo)
(make-directory repo t)
(when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (call-process "git" nil buffer t "clone"
(plist-get order :repo) repo)))
((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)")))
((require 'elpaca))
((elpaca-generate-autoloads "elpaca" repo)))
(progn (message "%s" (buffer-string)) (kill-buffer buffer))
(error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive))))
(unless (require 'elpaca-autoloads nil t)
(require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
(add-to-list 'load-path "~/.config/emacs/scripts/")
;; Install use-package support
(elpaca elpaca-use-package
;; Enable :elpaca use-package keyword.
(elpaca-use-package-mode)
;; Assume :elpaca t unless otherwise specified.
(setq elpaca-use-package-by-default t))
;; Block until current queue processed.
(elpaca-wait)
;;When installing a package which modifies a form used at the top-level
;;(e.g. a package which adds a use-package key word),
;;use `elpaca-wait' to block until that package has been installed/configured.
;;For example:
;;(use-package general :demand t)
;;(elpaca-wait)
;;Turns off elpaca-use-package-mode current declartion
;;Note this will cause the declaration to be interpreted immediately (not deferred).
;;Useful for configuring built-in emacs features.
;;(use-package emacs :elpaca nil :config (setq ring-bell-function #'ignore))
;; Don't install anything. Defer execution of BODY
;;(elpaca nil (message "deferred"))
;; Expands to: (elpaca evil (use-package evil :demand t))
(use-package evil
:init ;; tweak evil's configuration before loading it
(setq evil-want-integration t) ;; This is optional since it's already set to t by default.
(setq evil-want-keybinding nil)
(setq evil-vsplit-window-right t)
(setq evil-split-window-below t)
(evil-mode))
(use-package evil-collection
:after evil
:config
(setq evil-collection-mode-list '(dashboard dired ibuffer))
(evil-collection-init))
(use-package evil-tutor)
(use-package general
:config
(general-evil-setup)
;; set up 'SPC' as the global leader key
(general-create-definer repo/leader-keys
:states '(normal insert visual emacs)
:keymaps 'override
:prefix "SPC" ;; set leader
:global-prefix "M-SPC") ;; access leader in insert mode
(repo/leader-keys
"SPC" '(counsel-M-x :wk "Counsel M-x")
"." '(find-file :wk "Find file")
"f c" '((lambda () (interactive) (find-file "~/.config/emacs/config.org")) :wk "Edit emacs config")
"f r" '(counsel-recentf :wk "Find recent files")
"TAB TAB" '(comment-line :wk "Comment lines"))
(repo/leader-keys
"b" '(:ignore t :wk "Buffer")
"b b" '(switch-to-buffer :wk "Switch buffer")
"b i" '(ibuffer :wk "Ibuffer")
"b k" '(kill-this-buffer :wk "Kill this buffer")
"b n" '(next-buffer :wk "Next buffer")
"b p" '(previous-buffer :wk "Previous buffer")
"b r" '(revert-buffer :wk "Reload buffer"))
(repo/leader-keys
"d" '(:ignore t :wk "Dired")
"d d" '(dired :wk "Open dired")
"d j" '(dired-jump :wk "Dired jump to current")
"d n" '(neotree-dir :wk "Open directory in neotree")
"d p" '(peep-dired :wk "Peep-dired"))
(repo/leader-keys
"e" '(:ignore t :wk "Eshell/Evaluate")
"e b" '(eval-buffer :wk "Evaluate elisp in buffer")
"e d" '(eval-defun :wk "Evaluate defun containing or after point")
"e e" '(eval-expression :wk "Evaluate and elisp expression")
"e h" '(counsel-esh-history :which-key "Eshell history")
"e l" '(eval-last-sexp :wk "Evaluate elisp expression before point")
"e r" '(eval-region :wk "Evaluate elisp in region")
"e s" '(eshell :which-key "Eshell"))
(repo/leader-keys
"h" '(:ignore t :wk "Help")
"h f" '(describe-function :wk "Describe function")
"h t" '(load-theme :wk "Load theme")
"h v" '(describe-variable :wk "Describe variable")
"h r r" '((lambda () (interactive) (load-file "~/.config/emacs/init.el") (ignore (elpaca-process-queues))) :wk "Reload emacs config"))
(repo/leader-keys
"m" '(:ignore t :wk "Org")
"m a" '(org-agenda :wk "Org agenda")
"m e" '(org-export-dispatch :wk "Org export dispatch")
"m i" '(org-toggle-item :wk "Org toggle item")
"m t" '(org-todo :wk "Org todo")
"m B" '(org-babel-tangle :wk "Org babel tangle")
"m T" '(org-todo-list :wk "Org todo list"))
(repo/leader-keys
"m b" '(:ignore t :wk "Tables")
"m b -" '(org-table-insert-hline :wk "Insert hline in table"))
(repo/leader-keys
"m d" '(:ignore t :wk "Date/deadline")
"m d t" '(org-time-stamp :wk "Org time stamp"))
(repo/leader-keys
"p" '(projectile-command-map :wk "Projectile"))
(repo/leader-keys
"t" '(:ignore t :wk "Toggle")
"t e" '(eshell-toggle :wk "Toggle eshell")
"t l" '(display-line-numbers-mode :wk "Toggle line numbers")
"t n" '(neotree-toggle :wk "Toggle neotree file viewer")
"t t" '(visual-line-mode :wk "Toggle truncated lines")
"t v" '(vterm-toggle :wk "Toggle vterm"))
(repo/leader-keys
"w" '(:ignore t :wk "Windows")
;; Window splits
"w c" '(evil-window-delete :wk "Close window")
"w n" '(evil-window-new :wk "New window")
"w s" '(evil-window-split :wk "Horizontal split window")
"w v" '(evil-window-vsplit :wk "Vertical split window")
;; Window motions
"w h" '(evil-window-left :wk "Window left")
"w j" '(evil-window-down :wk "Window down")
"w k" '(evil-window-up :wk "Window up")
"w l" '(evil-window-right :wk "Window right")
"w w" '(evil-window-next :wk "Goto next window")
;; Move Windows
"w H" '(buf-move-left :wk "Buffer move left")
"w J" '(buf-move-down :wk "Buffer move down")
"w K" '(buf-move-up :wk "Buffer move up")
"w L" '(buf-move-right :wk "Buffer move right"))
)
(defun emacs-counsel-launcher ()
"Create and select a frame called emacs-counsel-launcher which consists only of a minibuffer and has specific dimensions. Runs counsel-linux-app on that frame, which is an emacs command that prompts you to select an app and open it in a dmenu like behaviour. Delete the frame after that command has exited"
(interactive)
(with-selected-frame
(make-frame '((name . "emacs-run-launcher")
(minibuffer . only)
(fullscreen . 0) ; no fullscreen
(undecorated . t) ; remove title bar
;;(auto-raise . t) ; focus on this frame
;;(tool-bar-lines . 0)
;;(menu-bar-lines . 0)
(internal-border-width . 10)
(width . 80)
(height . 11)))
(unwind-protect
(counsel-linux-app)
(delete-frame))))
(use-package app-launcher
:elpaca '(app-launcher :host github :repo "SebastienWae/app-launcher"))
;; create a global keyboard shortcut with the following code
;; emacsclient -cF "((visibility . nil))" -e "(emacs-run-launcher)"
(defun emacs-run-launcher ()
"Create and select a frame called emacs-run-launcher which consists only of a minibuffer and has specific dimensions. Runs app-launcher-run-app on that frame, which is an emacs command that prompts you to select an app and open it in a dmenu like behaviour. Delete the frame after that command has exited"
(interactive)
(with-selected-frame
(make-frame '((name . "emacs-run-launcher")
(minibuffer . only)
(fullscreen . 0) ; no fullscreen
(undecorated . t) ; remove title bar
;;(auto-raise . t) ; focus on this frame
;;(tool-bar-lines . 0)
;;(menu-bar-lines . 0)
(internal-border-width . 10)
(width . 80)
(height . 11)))
(unwind-protect
(app-launcher-run-app)
(delete-frame))))
(require 'elpaca-setup) ;; The Elpaca Package Manager
(require 'buffer-move) ;; Buffer-move for better window management
(require 'app-launchers) ;; Use emacs as a run launcher like dmenu (experimental)
(use-package all-the-icons
:ensure t
@ -223,74 +11,7 @@
(use-package all-the-icons-dired
:hook (dired-mode . (lambda () (all-the-icons-dired-mode t))))
(require 'windmove)
;;;###autoload
(defun buf-move-up ()
"Swap the current buffer and the buffer above the split.
If there is no split, ie now window above the current one, an
error is signaled."
;; "Switches between the current buffer, and the buffer above the
;; split, if possible."
(interactive)
(let* ((other-win (windmove-find-other-window 'up))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No window above this one")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-down ()
"Swap the current buffer and the buffer under the split.
If there is no split, ie now window under the current one, an
error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'down))
(buf-this-buf (window-buffer (selected-window))))
(if (or (null other-win)
(string-match "^ \\*Minibuf" (buffer-name (window-buffer other-win))))
(error "No window under this one")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-left ()
"Swap the current buffer and the buffer on the left of the split.
If there is no split, ie now window on the left of the current
one, an error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'left))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No left split")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-right ()
"Swap the current buffer and the buffer on the right of the split.
If there is no split, ie now window on the right of the current
one, an error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'right))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No right split")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
(setq backup-directory-alist '((".*" . "~/.Trash")))
(use-package company
:defer 2
@ -309,7 +30,7 @@ one, an error is signaled."
:hook (company-mode . company-box-mode))
(use-package dashboard
:ensure t
:ensure t
:init
(setq initial-buffer-choice 'dashboard-open)
(setq dashboard-set-heading-icons t)
@ -323,12 +44,11 @@ one, an error is signaled."
(bookmarks . 3)
(projects . 3)
(registers . 3)))
:config
(dashboard-setup-startup-hook)
:custom
(dashboard-modify-heading-icons '((recents . "file-text")
(bookmarks . "book"))))
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
(bookmarks . "book")))
:config
(dashboard-setup-startup-hook))
(use-package diminish)
@ -350,7 +70,21 @@ one, an error is signaled."
(evil-define-key 'normal peep-dired-mode-map (kbd "k") 'peep-dired-prev-file)
)
;;(add-hook 'peep-dired-hook 'evil-normalize-keymaps)
;; Expands to: (elpaca evil (use-package evil :demand t))
(use-package evil
:init ;; tweak evil's configuration before loading it
(setq evil-want-integration t ;; This is optional since it's already set to t by default.
evil-want-keybinding nil
evil-vsplit-window-right t
evil-split-window-below t
evil-undo-system 'undo-redo) ;; Adds vim-like C-r redo functionality
(evil-mode))
(use-package evil-collection
:after evil
:config
(setq evil-collection-mode-list '(dashboard dired ibuffer))
(evil-collection-init))
(use-package evil-tutor)
(use-package flycheck
:ensure t
@ -381,7 +115,7 @@ one, an error is signaled."
;; This sets the default font on all graphical frames created after restarting Emacs.
;; Does the same thing as 'set-face-attribute default' above, but emacsclient fonts
;; are not right unless I also add this method of setting the default font.
(add-to-list 'default-frame-alist '(font . "Hack Nerd Font Mono-11"))
(add-to-list 'default-frame-alist '(font . "JetBrains Mono-11"))
;; Uncomment the following line if line spacing needs adjusting.
(setq-default line-spacing 0.12)
@ -391,6 +125,144 @@ one, an error is signaled."
(global-set-key (kbd "<C-wheel-up>") 'text-scale-increase)
(global-set-key (kbd "<C-wheel-down>") 'text-scale-decrease)
(use-package general
:config
(general-evil-setup)
;; set up 'SPC' as the global leader key
(general-create-definer dt/leader-keys
:states '(normal insert visual emacs)
:keymaps 'override
:prefix "SPC" ;; set leader
:global-prefix "M-SPC") ;; access leader in insert mode
(dt/leader-keys
"SPC" '(counsel-M-x :wk "Counsel M-x")
"." '(find-file :wk "Find file")
"f c" '((lambda () (interactive) (find-file "~/.config/emacs/config.org")) :wk "Edit emacs config")
"f r" '(counsel-recentf :wk "Find recent files")
"TAB TAB" '(comment-line :wk "Comment lines"))
(dt/leader-keys
"b" '(:ignore t :wk "Bookmarks/Buffers")
"b c" '(clone-indirect-buffer :wk "Create indirect buffer copy in a split")
"b C" '(clone-indirect-buffer-other-window :wk "Clone indirect buffer in new window")
"b d" '(bookmark-delete :wk "Delete bookmark")
"b i" '(ibuffer :wk "Ibuffer")
"b k" '(kill-this-buffer :wk "Kill this buffer")
"b K" '(kill-some-buffers :wk "Kill multiple buffers")
"b l" '(list-bookmarks :wk "List bookmarks")
"b m" '(bookmark-set :wk "Set bookmark")
"b n" '(next-buffer :wk "Next buffer")
"b p" '(previous-buffer :wk "Previous buffer")
"b r" '(revert-buffer :wk "Reload buffer")
"b R" '(rename-buffer :wk "Rename buffer")
"b s" '(basic-save-buffer :wk "Save buffer")
"b S" '(save-some-buffers :wk "Save multiple buffers")
"b w" '(bookmark-save :wk "Save current bookmarks to bookmark file"))
(dt/leader-keys
"d" '(:ignore t :wk "Dired")
"d d" '(dired :wk "Open dired")
"d j" '(dired-jump :wk "Dired jump to current")
"d n" '(neotree-dir :wk "Open directory in neotree")
"d p" '(peep-dired :wk "Peep-dired"))
(dt/leader-keys
"e" '(:ignore t :wk "Eshell/Evaluate")
"e b" '(eval-buffer :wk "Evaluate elisp in buffer")
"e d" '(eval-defun :wk "Evaluate defun containing or after point")
"e e" '(eval-expression :wk "Evaluate and elisp expression")
"e h" '(counsel-esh-history :which-key "Eshell history")
"e l" '(eval-last-sexp :wk "Evaluate elisp expression before point")
"e r" '(eval-region :wk "Evaluate elisp in region")
"e s" '(eshell :which-key "Eshell"))
(dt/leader-keys
"h" '(:ignore t :wk "Help")
"h a" '(counsel-apropos :wk "Apropos")
"h b" '(describe-bindings :wk "Describe bindings")
"h c" '(describe-char :wk "Describe character under cursor")
"h d" '(:ignore t :wk "Emacs documentation")
"h d a" '(about-emacs :wk "About Emacs")
"h d d" '(view-emacs-debugging :wk "View Emacs debugging")
"h d f" '(view-emacs-FAQ :wk "View Emacs FAQ")
"h d m" '(info-emacs-manual :wk "The Emacs manual")
"h d n" '(view-emacs-news :wk "View Emacs news")
"h d o" '(describe-distribution :wk "How to obtain Emacs")
"h d p" '(view-emacs-problems :wk "View Emacs problems")
"h d t" '(view-emacs-todo :wk "View Emacs todo")
"h d w" '(describe-no-warranty :wk "Describe no warranty")
"h e" '(view-echo-area-messages :wk "View echo area messages")
"h f" '(describe-function :wk "Describe function")
"h F" '(describe-face :wk "Describe face")
"h g" '(describe-gnu-project :wk "Describe GNU Project")
"h i" '(info :wk "Info")
"h I" '(describe-input-method :wk "Describe input method")
"h k" '(describe-key :wk "Describe key")
"h l" '(view-lossage :wk "Display recent keystrokes and the commands run")
"h L" '(describe-language-environment :wk "Describe language environment")
"h m" '(describe-mode :wk "Describe mode")
"h r" '(:ignore t :wk "Reload")
"h r r" '((lambda () (interactive)
(load-file "~/.config/emacs/init.el")
(ignore (elpaca-process-queues)))
:wk "Reload emacs config")
"h t" '(load-theme :wk "Load theme")
"h v" '(describe-variable :wk "Describe variable")
"h w" '(where-is :wk "Prints keybinding for command if set")
"h x" '(describe-command :wk "Display full documentation for command"))
(dt/leader-keys
"m" '(:ignore t :wk "Org")
"m a" '(org-agenda :wk "Org agenda")
"m e" '(org-export-dispatch :wk "Org export dispatch")
"m i" '(org-toggle-item :wk "Org toggle item")
"m t" '(org-todo :wk "Org todo")
"m B" '(org-babel-tangle :wk "Org babel tangle")
"m T" '(org-todo-list :wk "Org todo list"))
(dt/leader-keys
"m b" '(:ignore t :wk "Tables")
"m b -" '(org-table-insert-hline :wk "Insert hline in table"))
(dt/leader-keys
"m d" '(:ignore t :wk "Date/deadline")
"m d t" '(org-time-stamp :wk "Org time stamp"))
(dt/leader-keys
"p" '(projectile-command-map :wk "Projectile"))
(dt/leader-keys
"t" '(:ignore t :wk "Toggle")
"t e" '(eshell-toggle :wk "Toggle eshell")
"t f" '(flycheck-mode :wk "Toggle flycheck")
"t l" '(display-line-numbers-mode :wk "Toggle line numbers")
"t n" '(neotree-toggle :wk "Toggle neotree file viewer")
"t r" '(rainbow-mode :wk "Toggle rainbow mode")
"t t" '(visual-line-mode :wk "Toggle truncated lines")
"t v" '(vterm-toggle :wk "Toggle vterm"))
(dt/leader-keys
"w" '(:ignore t :wk "Windows")
;; Window splits
"w c" '(evil-window-delete :wk "Close window")
"w n" '(evil-window-new :wk "New window")
"w s" '(evil-window-split :wk "Horizontal split window")
"w v" '(evil-window-vsplit :wk "Vertical split window")
;; Window motions
"w h" '(evil-window-left :wk "Window left")
"w j" '(evil-window-down :wk "Window down")
"w k" '(evil-window-up :wk "Window up")
"w l" '(evil-window-right :wk "Window right")
"w w" '(evil-window-next :wk "Goto next window")
;; Move Windows
"w H" '(buf-move-left :wk "Buffer move left")
"w J" '(buf-move-down :wk "Buffer move down")
"w K" '(buf-move-up :wk "Buffer move up")
"w L" '(buf-move-right :wk "Buffer move right"))
)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
@ -435,6 +307,15 @@ one, an error is signaled."
(use-package haskell-mode)
(use-package lua-mode)
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1)
:config
(setq doom-modeline-height 35 ;; sets modeline height
doom-modeline-bar-width 5 ;; sets right bar width
doom-modeline-persp-name t ;; adds perspective name to modeline
doom-modeline-persp-icon t)) ;; adds folder icon next to persp name
(use-package neotree
:config
(setq neo-smart-open t
@ -452,8 +333,6 @@ one, an error is signaled."
(make-local-variable 'auto-hscroll-mode)
(setq auto-hscroll-mode nil)))))
;; show hidden files
(use-package toc-org
:commands toc-org-enable
:init (add-hook 'org-mode-hook 'toc-org-enable))
@ -467,6 +346,15 @@ one, an error is signaled."
(eval-after-load 'org-indent '(diminish 'org-indent-mode))
(custom-set-faces
'(org-level-1 ((t (:inherit outline-1 :height 1.7))))
'(org-level-2 ((t (:inherit outline-2 :height 1.6))))
'(org-level-3 ((t (:inherit outline-3 :height 1.5))))
'(org-level-4 ((t (:inherit outline-4 :height 1.4))))
'(org-level-5 ((t (:inherit outline-5 :height 1.3))))
'(org-level-6 ((t (:inherit outline-5 :height 1.2))))
'(org-level-7 ((t (:inherit outline-5 :height 1.1)))))
(require 'org-tempo)
(use-package projectile
@ -524,23 +412,28 @@ one, an error is signaled."
;;(direction . bottom)
;;(dedicated . t) ;dedicated is supported in emacs27
(reusable-frames . visible)
(window-height . 0.3))))
(window-height . 0.4))))
(use-package sudo-edit
:config
(repo/leader-keys
(dt/leader-keys
"fu" '(sudo-edit-find-file :wk "Sudo find file")
"fU" '(sudo-edit :wk "Sudo edit file")))
(add-to-list 'custom-theme-load-path "~/.config/emacs/themes/")
(use-package doom-themes
:config
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t)) ; if nil, italics is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
;; Sets the default theme to load!!!
(load-theme 'doom-one t)
;; Enable custom neotree theme (all-the-icons must be installed!)
(doom-themes-neotree-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config))
(load-theme 'minimal-mistakes t)
(add-to-list 'default-frame-alist '(alpha-background . 90)) ; For all new frames henceforth
(add-to-list 'default-frame-alist '(alpha-background . 100)) ; For all new frames henceforth
(use-package which-key
:init
@ -548,7 +441,7 @@ one, an error is signaled."
:diminish
:config
(setq which-key-side-window-location 'bottom
which-key-sort-order #'which-key-key-order
which-key-sort-order #'which-key-key-order-alpha
which-key-allow-imprecise-window-fit nil
which-key-sort-uppercase-first nil
which-key-add-column-padding 1

View File

@ -1,24 +1,38 @@
#+TITLE: Repos's GNU Emacs Config
#+AUTHOR: Wayne Wesleu (Repo)
#+DESCRIPTION: Repo's personal Emacs config.
#+STARTUP: showeverything
#+OPTIONS: toc:2
- [[#buffer-move][BUFFER-MOVE]]
* TABLE OF CONTENTS :toc:
- [[#important-programs-to-load-first][IMPORTANT PROGRAMS TO LOAD FIRST]]
- [[#adding-the-scripts-directory-to-path][Adding the scripts directory to path]]
- [[#sourcing-the-scripts][Sourcing the scripts]]
- [[#all-the-icons][ALL THE ICONS]]
- [[#backup][BACKUP]]
- [[#company][COMPANY]]
- [[#dashboard][DASHBOARD]]
- [[#diminish][DIMINISH]]
- [[#dired][DIRED]]
- [[#evil][EVIL]]
- [[#flycheck][FLYCHECK]]
- [[#fonts][FONTS]]
- [[#setting-the-font-face][Setting the Font Face]]
- [[#zooming-inout][Zooming In/Out]]
- [[#general-keybindings][GENERAL KEYBINDINGS]]
- [[#graphical-user-interface-tweaks][GRAPHICAL USER INTERFACE TWEAKS]]
- [[#disable-menubar-toolbars-and-scrollbars][Disable Menubar, Toolbars and Scrollbars]]
- [[#display-line-numbers-and-truncated-lines][Display Line Numbers and Truncated Lines]]
- [[#ivy-counsel][IVY (COUNSEL)]]
- [[#language-support][LANGUAGE SUPPORT]]
- [[#modeline][MODELINE]]
- [[#neotree][NEOTREE]]
- [[#org-mode][ORG MODE]]
- [[#enabling-table-of-contents][Enabling Table of Contents]]
- [[#enabling-org-bullets][Enabling Org Bullets]]
- [[#disable-electric-indent][Disable Electric Indent]]
- [[#diminish-org-indent-mode][Diminish Org Indent Mode]]
- [[#org-level-headers][Org Level Headers]]
- [[#source-code-block-tag-expansion][Source Code Block Tag Expansion]]
- [[#projectile][PROJECTILE]]
- [[#rainbow-mode][RAINBOW MODE]]
@ -32,247 +46,18 @@
- [[#which-key][WHICH-KEY]]
* IMPORTANT PROGRAMS TO LOAD FIRST
** Elpaca Package Manager
To keep this =config.org= a reasonable length, I have moved a lot of code to individual scripts that will be sourced by this config. These scripts are found in "~/.config/emacs/scripts" and do not contain any code that most people are likely to need to edit.
** Adding the scripts directory to path
#+begin_src emacs-lisp
(defvar elpaca-installer-version 0.5)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil
:files (:defaults (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
(default-directory repo))
(add-to-list 'load-path (if (file-exists-p build) build repo))
(unless (file-exists-p repo)
(make-directory repo t)
(when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (call-process "git" nil buffer t "clone"
(plist-get order :repo) repo)))
((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)")))
((require 'elpaca))
((elpaca-generate-autoloads "elpaca" repo)))
(progn (message "%s" (buffer-string)) (kill-buffer buffer))
(error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive))))
(unless (require 'elpaca-autoloads nil t)
(require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
;; Install use-package support
(elpaca elpaca-use-package
;; Enable :elpaca use-package keyword.
(elpaca-use-package-mode)
;; Assume :elpaca t unless otherwise specified.
(setq elpaca-use-package-by-default t))
;; Block until current queue processed.
(elpaca-wait)
;;When installing a package which modifies a form used at the top-level
;;(e.g. a package which adds a use-package key word),
;;use `elpaca-wait' to block until that package has been installed/configured.
;;For example:
;;(use-package general :demand t)
;;(elpaca-wait)
;;Turns off elpaca-use-package-mode current declartion
;;Note this will cause the declaration to be interpreted immediately (not deferred).
;;Useful for configuring built-in emacs features.
;;(use-package emacs :elpaca nil :config (setq ring-bell-function #'ignore))
;; Don't install anything. Defer execution of BODY
;;(elpaca nil (message "deferred"))
(add-to-list 'load-path "~/.config/emacs/scripts/")
#+end_src
** Load Evil Mode
** Sourcing the scripts
#+begin_src emacs-lisp
;; Expands to: (elpaca evil (use-package evil :demand t))
(use-package evil
:init ;; tweak evil's configuration before loading it
(setq evil-want-integration t) ;; This is optional since it's already set to t by default.
(setq evil-want-keybinding nil)
(setq evil-vsplit-window-right t)
(setq evil-split-window-below t)
(evil-mode))
(use-package evil-collection
:after evil
:config
(setq evil-collection-mode-list '(dashboard dired ibuffer))
(evil-collection-init))
(use-package evil-tutor)
#+end_src
** General Keybindings
#+begin_src emacs-lisp
(use-package general
:config
(general-evil-setup)
;; set up 'SPC' as the global leader key
(general-create-definer repo/leader-keys
:states '(normal insert visual emacs)
:keymaps 'override
:prefix "SPC" ;; set leader
:global-prefix "M-SPC") ;; access leader in insert mode
(repo/leader-keys
"SPC" '(counsel-M-x :wk "Counsel M-x")
"." '(find-file :wk "Find file")
"f c" '((lambda () (interactive) (find-file "~/.config/emacs/config.org")) :wk "Edit emacs config")
"f r" '(counsel-recentf :wk "Find recent files")
"TAB TAB" '(comment-line :wk "Comment lines"))
(repo/leader-keys
"b" '(:ignore t :wk "Buffer")
"b b" '(switch-to-buffer :wk "Switch buffer")
"b i" '(ibuffer :wk "Ibuffer")
"b k" '(kill-this-buffer :wk "Kill this buffer")
"b n" '(next-buffer :wk "Next buffer")
"b p" '(previous-buffer :wk "Previous buffer")
"b r" '(revert-buffer :wk "Reload buffer"))
(repo/leader-keys
"d" '(:ignore t :wk "Dired")
"d d" '(dired :wk "Open dired")
"d j" '(dired-jump :wk "Dired jump to current")
"d n" '(neotree-dir :wk "Open directory in neotree")
"d p" '(peep-dired :wk "Peep-dired"))
(repo/leader-keys
"e" '(:ignore t :wk "Eshell/Evaluate")
"e b" '(eval-buffer :wk "Evaluate elisp in buffer")
"e d" '(eval-defun :wk "Evaluate defun containing or after point")
"e e" '(eval-expression :wk "Evaluate and elisp expression")
"e h" '(counsel-esh-history :which-key "Eshell history")
"e l" '(eval-last-sexp :wk "Evaluate elisp expression before point")
"e r" '(eval-region :wk "Evaluate elisp in region")
"e s" '(eshell :which-key "Eshell"))
(repo/leader-keys
"h" '(:ignore t :wk "Help")
"h f" '(describe-function :wk "Describe function")
"h t" '(load-theme :wk "Load theme")
"h v" '(describe-variable :wk "Describe variable")
"h r r" '((lambda () (interactive) (load-file "~/.config/emacs/init.el") (ignore (elpaca-process-queues))) :wk "Reload emacs config"))
(repo/leader-keys
"m" '(:ignore t :wk "Org")
"m a" '(org-agenda :wk "Org agenda")
"m e" '(org-export-dispatch :wk "Org export dispatch")
"m i" '(org-toggle-item :wk "Org toggle item")
"m t" '(org-todo :wk "Org todo")
"m B" '(org-babel-tangle :wk "Org babel tangle")
"m T" '(org-todo-list :wk "Org todo list"))
(repo/leader-keys
"m b" '(:ignore t :wk "Tables")
"m b -" '(org-table-insert-hline :wk "Insert hline in table"))
(repo/leader-keys
"m d" '(:ignore t :wk "Date/deadline")
"m d t" '(org-time-stamp :wk "Org time stamp"))
(repo/leader-keys
"p" '(projectile-command-map :wk "Projectile"))
(repo/leader-keys
"t" '(:ignore t :wk "Toggle")
"t e" '(eshell-toggle :wk "Toggle eshell")
"t l" '(display-line-numbers-mode :wk "Toggle line numbers")
"t n" '(neotree-toggle :wk "Toggle neotree file viewer")
"t t" '(visual-line-mode :wk "Toggle truncated lines")
"t v" '(vterm-toggle :wk "Toggle vterm"))
(repo/leader-keys
"w" '(:ignore t :wk "Windows")
;; Window splits
"w c" '(evil-window-delete :wk "Close window")
"w n" '(evil-window-new :wk "New window")
"w s" '(evil-window-split :wk "Horizontal split window")
"w v" '(evil-window-vsplit :wk "Vertical split window")
;; Window motions
"w h" '(evil-window-left :wk "Window left")
"w j" '(evil-window-down :wk "Window down")
"w k" '(evil-window-up :wk "Window up")
"w l" '(evil-window-right :wk "Window right")
"w w" '(evil-window-next :wk "Goto next window")
;; Move Windows
"w H" '(buf-move-left :wk "Buffer move left")
"w J" '(buf-move-down :wk "Buffer move down")
"w K" '(buf-move-up :wk "Buffer move up")
"w L" '(buf-move-right :wk "Buffer move right"))
)
#+end_src
* APP LAUNCHERS
** Counsel-Linux-App
Since we have counsel installed, we can use =counsel-linux-app= to launch our Linux apps. It list the apps by their executable command, so it's kind of tricky to use.
#+begin_src emacs-lisp
(defun emacs-counsel-launcher ()
"Create and select a frame called emacs-counsel-launcher which consists only of a minibuffer and has specific dimensions. Runs counsel-linux-app on that frame, which is an emacs command that prompts you to select an app and open it in a dmenu like behaviour. Delete the frame after that command has exited"
(interactive)
(with-selected-frame
(make-frame '((name . "emacs-run-launcher")
(minibuffer . only)
(fullscreen . 0) ; no fullscreen
(undecorated . t) ; remove title bar
;;(auto-raise . t) ; focus on this frame
;;(tool-bar-lines . 0)
;;(menu-bar-lines . 0)
(internal-border-width . 10)
(width . 80)
(height . 11)))
(unwind-protect
(counsel-linux-app)
(delete-frame))))
#+end_src
** App-Launcher
The =app-launcher= is a better run launcher since it reads the desktop applications on your system and you can search them by their names as defined in their desktop file. This means that sometimes you have to search for a generic term rather than the actual binary command of the program.
#+begin_src emacs-lisp
(use-package app-launcher
:elpaca '(app-launcher :host github :repo "SebastienWae/app-launcher"))
;; create a global keyboard shortcut with the following code
;; emacsclient -cF "((visibility . nil))" -e "(emacs-run-launcher)"
(defun emacs-run-launcher ()
"Create and select a frame called emacs-run-launcher which consists only of a minibuffer and has specific dimensions. Runs app-launcher-run-app on that frame, which is an emacs command that prompts you to select an app and open it in a dmenu like behaviour. Delete the frame after that command has exited"
(interactive)
(with-selected-frame
(make-frame '((name . "emacs-run-launcher")
(minibuffer . only)
(fullscreen . 0) ; no fullscreen
(undecorated . t) ; remove title bar
;;(auto-raise . t) ; focus on this frame
;;(tool-bar-lines . 0)
;;(menu-bar-lines . 0)
(internal-border-width . 10)
(width . 80)
(height . 11)))
(unwind-protect
(app-launcher-run-app)
(delete-frame))))
(require 'elpaca-setup) ;; The Elpaca Package Manager
(require 'buffer-move) ;; Buffer-move for better window management
(require 'app-launchers) ;; Use emacs as a run launcher like dmenu (experimental)
#+end_src
* ALL THE ICONS
@ -287,79 +72,12 @@ This is an icon set that can be used with dashboard, dired, ibuffer and other Em
:hook (dired-mode . (lambda () (all-the-icons-dired-mode t))))
#+end_src
* BUFFER-MOVE
Creating some functions to allow us to easily move windows (splits) around. The following block of code was taken from buffer-move.el found on the EmacsWiki:
https://www.emacswiki.org/emacs/buffer-move.el
* BACKUP
By default, Emacs creates automatic backups of files in their original directories, such "file.el" and the backup "file.el~". This leads to a lot of clutter, so let's tell Emacs to put all backups that it creates in the =TRASH= directory.
#+begin_src emacs-lisp
(require 'windmove)
(setq backup-directory-alist '((".*" . "~/.Trash")))
;;;###autoload
(defun buf-move-up ()
"Swap the current buffer and the buffer above the split.
If there is no split, ie now window above the current one, an
error is signaled."
;; "Switches between the current buffer, and the buffer above the
;; split, if possible."
(interactive)
(let* ((other-win (windmove-find-other-window 'up))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No window above this one")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-down ()
"Swap the current buffer and the buffer under the split.
If there is no split, ie now window under the current one, an
error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'down))
(buf-this-buf (window-buffer (selected-window))))
(if (or (null other-win)
(string-match "^ \\*Minibuf" (buffer-name (window-buffer other-win))))
(error "No window under this one")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-left ()
"Swap the current buffer and the buffer on the left of the split.
If there is no split, ie now window on the left of the current
one, an error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'left))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No left split")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-right ()
"Swap the current buffer and the buffer on the right of the split.
If there is no split, ie now window on the right of the current
one, an error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'right))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No right split")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
#+end_src
* COMPANY
@ -388,7 +106,7 @@ Emacs Dashboard is an extensible startup screen showing you recent files, bookma
#+begin_src emacs-lisp
(use-package dashboard
:ensure t
:ensure t
:init
(setq initial-buffer-choice 'dashboard-open)
(setq dashboard-set-heading-icons t)
@ -402,12 +120,12 @@ Emacs Dashboard is an extensible startup screen showing you recent files, bookma
(bookmarks . 3)
(projects . 3)
(registers . 3)))
:config
(dashboard-setup-startup-hook)
:custom
(dashboard-modify-heading-icons '((recents . "file-text")
(bookmarks . "book"))))
(bookmarks . "book")))
:config
(dashboard-setup-startup-hook))
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
#+end_src
* DIMINISH
@ -438,8 +156,27 @@ This package implements hiding or abbreviation of the modeline displays (lighter
(evil-define-key 'normal peep-dired-mode-map (kbd "k") 'peep-dired-prev-file)
)
;;(add-hook 'peep-dired-hook 'evil-normalize-keymaps)
#+end_src
* EVIL
[[https://github.com/emacs-evil/evil][Evil]] is an extensible vi/vim layer for Emacs. Because...let's face it. The Vim keybindings are just plain better.
#+begin_src emacs-lisp
;; Expands to: (elpaca evil (use-package evil :demand t))
(use-package evil
:init ;; tweak evil's configuration before loading it
(setq evil-want-integration t ;; This is optional since it's already set to t by default.
evil-want-keybinding nil
evil-vsplit-window-right t
evil-split-window-below t
evil-undo-system 'undo-redo) ;; Adds vim-like C-r redo functionality
(evil-mode))
(use-package evil-collection
:after evil
:config
(setq evil-collection-mode-list '(dashboard dired ibuffer))
(evil-collection-init))
(use-package evil-tutor)
#+end_src
* FLYCHECK
@ -482,7 +219,7 @@ Defining the various fonts that Emacs will use.
;; This sets the default font on all graphical frames created after restarting Emacs.
;; Does the same thing as 'set-face-attribute default' above, but emacsclient fonts
;; are not right unless I also add this method of setting the default font.
(add-to-list 'default-frame-alist '(font . "Hack Nerd Font Mono-11"))
(add-to-list 'default-frame-alist '(font . "JetBrains Mono-11"))
;; Uncomment the following line if line spacing needs adjusting.
(setq-default line-spacing 0.12)
@ -499,6 +236,147 @@ You can use the bindings CTRL plus =/- for zooming in/out. You can also use CTR
(global-set-key (kbd "<C-wheel-down>") 'text-scale-decrease)
#+end_src
* GENERAL KEYBINDINGS
#+begin_src emacs-lisp
(use-package general
:config
(general-evil-setup)
;; set up 'SPC' as the global leader key
(general-create-definer dt/leader-keys
:states '(normal insert visual emacs)
:keymaps 'override
:prefix "SPC" ;; set leader
:global-prefix "M-SPC") ;; access leader in insert mode
(dt/leader-keys
"SPC" '(counsel-M-x :wk "Counsel M-x")
"." '(find-file :wk "Find file")
"f c" '((lambda () (interactive) (find-file "~/.config/emacs/config.org")) :wk "Edit emacs config")
"f r" '(counsel-recentf :wk "Find recent files")
"TAB TAB" '(comment-line :wk "Comment lines"))
(dt/leader-keys
"b" '(:ignore t :wk "Bookmarks/Buffers")
"b c" '(clone-indirect-buffer :wk "Create indirect buffer copy in a split")
"b C" '(clone-indirect-buffer-other-window :wk "Clone indirect buffer in new window")
"b d" '(bookmark-delete :wk "Delete bookmark")
"b i" '(ibuffer :wk "Ibuffer")
"b k" '(kill-this-buffer :wk "Kill this buffer")
"b K" '(kill-some-buffers :wk "Kill multiple buffers")
"b l" '(list-bookmarks :wk "List bookmarks")
"b m" '(bookmark-set :wk "Set bookmark")
"b n" '(next-buffer :wk "Next buffer")
"b p" '(previous-buffer :wk "Previous buffer")
"b r" '(revert-buffer :wk "Reload buffer")
"b R" '(rename-buffer :wk "Rename buffer")
"b s" '(basic-save-buffer :wk "Save buffer")
"b S" '(save-some-buffers :wk "Save multiple buffers")
"b w" '(bookmark-save :wk "Save current bookmarks to bookmark file"))
(dt/leader-keys
"d" '(:ignore t :wk "Dired")
"d d" '(dired :wk "Open dired")
"d j" '(dired-jump :wk "Dired jump to current")
"d n" '(neotree-dir :wk "Open directory in neotree")
"d p" '(peep-dired :wk "Peep-dired"))
(dt/leader-keys
"e" '(:ignore t :wk "Eshell/Evaluate")
"e b" '(eval-buffer :wk "Evaluate elisp in buffer")
"e d" '(eval-defun :wk "Evaluate defun containing or after point")
"e e" '(eval-expression :wk "Evaluate and elisp expression")
"e h" '(counsel-esh-history :which-key "Eshell history")
"e l" '(eval-last-sexp :wk "Evaluate elisp expression before point")
"e r" '(eval-region :wk "Evaluate elisp in region")
"e s" '(eshell :which-key "Eshell"))
(dt/leader-keys
"h" '(:ignore t :wk "Help")
"h a" '(counsel-apropos :wk "Apropos")
"h b" '(describe-bindings :wk "Describe bindings")
"h c" '(describe-char :wk "Describe character under cursor")
"h d" '(:ignore t :wk "Emacs documentation")
"h d a" '(about-emacs :wk "About Emacs")
"h d d" '(view-emacs-debugging :wk "View Emacs debugging")
"h d f" '(view-emacs-FAQ :wk "View Emacs FAQ")
"h d m" '(info-emacs-manual :wk "The Emacs manual")
"h d n" '(view-emacs-news :wk "View Emacs news")
"h d o" '(describe-distribution :wk "How to obtain Emacs")
"h d p" '(view-emacs-problems :wk "View Emacs problems")
"h d t" '(view-emacs-todo :wk "View Emacs todo")
"h d w" '(describe-no-warranty :wk "Describe no warranty")
"h e" '(view-echo-area-messages :wk "View echo area messages")
"h f" '(describe-function :wk "Describe function")
"h F" '(describe-face :wk "Describe face")
"h g" '(describe-gnu-project :wk "Describe GNU Project")
"h i" '(info :wk "Info")
"h I" '(describe-input-method :wk "Describe input method")
"h k" '(describe-key :wk "Describe key")
"h l" '(view-lossage :wk "Display recent keystrokes and the commands run")
"h L" '(describe-language-environment :wk "Describe language environment")
"h m" '(describe-mode :wk "Describe mode")
"h r" '(:ignore t :wk "Reload")
"h r r" '((lambda () (interactive)
(load-file "~/.config/emacs/init.el")
(ignore (elpaca-process-queues)))
:wk "Reload emacs config")
"h t" '(load-theme :wk "Load theme")
"h v" '(describe-variable :wk "Describe variable")
"h w" '(where-is :wk "Prints keybinding for command if set")
"h x" '(describe-command :wk "Display full documentation for command"))
(dt/leader-keys
"m" '(:ignore t :wk "Org")
"m a" '(org-agenda :wk "Org agenda")
"m e" '(org-export-dispatch :wk "Org export dispatch")
"m i" '(org-toggle-item :wk "Org toggle item")
"m t" '(org-todo :wk "Org todo")
"m B" '(org-babel-tangle :wk "Org babel tangle")
"m T" '(org-todo-list :wk "Org todo list"))
(dt/leader-keys
"m b" '(:ignore t :wk "Tables")
"m b -" '(org-table-insert-hline :wk "Insert hline in table"))
(dt/leader-keys
"m d" '(:ignore t :wk "Date/deadline")
"m d t" '(org-time-stamp :wk "Org time stamp"))
(dt/leader-keys
"p" '(projectile-command-map :wk "Projectile"))
(dt/leader-keys
"t" '(:ignore t :wk "Toggle")
"t e" '(eshell-toggle :wk "Toggle eshell")
"t f" '(flycheck-mode :wk "Toggle flycheck")
"t l" '(display-line-numbers-mode :wk "Toggle line numbers")
"t n" '(neotree-toggle :wk "Toggle neotree file viewer")
"t r" '(rainbow-mode :wk "Toggle rainbow mode")
"t t" '(visual-line-mode :wk "Toggle truncated lines")
"t v" '(vterm-toggle :wk "Toggle vterm"))
(dt/leader-keys
"w" '(:ignore t :wk "Windows")
;; Window splits
"w c" '(evil-window-delete :wk "Close window")
"w n" '(evil-window-new :wk "New window")
"w s" '(evil-window-split :wk "Horizontal split window")
"w v" '(evil-window-vsplit :wk "Vertical split window")
;; Window motions
"w h" '(evil-window-left :wk "Window left")
"w j" '(evil-window-down :wk "Window down")
"w k" '(evil-window-up :wk "Window up")
"w l" '(evil-window-right :wk "Window right")
"w w" '(evil-window-next :wk "Goto next window")
;; Move Windows
"w H" '(buf-move-left :wk "Buffer move left")
"w J" '(buf-move-down :wk "Buffer move down")
"w K" '(buf-move-up :wk "Buffer move up")
"w L" '(buf-move-right :wk "Buffer move right"))
)
#+end_src
* GRAPHICAL USER INTERFACE TWEAKS
Let's make GNU Emacs look a little better.
@ -566,8 +444,24 @@ Emacs has built-in programming language modes for Lisp, Scheme, DSSSL, Ada, ASM,
(use-package lua-mode)
#+end_src
* MODELINE
The modeline is the bottom status bar that appears in Emacs windows. While you can create your own custom modeline, why go to the trouble when Doom Emacs already has a nice modeline package available. For more information on what is available to configure in the Doom modeline, check out: [[https://github.com/seagle0128/doom-modeline][Doom Modeline]]
#+begin_src emacs-lisp
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1)
:config
(setq doom-modeline-height 35 ;; sets modeline height
doom-modeline-bar-width 5 ;; sets right bar width
doom-modeline-persp-name t ;; adds perspective name to modeline
doom-modeline-persp-icon t)) ;; adds folder icon next to persp name
#+end_src
* NEOTREE
Neotree is a file tree viewer. When you open neotree, it jumps to the current file thanks to neo-smart-open. The neo-window-fixed-size setting makes the neotree width be adjustable. NeoTree provides following themes: classic, ascii, arrow, icons, and nerd. Theme can be configed by setting "two" themes for neo-theme: one for the GUI and one for the terminal. I like to use 'SPC t' for 'toggle' keybindings, so I have used 'SPC t n' for toggle-neotree.
Neotree is a file tree viewer. When you open neotree, it jumps to the current file thanks to neo-smart-open. The neo-window-fixed-size setting makes the neotree width be adjustable. NeoTree provides following themes: classic, ascii, arrow, icons, and nerd. Theme can be config'd by setting "two" themes for neo-theme: one for the GUI and one for the terminal. I like to use 'SPC t' for 'toggle' keybindings, so I have used 'SPC t n' for toggle-neotree.
| COMMAND | DESCRIPTION | KEYBINDING |
|----------------+---------------------------+------------|
@ -592,7 +486,6 @@ Neotree is a file tree viewer. When you open neotree, it jumps to the current f
(make-local-variable 'auto-hscroll-mode)
(setq auto-hscroll-mode nil)))))
;; show hidden files
#+end_src
* ORG MODE
@ -628,6 +521,18 @@ Removes "Ind" from showing in the modeline.
#+end_src
** Org Level Headers
#+begin_src emacs-lisp
(custom-set-faces
'(org-level-1 ((t (:inherit outline-1 :height 1.7))))
'(org-level-2 ((t (:inherit outline-2 :height 1.6))))
'(org-level-3 ((t (:inherit outline-3 :height 1.5))))
'(org-level-4 ((t (:inherit outline-4 :height 1.4))))
'(org-level-5 ((t (:inherit outline-5 :height 1.3))))
'(org-level-6 ((t (:inherit outline-5 :height 1.2))))
'(org-level-7 ((t (:inherit outline-5 :height 1.1)))))
#+end_src
** Source Code Block Tag Expansion
Org-tempo is not a separate package but a module within org that can be enabled. Org-tempo allows for '<s' followed by TAB to expand to a begin_src tag. Other expansions available include:
@ -730,7 +635,7 @@ Vterm is a terminal emulator within Emacs. The 'shell-file-name' setting sets t
;;(direction . bottom)
;;(dedicated . t) ;dedicated is supported in emacs27
(reusable-frames . visible)
(window-height . 0.3))))
(window-height . 0.4))))
#+end_src
* SUDO EDIT
@ -739,29 +644,34 @@ Vterm is a terminal emulator within Emacs. The 'shell-file-name' setting sets t
#+begin_src emacs-lisp
(use-package sudo-edit
:config
(repo/leader-keys
(dt/leader-keys
"fu" '(sudo-edit-find-file :wk "Sudo find file")
"fU" '(sudo-edit :wk "Sudo edit file")))
#+end_src
* THEME
The first of the two lines below designates the directory where will place all of our themes. The second line loads our chosen theme which is *repo-macs*, a theme that I created with the help of the [[https://emacsfodder.github.io/emacs-theme-editor/][Emacs Theme Editor]].
The first line below designates the directory where will place all of our custom-made themes, which I have created only one (dtmacs). You can create your own Emacs themes with the help of the [[https://emacsfodder.github.io/emacs-theme-editor/][Emacs Theme Editor]]. I am also installing =doom-themes= because it contains a huge collection of themes. M-x load-theme will list all of the themes available.
#+begin_src emacs-lisp
(add-to-list 'custom-theme-load-path "~/.config/emacs/themes/")
(use-package doom-themes
:config
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t)) ; if nil, italics is universally disabled
(load-theme 'minimal-mistakes t)
doom-themes-enable-italic t) ; if nil, italics is universally disabled
;; Sets the default theme to load!!!
(load-theme 'doom-one t)
;; Enable custom neotree theme (all-the-icons must be installed!)
(doom-themes-neotree-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config))
#+end_src
* TRANSPARENCY
With Emacs version 29, true transparency has been added.
With Emacs version 29, true transparency has been added. I have turned transparency off by setting the alpha to '100'. If you want some slight transparency, try setting alpha to '90'. Of course, if you set alpha to '0', the background of Emacs would completely transparent.
#+begin_src emacs-lisp
(add-to-list 'default-frame-alist '(alpha-background . 90)) ; For all new frames henceforth
(add-to-list 'default-frame-alist '(alpha-background . 100)) ; For all new frames henceforth
#+end_src
@ -773,7 +683,7 @@ With Emacs version 29, true transparency has been added.
:diminish
:config
(setq which-key-side-window-location 'bottom
which-key-sort-order #'which-key-key-order
which-key-sort-order #'which-key-key-order-alpha
which-key-allow-imprecise-window-fit nil
which-key-sort-uppercase-first nil
which-key-add-column-padding 1

View File

@ -2,3 +2,22 @@
(expand-file-name
"config.org"
user-emacs-directory))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
'("02f57ef0a20b7f61adce51445b68b2a7e832648ce2e7efb19d217b6454c1b644" "6945dadc749ac5cbd47012cad836f92aea9ebec9f504d32fe89a956260773ca4" "944d52450c57b7cbba08f9b3d08095eb7a5541b0ecfb3a0a9ecd4a18f3c28948" "636b135e4b7c86ac41375da39ade929e2bd6439de8901f53f88fde7dd5ac3561" "1f669e8abe4dc2855268c9a607b5e350e2811b3c5afd09af5939ff0c01a89c5a" default)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(org-level-1 ((t (:inherit outline-1 :height 1.7))))
'(org-level-2 ((t (:inherit outline-2 :height 1.6))))
'(org-level-3 ((t (:inherit outline-3 :height 1.5))))
'(org-level-4 ((t (:inherit outline-4 :height 1.4))))
'(org-level-5 ((t (:inherit outline-5 :height 1.3))))
'(org-level-6 ((t (:inherit outline-5 :height 1.2))))
'(org-level-7 ((t (:inherit outline-5 :height 1.1)))))

View File

@ -0,0 +1,55 @@
;;; app-launchers.el --- Possible alternatives to dmenu/rofi
;;; Code:
;; Counsel-Linux-App
;; Since we have counsel installed, we can use 'counsel-linux-app' to launch our Linux apps. It list the apps by their executable command, so it's kind of tricky to use.
(defun emacs-counsel-launcher ()
"Create and select a frame called emacs-counsel-launcher which consists only of a minibuffer and has specific dimensions. Runs counsel-linux-app on that frame, which is an emacs command that prompts you to select an app and open it in a dmenu like behaviour. Delete the frame after that command has exited"
(interactive)
(with-selected-frame
(make-frame '((name . "emacs-run-launcher")
(minibuffer . only)
(fullscreen . 0) ; no fullscreen
(undecorated . t) ; remove title bar
;;(auto-raise . t) ; focus on this frame
;;(tool-bar-lines . 0)
;;(menu-bar-lines . 0)
(internal-border-width . 10)
(width . 80)
(height . 11)))
(unwind-protect
(counsel-linux-app)
(delete-frame))))
;; App-Launcher
;; The 'app-launcher' is a better run launcher since it reads the desktop applications on your system and you can search them by their names as defined in their desktop file. This means that sometimes you have to search for a generic term rather than the actual binary command of the program.
(use-package app-launcher
:elpaca '(app-launcher :host github :repo "SebastienWae/app-launcher"))
;; create a global keyboard shortcut with the following code
;; emacsclient -cF "((visibility . nil))" -e "(emacs-run-launcher)"
(defun emacs-run-launcher ()
"Create and select a frame called emacs-run-launcher which consists only of a minibuffer and has specific dimensions. Runs app-launcher-run-app on that frame, which is an emacs command that prompts you to select an app and open it in a dmenu like behaviour. Delete the frame after that command has exited"
(interactive)
(with-selected-frame
(make-frame '((name . "emacs-run-launcher")
(minibuffer . only)
(fullscreen . 0) ; no fullscreen
(undecorated . t) ; remove title bar
;;(auto-raise . t) ; focus on this frame
;;(tool-bar-lines . 0)
;;(menu-bar-lines . 0)
(internal-border-width . 10)
(width . 80)
(height . 11)))
(unwind-protect
(app-launcher-run-app)
(delete-frame))))
(provide 'app-launchers)
;;; app-launchers.el ends here

View File

@ -0,0 +1,101 @@
;;; buffer-move.el --- Buffer move allows for better window controls.
;; Copyright (C) 2004-2014 Lucas Bonnet <lucas@rincevent.net.fr>
;; Author: Lucas Bonnet <lucas@rincevent.net>
;; Keywords: lisp,convenience
;; Version: 0.5
;; URL : https://github.com/lukhas/buffer-move
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 2
;; of the License, or (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
;; 02111-1307, USA.
;;; Commentary:
;; This file is for lazy people wanting to swap buffers without
;; typing C-x b on each window.
;;; Code:
(require 'windmove)
;;;###autoload
(defun buf-move-up ()
"Swap the current buffer and the buffer above the split.
If there is no split, ie now window above the current one, an
error is signaled."
;; "Switches between the current buffer, and the buffer above the
;; split, if possible."
(interactive)
(let* ((other-win (windmove-find-other-window 'up))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No window above this one")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-down ()
"Swap the current buffer and the buffer under the split.
If there is no split, ie now window under the current one, an
error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'down))
(buf-this-buf (window-buffer (selected-window))))
(if (or (null other-win)
(string-match "^ \\*Minibuf" (buffer-name (window-buffer other-win))))
(error "No window under this one")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-left ()
"Swap the current buffer and the buffer on the left of the split.
If there is no split, ie now window on the left of the current
one, an error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'left))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No left split")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-right ()
"Swap the current buffer and the buffer on the right of the split.
If there is no split, ie now window on the right of the current
one, an error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'right))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No right split")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
(provide 'buffer-move)
;;; buffer-move.el ends here

View File

@ -0,0 +1,702 @@
;;; dtos-start.el --- Some recipes for creating widgets
;; Copyright 2007 Ye Wenbin
;;
;; Author: wenbinye@gmail.com
;; Version: $Id: widget-demo.el,v 0.0 2007/11/13 17:50:14 ywb Exp $
;; Keywords:
;; X-URL: not distributed yet
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;; The widget document is not easy to understand. I think the
;; quick way to use widget is learning from examples. So I wrote
;; this library to help others understand and use widget quickly.
;;
;; I'm not expert at widget, so there may be something wrong in the
;; code. If you found it, please let me know.
;;
;;; Add New Page:
;; You can test you widget definition by add it as a new page to
;; widget demo. You can benefit from without write the code to
;; creating buffer and the key bindings of `widget-demo-mode'. Here is
;; a simple example to add new widget demo page:
;;
;; (defun widget-demo-tree-test ()
;; (widget-insert "Tree:\n")
;; (widget-create
;; '(tree-widget
;; :node (push-button :format "%[%t%]\n" :tag "hello")
;; :open t
;; (push-button :format "%[%t%]\n" :tag "node1")
;; (push-button :format "%[%t%]\n" :tag "node2"))))
;; (widget-demo-add-page "Tree Test" 'widget-demo-tree-test)
;;; TODO:
;; 1. Add tree-widget
;; 2. Add complex widget create by using several types of widget and
;; using group.
;; 3. Add tutorial about defining new widget
;; 4. Add a macro for simplified page definition. For example:
;; (widget-demo-insert
;; "Some text here"
;; (button :notify callback "label")
;; "More text"
;; (editable-field :form-id identifier))
;; Put this file into your load-path and the following into your ~/.emacs:
;; (autoload 'widget-demo "widget-demo" "Show demo of widget" t)
;;; Code:
(eval-when-compile
(require 'cl-lib))
(require 'info)
(require 'tree-widget)
(defvar widget-demo-buffer-name "*DTOS Info*"
"*Name of the widget demo buffer")
(defvar widget-demo-list
'(("Contents" widget-demo-contents :header "DTOS Info")
("Example" widget-demo-example :header "Example in info")
("WidgetTree" widget-tree :header "Programs")
("Button" widget-demo-button)
("Text" widget-demo-text)
("Choice" widget-demo-choice)
)
"A list of pages to show.")
(defvar widget-demo-current nil
"Current page in `widget-demo-list'.")
(defvar widget-demo-form nil
"A table for lookup widget created in current buffer.")
(defvar widget-demo-anchors nil
"A table for lookup markers created in current buffer.")
(defvar widget-demo-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map widget-keymap)
(define-key map "n" 'widget-demo-next)
(define-key map "p" 'widget-demo-previous)
(define-key map "u" 'widget-demo)
(define-key map "t" 'widget-demo)
(dolist (num (number-sequence ?1 ?9))
(define-key map (char-to-string num) 'widget-demo-goto-page))
;; this command may be helpful for debug
(define-key map "r" 'widget-demo-reflesh)
(define-key map "\C-c\C-s" 'widget-demo-show-source)
(define-key map "\C-c\C-n" 'widget-demo-next)
(define-key map "\C-c\C-p" 'widget-demo-previous)
(define-key map "\C-c\C-u" 'widget-demo)
(define-key map "\C-c\C-t" 'widget-demo)
map)
"Keymap to use in *DTOS Info* buffer.")
(defvar widget-demo-menu nil)
(unless widget-demo-menu
(easy-menu-define
widget-demo-menu widget-demo-mode-map "DTOS Info"
`("Widget"
["Next Page" widget-demo-next t]
["Previous Page" widget-demo-previous t]
["Top" widget-demo t]
["Refresh" widget-demo-reflesh t]
"--"
,@(mapcar (lambda (p)
(vector (car p) 'widget-demo-menu-goto t))
widget-demo-list))))
;;{{{ Helper functions
(defun widget-demo-menu-goto ()
(interactive)
(widget-demo-goto (symbol-name last-command-event)))
(defun widget-demo-form-create (id widget)
(if (assoc id widget-demo-form)
(error "identifier %S is used!" id)
(push (cons id widget) widget-demo-form)))
(defun widget-demo-form-add (id widget)
(let ((old (assoc id widget-demo-form)))
(if old
(setcdr old widget)
(push (cons id widget) widget-demo-form))))
(defun widget-demo-form-get (id)
(cdr (assoc id widget-demo-form)))
(defun widget-demo-create-anchor (anchor)
(push (cons anchor (point-marker)) widget-demo-anchors))
(defun widget-demo-resolve-link (name)
"Return the Next, Top, Next page."
(let* ((page (assoc name widget-demo-list))
(rest (member page widget-demo-list))
(len (length rest))
next previous)
;; the contents only list next
(if (eq page (car widget-demo-list))
(list (cadr widget-demo-list))
(if (= len 1)
(setq next nil)
(setq next (cadr rest)))
(setq previous (nth (- (length widget-demo-list) len 1)
widget-demo-list))
(list next (car widget-demo-list) previous))))
(defun widget-demo-add-page (&rest page)
"add new PAGE to widget-demo.
The page is constituted by
(PAGE-NAME PAGE-DEFINITION [KEYWORD VALUE]).
Current only keyword :header is supported, which value is a string
to display in menu and the header of buffer instead of the page-name."
(setq widget-demo-list
(append widget-demo-list (list page))))
(defun widget-demo-remove-page (name)
(setq widget-demo-list
(delq (assoc name widget-demo-list)
widget-demo-list)))
;;}}}
;;{{{ Commands
;;;###autoload
(defun dtos-demo ()
"Show widget demo."
(interactive)
(switch-to-buffer widget-demo-buffer-name)
(widget-demo-goto "Contents"))
(define-derived-mode widget-demo-mode nil "WDemo"
"Widget demo.
\\{widget-demo-mode-map}"
(make-local-variable 'widget-demo-form)
(make-local-variable 'widget-demo-anchors))
(defun widget-demo-goto (link)
(interactive
(list (completing-read "Goto: " widget-demo-list nil t)))
(switch-to-buffer widget-demo-buffer-name)
(widget-demo-mode)
(setq link (split-string link "#"))
(let* ((inhibit-read-only t)
(name (car link))
(anchor (cadr link))
(page (assoc name widget-demo-list)))
(erase-buffer)
(remove-overlays)
(setq widget-demo-current name)
;; insert buttons
(let ((links (widget-demo-resolve-link name))
(label '("Next" "Contents" "Prev")))
(dolist (link links)
(when link
(widget-create 'push-button
:format
(if (string= (car label) "Contents")
"%[Contents%]"
(format "%%t: %%[%s%%]" (car link)))
:button-face 'info-xref
:tag (car label)
:notify (lambda (wid &rest ignore)
(widget-demo-goto (widget-value wid)))
(car link))
(widget-insert " "))
(setq label (cdr label))))
;; insert title
(widget-insert "\n\n ")
(widget-insert
(propertize
(or (plist-get page :header) (car page))
'face 'info-title-1))
(widget-insert "\n\n")
(funcall (cadr page))
;; if there is an anchor, jump to the anchor
(if (and anchor
(setq anchor (assoc-default anchor widget-demo-anchors)))
(goto-char anchor)
(goto-char (point-min)))
(widget-setup)
(use-local-map widget-demo-mode-map)))
(defun widget-demo-next ()
(interactive)
(let ((links (widget-demo-resolve-link widget-demo-current)))
(if (car links)
(widget-demo-goto (caar links))
(message "No next pages!"))))
(defun widget-demo-previous ()
(interactive)
(let ((links (widget-demo-resolve-link widget-demo-current)))
(if (nth 2 links)
(widget-demo-goto (car (nth 2 links)))
(message "No previous pages!"))))
(defun widget-demo-goto-page ()
(interactive)
(let ((num (- last-command-event ?0)))
(if (< num (length widget-demo-list))
(widget-demo-goto (car (nth num widget-demo-list)))
(message "Only %d pages!" (length widget-demo-list)))))
(defun widget-demo-reflesh ()
(interactive)
(widget-demo-goto widget-demo-current))
(defun widget-demo-show-source ()
(interactive)
(let ((page (assoc widget-demo-current widget-demo-list)))
(with-selected-window
(display-buffer
(find-file-noselect (find-library-name "widget-demo")))
(imenu (symbol-name (cadr page)))
(recenter 1))))
;;}}}
;;{{{ Pages
(defun widget-demo-contents ()
(widget-insert "Here is the *widget-demo-contents* function in action.\n\n")
(let ((idx 1))
(dolist (page (cdr widget-demo-list))
(widget-insert (format "%3d. " idx))
(widget-create 'link
:format "%[%t%]"
:tag (or (plist-get page :header) (car page))
:button-prefix ""
:button-suffix ""
:notify (lambda (widget &rest ignore)
(widget-demo-goto (widget-value widget)))
(car page))
(widget-insert "\n")
(setq idx (1+ idx)))))
(defun widget-demo-example ()
(widget-insert "Here is some documentation.\n\n")
(widget-create 'editable-field
:size 13
:format "Name: %v " ; Text after the field!
"My Name")
(widget-create 'menu-choice
:tag "Choose"
:value "This"
:help-echo "Choose me, please!"
:notify (lambda (widget &rest ignore)
(message "%s is a good choice!"
(widget-value widget)))
'(item :tag "This option" :value "This")
'(choice-item "That option")
'(editable-field :menu-tag "No option" "Thus option"))
(widget-create 'editable-field
:format "Address: %v"
"Some Place\nIn some City\nSome country.")
(widget-insert "\nSee also ")
(widget-create 'link
:notify (lambda (&rest ignore)
(widget-value-set
(widget-demo-form-get 'repeat)
'("En" "To" "Tre"))
(widget-setup))
"other work")
(widget-insert
" for more information.\n\nNumbers: count to three below\n")
(widget-demo-form-create
'repeat
(widget-create 'editable-list
:entry-format "%i %d %v"
:notify (lambda (widget &rest ignore)
(let ((old (widget-get widget
':example-length))
(new (length (widget-value widget))))
(unless (eq old new)
(widget-put widget ':example-length new)
(message "You can count to %d." new))))
:value '("One" "Eh, two?" "Five!")
'(editable-field :value "three")))
(widget-insert "\n\nSelect multiple:\n\n")
(widget-create 'checkbox t)
(widget-insert " This\n")
(widget-create 'checkbox nil)
(widget-insert " That\n")
(widget-create 'checkbox
:notify (lambda (&rest ignore) (message "Tickle"))
t)
(widget-insert " Thus\n\nSelect one:\n\n")
(widget-create 'radio-button-choice
:value "One"
:notify (lambda (widget &rest ignore)
(message "You selected %s"
(widget-value widget)))
'(item "One") '(item "Another One.") '(item "A Final One."))
(widget-insert "\n")
(widget-create 'push-button
:notify (lambda (&rest ignore)
(if (= (length (widget-value (widget-demo-form-get 'repeat)))
3)
(message "Congratulation!")
(error "Three was the count!")))
"Apply Form")
(widget-insert " ")
(widget-create 'push-button
:notify (lambda (&rest ignore)
(widget-example))
"Reset Form")
(widget-insert "\n"))
(defun widget-demo-button ()
;; simplest button
(widget-insert "The action to perform when click button is set to :notify ")
(widget-create 'push-button
:notify (lambda (wid cwid &optional event)
(if event
(message "You click by mouse!")
(message "Got it!")))
"Push me")
;; better looking button
(widget-insert "\n\nYou can change the looking of the button by set :button-face and :format.\n")
(widget-create 'push-button
:format "This is %[ %t %] without prefix and suffix, and have different face.\n"
:button-face 'custom-button
:tag "button")
;; deactivate button
(widget-insert "\nWidget can be activated or deactivated.\n")
(widget-create 'toggle
:format "Turn %[%v%] the button: "
:button-face 'custom-button
:notify (lambda (wid &rest ignore)
(let ((but (widget-demo-form-get 'button)))
(if (widget-apply but :active)
(widget-apply but :deactivate)
(widget-apply but :activate))))
t)
(widget-demo-form-create
'button
(widget-create 'push-button
:format "%[%t%]\n"
:button-face 'custom-button
:tag "Button"
:notify (lambda (wid &rest ignore)
(message "Got it!"))))
(widget-apply (widget-demo-form-get 'button) :deactivate)
;; image button
(widget-insert "\nHere is a button which label is a image: ")
(widget-create 'push-button
:format "%[%t%]"
:tag-glyph (find-image `((:type xpm :file "refresh.xpm")))
:tag "image"
:notify (lambda (wid &rest ingore)
(message "Create new file!")))
;; link
(widget-insert "\nThe link to ")
(widget-create 'link
:button-prefix ""
:button-suffix ""
:button-face 'info-xref
:action (lambda (wid &rest ignore)
(widget-demo-goto "Choice#checklist"))
"checklist")
;; url-link
(widget-insert " in Choice page.\n")
(widget-insert "\nThe url-link to ")
(widget-create 'url-link
:button-prefix ""
:button-suffix ""
:format "%[emacswiki%]"
:button-face 'info-xref
"http://www.emacswiki.org")
(widget-insert "\n")
;; info-link
(widget-insert "\nThe link to info node ")
(widget-create 'info-link
:button-prefix ""
:button-suffix ""
:button-face 'info-xref
"widget"))
(defun widget-demo-text ()
;; simpliest
(widget-insert "A text field with label\n")
(widget-create 'editable-field
:format "Label: %v")
;; textfield size
(widget-insert "\nThe size of text field can limit by setting :size\n")
(widget-create 'editable-field
:format "Size 13: %v\n"
:size 13)
;; :notify
(widget-insert "\nYou can add callback when the text is changed.\n")
(widget-create 'editable-field
:notify (lambda (wid changed &rest ingore)
(message "Now the text is: %s" (widget-value changed))))
;; how to use :action
(widget-insert "\nIf you want do something when press enter, bind it to :action\n"
"Press Enter to change each other: ")
(widget-demo-form-create
'left
(widget-create 'editable-field
:action (lambda (wid &rest ignore)
(widget-demo-change-text wid 'right))
:size 13
"abc"))
(widget-insert " <=> ")
(widget-demo-form-create
'right
(widget-create 'editable-field
:action (lambda (wid &rest ignore)
(widget-demo-change-text wid 'left))
:size 13
"123"))
(widget-insert "\n")
;; password
(widget-insert "\nThe textfield can used for input password\n")
(widget-create 'editable-field
:format "Password: %v\n"
:secret ?*)
;; validate
(widget-insert "\nA regexp can set to validate the text\n")
(widget-create 'editable-field
:format "Tel: %v"
:valid-regexp "\\`\\s-*[0-9]+\\([0-9]+-\\)*[0-9]+\\s-*\\'"
:action (lambda (wid &rest ignore)
(if (widget-apply wid :validate)
(error "The telephone number is not valid: %s!" (widget-get wid :error))
(message "%s is ok!" (widget-value wid)))))
;; completion
(widget-insert "\nCompletion can set to :complete-function.\n"
"Try complete some symbols: ")
(widget-create 'editable-field
:complete-function 'lisp-complete-symbol)
(widget-insert (propertize (concat
"The default key to invoke completion is M-TAB, which is occupied in many window\n"
"manager. Note that widget-field-keymap is replaced by custom-field-keymap in \n"
"cus-edit.el(Line 4525). So if you want remap command widget-complete, define it\n"
"in custom-field-keymap.\n")
'face 'widget-inactive))
;; deactivate text
(widget-insert "\nClick the checkbox to activate the textfield.\n")
(widget-create 'checkbox
:notify (lambda (wid &rest ignore)
(let ((text (widget-demo-form-get 'text))
(but (widget-demo-form-get 'button)))
(if (widget-apply text :active)
(progn
(widget-apply text :deactivate)
(widget-apply but :deactivate))
(progn
(widget-apply text :activate)
(widget-apply but :activate))))))
(widget-demo-form-create
'text
(widget-create 'editable-field
:format "Text: %v "
:size 20))
(widget-apply (widget-demo-form-get 'text) :deactivate)
(widget-demo-form-create
'button
(widget-create 'push-button
:notify (lambda (wid &rest ignore)
(let ((text (widget-demo-form-get 'text))
start)
(save-excursion
(goto-char (widget-field-start text))
(forward-char (length (widget-value text)))
(insert "a"))))
"Append"))
(widget-apply (widget-demo-form-get 'button) :deactivate)
(widget-insert "\n")
;; text
(widget-insert "\nText is intended for multiline text.\n")
(widget-create 'text :format "Input text: %v")
;; editable list
(widget-insert "\nEditable list is use for edit a list. ")
(widget-create 'push-button
:format "%[%v%]\n"
:notify (lambda (wid &rest ignore)
(message "%S" (widget-value (widget-demo-form-get 'editable-list))))
"See Value")
(widget-demo-form-create
'editable-list
(widget-create 'editable-list
:foramt "%v %i %d\n"
:value '("1" "2" "3")
'(editable-field
:current-index 3
:value-to-external
(lambda (wid value)
(if (widget-get wid :parent)
value
(let ((idx (1+ (widget-get wid :current-index))))
(widget-put wid :current-index idx)
(number-to-string idx))))))))
;; maybe it is not work, because marker of :to is delete also
(defun widget-demo-change-text (wid id)
(let ((other (widget-demo-form-get id)))
(save-excursion
(goto-char (widget-field-start other))
(delete-region (point) (widget-field-end other))
(insert (widget-value wid)))))
(defun widget-demo-choice ()
;; menu choice
(widget-insert "Here is a menu choice. The label is set by :tag, and the default item is\n"
"the child item that :value match the :value of the menu choice.\n")
(widget-demo-form-create
'menu-choice
(widget-create 'menu-choice
:tag "Menu choices"
:button-face 'custom-button
:notify (lambda (wid &rest ignore)
(message "Current value: %S" (widget-value wid)))
:value 'const-variable
'(push-button :tag "button"
:format "%[%t%]\n"
:notify (lambda (wid &rest ignore)
(message "button activate"))
"This is button")
'(item :tag "item" :value "This is item")
'(choice-item :tag "choice" "This is choice item")
'(const :tag "const" const-variable)
'(editable-field :menu-tag "editable field" "text")))
;; toggle
(widget-insert "\nToggle is used for switch a flag: ")
(widget-create 'toggle
:on "turn on"
:off "turn off"
:notify (lambda (wid &rest ignore)
(message (concat "turn the option "
(if (widget-value wid) "on" "off"))))
t)
;; check box
(widget-insert "\nCheck box is like toggle: ")
(widget-create 'checkbox
:format "%[%v%] Option\n"
:notify (lambda (wid &rest ignore)
(message (concat "Option "
(if (widget-value wid)
"selected" "unselected"))))
t)
;; radio button
(widget-insert "\nRadio button is used for select one from a list.\n")
(widget-create 'radio-button-choice
:value "One"
:notify (lambda (wid &rest ignore)
(message "You select %S %s"
(widget-type wid)
(widget-value wid)))
'(item "One")
'(item "Two")
'(item "Three"))
(widget-insert "\n")
;; checklist
(widget-demo-create-anchor "checklist")
(widget-insert "Checklist is used for multiple choices from a list.\n")
(widget-create 'checklist
:notify (lambda (wid &rest ignore)
(message "The value is %S" (widget-value wid)))
'(item "one")
'(item "two")
'(item "three")))
;;}}}
;;{{{ Widget tree
(defun widget-tree-ancestor (widget)
(let ((parent (car (get widget 'widget-type))))
(if parent
(cons widget (widget-tree-ancestor parent)))))
(defvar widget-tree-list nil
"Inherit tree of all widget")
(defun widget-tree-build ()
(let (list seen ancestor tree-list)
(mapatoms (lambda (a)
(and (get a 'widget-type)
(push a list)))
obarray)
(setq list (remq 'default list))
(while list
(setq ancestor (nreverse (widget-tree-ancestor (car list))))
(setq parent 'default)
(dolist (type ancestor)
(unless (member type seen)
(setq alist (assoc parent tree-list)
tree-list (delq alist tree-list)
alist (cons parent (cons type (cdr alist)))
tree-list (cons alist tree-list)
list (delq type list))
(push type seen))
(setq parent type)))
(setq widget-tree-list tree-list)))
(defun widget-tree-browse (but &rest ignore)
(if (= (length (window-list)) 1)
(split-window))
(save-selected-window
(other-window 1)
(widget-browse (intern (widget-get but :tag)))))
(defun widget-tree-widget (type)
(let ((list (assoc type widget-tree-list)))
(if list
`(tree-widget
:node (push-button
:tag ,(symbol-name type)
:format "%[%t%]\n"
:notify widget-tree-browse)
:dynargs widget-tree-expand)
`(push-button
:format "%[%t%]\n"
:tag ,(symbol-name type)
:notify widget-tree-browse))))
(defun widget-tree-expand (tree)
(or (widget-get tree :args)
(let ((type (intern (widget-get (tree-widget-node tree) :tag))))
(mapcar 'widget-tree-widget
(cdr (assoc type widget-tree-list))))))
(defun widget-tree ()
(widget-insert
"This is a list of all defined widget. The tree-widget show the
inherit relationship of the widget.\n\n")
(widget-insert " You can click the button to browse the widget.\n\n")
(unless widget-tree-list
(widget-tree-build))
(widget-apply-action
(widget-create (widget-tree-widget 'default)))
(if (require 'tree-mode nil t)
(tree-minor-mode t)
(widget-insert "\n\n")
(widget-insert " I recommend you use ")
(widget-create 'url-link
:button-prefix ""
:button-suffix ""
:format "%[tree-mode%]"
:button-face 'info-xref
"http://www.emacswiki.org/cgi-bin/wiki/tree-mode.el")
(widget-insert " to browse tree-widget.\n\n")))
;;}}}
(provide 'dtos-demo)
;;; widget-demo.el ends here

View File

@ -0,0 +1,68 @@
;;; Code:
(defvar elpaca-installer-version 0.5)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil
:files (:defaults (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
(default-directory repo))
(add-to-list 'load-path (if (file-exists-p build) build repo))
(unless (file-exists-p repo)
(make-directory repo t)
(when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (call-process "git" nil buffer t "clone"
(plist-get order :repo) repo)))
((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)")))
((require 'elpaca))
((elpaca-generate-autoloads "elpaca" repo)))
(kill-buffer buffer)
(error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive))))
(unless (require 'elpaca-autoloads nil t)
(require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
;; Install use-package support
(elpaca elpaca-use-package
;; Enable :elpaca use-package keyword.
(elpaca-use-package-mode)
;; Assume :elpaca t unless otherwise specified.
(setq elpaca-use-package-by-default t))
;; Block until current queue processed.
(elpaca-wait)
;;When installing a package which modifies a form used at the top-level
;;(e.g. a package which adds a use-package key word),
;;use `elpaca-wait' to block until that package has been installed/configured.
;;For example:
;;(use-package general :demand t)
;;(elpaca-wait)
;;Turns off elpaca-use-package-mode current declartion
;;Note this will cause the declaration to be interpreted immediately (not deferred).
;;Useful for configuring built-in emacs features.
;;(use-package emacs :elpaca nil :config (setq ring-bell-function #'ignore))
;; Don't install anything. Defer execution of BODY
;;(elpaca nil (message "deferred"))
(provide 'elpaca-setup)
;;; elpaca-setup.el ends here

View File

@ -0,0 +1,701 @@
;;; widget-demo.el --- Some recipes for creating widgets
;; Copyright 2007 Ye Wenbin
;;
;; Author: wenbinye@gmail.com
;; Version: $Id: widget-demo.el,v 0.0 2007/11/13 17:50:14 ywb Exp $
;; Keywords:
;; X-URL: not distributed yet
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;; The widget document is not easy to understand. I think the
;; quick way to use widget is learning from examples. So I wrote
;; this library to help others understand and use widget quickly.
;;
;; I'm not expert at widget, so there may be something wrong in the
;; code. If you found it, please let me know.
;;
;;; Add New Page:
;; You can test you widget definition by add it as a new page to
;; widget demo. You can benefit from without write the code to
;; creating buffer and the key bindings of `widget-demo-mode'. Here is
;; a simple example to add new widget demo page:
;;
;; (defun widget-demo-tree-test ()
;; (widget-insert "Tree:\n")
;; (widget-create
;; '(tree-widget
;; :node (push-button :format "%[%t%]\n" :tag "hello")
;; :open t
;; (push-button :format "%[%t%]\n" :tag "node1")
;; (push-button :format "%[%t%]\n" :tag "node2"))))
;; (widget-demo-add-page "Tree Test" 'widget-demo-tree-test)
;;; TODO:
;; 1. Add tree-widget
;; 2. Add complex widget create by using several types of widget and
;; using group.
;; 3. Add tutorial about defining new widget
;; 4. Add a macro for simplified page definition. For example:
;; (widget-demo-insert
;; "Some text here"
;; (button :notify callback "label")
;; "More text"
;; (editable-field :form-id identifier))
;; Put this file into your load-path and the following into your ~/.emacs:
;; (autoload 'widget-demo "widget-demo" "Show demo of widget" t)
;;; Code:
(eval-when-compile
(require 'cl-lib))
(require 'info)
(require 'tree-widget)
(defvar widget-demo-buffer-name "*Widget Demo*"
"*Name of the widget demo buffer")
(defvar widget-demo-list
'(("Contents" widget-demo-contents :header "Widget Demo")
("Example" widget-demo-example :header "Example in info")
("WidgetTree" widget-tree :header "Widget Tree")
("Button" widget-demo-button)
("Text" widget-demo-text)
("Choice" widget-demo-choice)
)
"A list of pages to show.")
(defvar widget-demo-current nil
"Current page in `widget-demo-list'.")
(defvar widget-demo-form nil
"A table for lookup widget created in current buffer.")
(defvar widget-demo-anchors nil
"A table for lookup markers created in current buffer.")
(defvar widget-demo-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map widget-keymap)
(define-key map "n" 'widget-demo-next)
(define-key map "p" 'widget-demo-previous)
(define-key map "u" 'widget-demo)
(define-key map "t" 'widget-demo)
(dolist (num (number-sequence ?1 ?9))
(define-key map (char-to-string num) 'widget-demo-goto-page))
;; this command may be helpful for debug
(define-key map "r" 'widget-demo-reflesh)
(define-key map "\C-c\C-s" 'widget-demo-show-source)
(define-key map "\C-c\C-n" 'widget-demo-next)
(define-key map "\C-c\C-p" 'widget-demo-previous)
(define-key map "\C-c\C-u" 'widget-demo)
(define-key map "\C-c\C-t" 'widget-demo)
map)
"Keymap to use in *Widget Demo* buffer.")
(defvar widget-demo-menu nil)
(unless widget-demo-menu
(easy-menu-define
widget-demo-menu widget-demo-mode-map "Widget Demo"
`("Widget"
["Next Page" widget-demo-next t]
["Previous Page" widget-demo-previous t]
["Top" widget-demo t]
["Refresh" widget-demo-reflesh t]
"--"
,@(mapcar (lambda (p)
(vector (car p) 'widget-demo-menu-goto t))
widget-demo-list))))
;;{{{ Helper functions
(defun widget-demo-menu-goto ()
(interactive)
(widget-demo-goto (symbol-name last-command-event)))
(defun widget-demo-form-create (id widget)
(if (assoc id widget-demo-form)
(error "identifier %S is used!" id)
(push (cons id widget) widget-demo-form)))
(defun widget-demo-form-add (id widget)
(let ((old (assoc id widget-demo-form)))
(if old
(setcdr old widget)
(push (cons id widget) widget-demo-form))))
(defun widget-demo-form-get (id)
(cdr (assoc id widget-demo-form)))
(defun widget-demo-create-anchor (anchor)
(push (cons anchor (point-marker)) widget-demo-anchors))
(defun widget-demo-resolve-link (name)
"Return the Next, Top, Next page."
(let* ((page (assoc name widget-demo-list))
(rest (member page widget-demo-list))
(len (length rest))
next previous)
;; the contents only list next
(if (eq page (car widget-demo-list))
(list (cadr widget-demo-list))
(if (= len 1)
(setq next nil)
(setq next (cadr rest)))
(setq previous (nth (- (length widget-demo-list) len 1)
widget-demo-list))
(list next (car widget-demo-list) previous))))
(defun widget-demo-add-page (&rest page)
"add new PAGE to widget-demo.
The page is constituted by
(PAGE-NAME PAGE-DEFINITION [KEYWORD VALUE]).
Current only keyword :header is supported, which value is a string
to display in menu and the header of buffer instead of the page-name."
(setq widget-demo-list
(append widget-demo-list (list page))))
(defun widget-demo-remove-page (name)
(setq widget-demo-list
(delq (assoc name widget-demo-list)
widget-demo-list)))
;;}}}
;;{{{ Commands
;;;###autoload
(defun widget-demo ()
"Show widget demo."
(interactive)
(switch-to-buffer widget-demo-buffer-name)
(widget-demo-goto "Contents"))
(define-derived-mode widget-demo-mode nil "WDemo"
"Widget demo.
\\{widget-demo-mode-map}"
(make-local-variable 'widget-demo-form)
(make-local-variable 'widget-demo-anchors))
(defun widget-demo-goto (link)
(interactive
(list (completing-read "Goto: " widget-demo-list nil t)))
(switch-to-buffer widget-demo-buffer-name)
(widget-demo-mode)
(setq link (split-string link "#"))
(let* ((inhibit-read-only t)
(name (car link))
(anchor (cadr link))
(page (assoc name widget-demo-list)))
(erase-buffer)
(remove-overlays)
(setq widget-demo-current name)
;; insert buttons
(let ((links (widget-demo-resolve-link name))
(label '("Next" "Contents" "Prev")))
(dolist (link links)
(when link
(widget-create 'push-button
:format
(if (string= (car label) "Contents")
"%[Contents%]"
(format "%%t: %%[%s%%]" (car link)))
:button-face 'info-xref
:tag (car label)
:notify (lambda (wid &rest ignore)
(widget-demo-goto (widget-value wid)))
(car link))
(widget-insert " "))
(setq label (cdr label))))
;; insert title
(widget-insert "\n\n ")
(widget-insert
(propertize
(or (plist-get page :header) (car page))
'face 'info-title-1))
(widget-insert "\n\n")
(funcall (cadr page))
;; if there is an anchor, jump to the anchor
(if (and anchor
(setq anchor (assoc-default anchor widget-demo-anchors)))
(goto-char anchor)
(goto-char (point-min)))
(widget-setup)
(use-local-map widget-demo-mode-map)))
(defun widget-demo-next ()
(interactive)
(let ((links (widget-demo-resolve-link widget-demo-current)))
(if (car links)
(widget-demo-goto (caar links))
(message "No next pages!"))))
(defun widget-demo-previous ()
(interactive)
(let ((links (widget-demo-resolve-link widget-demo-current)))
(if (nth 2 links)
(widget-demo-goto (car (nth 2 links)))
(message "No previous pages!"))))
(defun widget-demo-goto-page ()
(interactive)
(let ((num (- last-command-event ?0)))
(if (< num (length widget-demo-list))
(widget-demo-goto (car (nth num widget-demo-list)))
(message "Only %d pages!" (length widget-demo-list)))))
(defun widget-demo-reflesh ()
(interactive)
(widget-demo-goto widget-demo-current))
(defun widget-demo-show-source ()
(interactive)
(let ((page (assoc widget-demo-current widget-demo-list)))
(with-selected-window
(display-buffer
(find-file-noselect (find-library-name "widget-demo")))
(imenu (symbol-name (cadr page)))
(recenter 1))))
;;}}}
;;{{{ Pages
(defun widget-demo-contents ()
(let ((idx 1))
(dolist (page (cdr widget-demo-list))
(widget-insert (format "%3d. " idx))
(widget-create 'link
:format "%[%t%]"
:tag (or (plist-get page :header) (car page))
:button-prefix ""
:button-suffix ""
:notify (lambda (widget &rest ignore)
(widget-demo-goto (widget-value widget)))
(car page))
(widget-insert "\n")
(setq idx (1+ idx)))))
(defun widget-demo-example ()
(widget-insert "Here is some documentation.\n\n")
(widget-create 'editable-field
:size 13
:format "Name: %v " ; Text after the field!
"My Name")
(widget-create 'menu-choice
:tag "Choose"
:value "This"
:help-echo "Choose me, please!"
:notify (lambda (widget &rest ignore)
(message "%s is a good choice!"
(widget-value widget)))
'(item :tag "This option" :value "This")
'(choice-item "That option")
'(editable-field :menu-tag "No option" "Thus option"))
(widget-create 'editable-field
:format "Address: %v"
"Some Place\nIn some City\nSome country.")
(widget-insert "\nSee also ")
(widget-create 'link
:notify (lambda (&rest ignore)
(widget-value-set
(widget-demo-form-get 'repeat)
'("En" "To" "Tre"))
(widget-setup))
"other work")
(widget-insert
" for more information.\n\nNumbers: count to three below\n")
(widget-demo-form-create
'repeat
(widget-create 'editable-list
:entry-format "%i %d %v"
:notify (lambda (widget &rest ignore)
(let ((old (widget-get widget
':example-length))
(new (length (widget-value widget))))
(unless (eq old new)
(widget-put widget ':example-length new)
(message "You can count to %d." new))))
:value '("One" "Eh, two?" "Five!")
'(editable-field :value "three")))
(widget-insert "\n\nSelect multiple:\n\n")
(widget-create 'checkbox t)
(widget-insert " This\n")
(widget-create 'checkbox nil)
(widget-insert " That\n")
(widget-create 'checkbox
:notify (lambda (&rest ignore) (message "Tickle"))
t)
(widget-insert " Thus\n\nSelect one:\n\n")
(widget-create 'radio-button-choice
:value "One"
:notify (lambda (widget &rest ignore)
(message "You selected %s"
(widget-value widget)))
'(item "One") '(item "Another One.") '(item "A Final One."))
(widget-insert "\n")
(widget-create 'push-button
:notify (lambda (&rest ignore)
(if (= (length (widget-value (widget-demo-form-get 'repeat)))
3)
(message "Congratulation!")
(error "Three was the count!")))
"Apply Form")
(widget-insert " ")
(widget-create 'push-button
:notify (lambda (&rest ignore)
(widget-example))
"Reset Form")
(widget-insert "\n"))
(defun widget-demo-button ()
;; simplest button
(widget-insert "The action to perform when click button is set to :notify ")
(widget-create 'push-button
:notify (lambda (wid cwid &optional event)
(if event
(message "You click by mouse!")
(message "Got it!")))
"Push me")
;; better looking button
(widget-insert "\n\nYou can change the looking of the button by set :button-face and :format.\n")
(widget-create 'push-button
:format "This is %[ %t %] without prefix and suffix, and have different face.\n"
:button-face 'custom-button
:tag "button")
;; deactivate button
(widget-insert "\nWidget can be activated or deactivated.\n")
(widget-create 'toggle
:format "Turn %[%v%] the button: "
:button-face 'custom-button
:notify (lambda (wid &rest ignore)
(let ((but (widget-demo-form-get 'button)))
(if (widget-apply but :active)
(widget-apply but :deactivate)
(widget-apply but :activate))))
t)
(widget-demo-form-create
'button
(widget-create 'push-button
:format "%[%t%]\n"
:button-face 'custom-button
:tag "Button"
:notify (lambda (wid &rest ignore)
(message "Got it!"))))
(widget-apply (widget-demo-form-get 'button) :deactivate)
;; image button
(widget-insert "\nHere is a button which label is a image: ")
(widget-create 'push-button
:format "%[%t%]"
:tag-glyph (find-image `((:type xpm :file "refresh.xpm")))
:tag "image"
:notify (lambda (wid &rest ingore)
(message "Create new file!")))
;; link
(widget-insert "\nThe link to ")
(widget-create 'link
:button-prefix ""
:button-suffix ""
:button-face 'info-xref
:action (lambda (wid &rest ignore)
(widget-demo-goto "Choice#checklist"))
"checklist")
;; url-link
(widget-insert " in Choice page.\n")
(widget-insert "\nThe url-link to ")
(widget-create 'url-link
:button-prefix ""
:button-suffix ""
:format "%[emacswiki%]"
:button-face 'info-xref
"http://www.emacswiki.org")
(widget-insert "\n")
;; info-link
(widget-insert "\nThe link to info node ")
(widget-create 'info-link
:button-prefix ""
:button-suffix ""
:button-face 'info-xref
"widget"))
(defun widget-demo-text ()
;; simpliest
(widget-insert "A text field with label\n")
(widget-create 'editable-field
:format "Label: %v")
;; textfield size
(widget-insert "\nThe size of text field can limit by setting :size\n")
(widget-create 'editable-field
:format "Size 13: %v\n"
:size 13)
;; :notify
(widget-insert "\nYou can add callback when the text is changed.\n")
(widget-create 'editable-field
:notify (lambda (wid changed &rest ingore)
(message "Now the text is: %s" (widget-value changed))))
;; how to use :action
(widget-insert "\nIf you want do something when press enter, bind it to :action\n"
"Press Enter to change each other: ")
(widget-demo-form-create
'left
(widget-create 'editable-field
:action (lambda (wid &rest ignore)
(widget-demo-change-text wid 'right))
:size 13
"abc"))
(widget-insert " <=> ")
(widget-demo-form-create
'right
(widget-create 'editable-field
:action (lambda (wid &rest ignore)
(widget-demo-change-text wid 'left))
:size 13
"123"))
(widget-insert "\n")
;; password
(widget-insert "\nThe textfield can used for input password\n")
(widget-create 'editable-field
:format "Password: %v\n"
:secret ?*)
;; validate
(widget-insert "\nA regexp can set to validate the text\n")
(widget-create 'editable-field
:format "Tel: %v"
:valid-regexp "\\`\\s-*[0-9]+\\([0-9]+-\\)*[0-9]+\\s-*\\'"
:action (lambda (wid &rest ignore)
(if (widget-apply wid :validate)
(error "The telephone number is not valid: %s!" (widget-get wid :error))
(message "%s is ok!" (widget-value wid)))))
;; completion
(widget-insert "\nCompletion can set to :complete-function.\n"
"Try complete some symbols: ")
(widget-create 'editable-field
:complete-function 'lisp-complete-symbol)
(widget-insert (propertize (concat
"The default key to invoke completion is M-TAB, which is occupied in many window\n"
"manager. Note that widget-field-keymap is replaced by custom-field-keymap in \n"
"cus-edit.el(Line 4525). So if you want remap command widget-complete, define it\n"
"in custom-field-keymap.\n")
'face 'widget-inactive))
;; deactivate text
(widget-insert "\nClick the checkbox to activate the textfield.\n")
(widget-create 'checkbox
:notify (lambda (wid &rest ignore)
(let ((text (widget-demo-form-get 'text))
(but (widget-demo-form-get 'button)))
(if (widget-apply text :active)
(progn
(widget-apply text :deactivate)
(widget-apply but :deactivate))
(progn
(widget-apply text :activate)
(widget-apply but :activate))))))
(widget-demo-form-create
'text
(widget-create 'editable-field
:format "Text: %v "
:size 20))
(widget-apply (widget-demo-form-get 'text) :deactivate)
(widget-demo-form-create
'button
(widget-create 'push-button
:notify (lambda (wid &rest ignore)
(let ((text (widget-demo-form-get 'text))
start)
(save-excursion
(goto-char (widget-field-start text))
(forward-char (length (widget-value text)))
(insert "a"))))
"Append"))
(widget-apply (widget-demo-form-get 'button) :deactivate)
(widget-insert "\n")
;; text
(widget-insert "\nText is intended for multiline text.\n")
(widget-create 'text :format "Input text: %v")
;; editable list
(widget-insert "\nEditable list is use for edit a list. ")
(widget-create 'push-button
:format "%[%v%]\n"
:notify (lambda (wid &rest ignore)
(message "%S" (widget-value (widget-demo-form-get 'editable-list))))
"See Value")
(widget-demo-form-create
'editable-list
(widget-create 'editable-list
:foramt "%v %i %d\n"
:value '("1" "2" "3")
'(editable-field
:current-index 3
:value-to-external
(lambda (wid value)
(if (widget-get wid :parent)
value
(let ((idx (1+ (widget-get wid :current-index))))
(widget-put wid :current-index idx)
(number-to-string idx))))))))
;; maybe it is not work, because marker of :to is delete also
(defun widget-demo-change-text (wid id)
(let ((other (widget-demo-form-get id)))
(save-excursion
(goto-char (widget-field-start other))
(delete-region (point) (widget-field-end other))
(insert (widget-value wid)))))
(defun widget-demo-choice ()
;; menu choice
(widget-insert "Here is a menu choice. The label is set by :tag, and the default item is\n"
"the child item that :value match the :value of the menu choice.\n")
(widget-demo-form-create
'menu-choice
(widget-create 'menu-choice
:tag "Menu choices"
:button-face 'custom-button
:notify (lambda (wid &rest ignore)
(message "Current value: %S" (widget-value wid)))
:value 'const-variable
'(push-button :tag "button"
:format "%[%t%]\n"
:notify (lambda (wid &rest ignore)
(message "button activate"))
"This is button")
'(item :tag "item" :value "This is item")
'(choice-item :tag "choice" "This is choice item")
'(const :tag "const" const-variable)
'(editable-field :menu-tag "editable field" "text")))
;; toggle
(widget-insert "\nToggle is used for switch a flag: ")
(widget-create 'toggle
:on "turn on"
:off "turn off"
:notify (lambda (wid &rest ignore)
(message (concat "turn the option "
(if (widget-value wid) "on" "off"))))
t)
;; check box
(widget-insert "\nCheck box is like toggle: ")
(widget-create 'checkbox
:format "%[%v%] Option\n"
:notify (lambda (wid &rest ignore)
(message (concat "Option "
(if (widget-value wid)
"selected" "unselected"))))
t)
;; radio button
(widget-insert "\nRadio button is used for select one from a list.\n")
(widget-create 'radio-button-choice
:value "One"
:notify (lambda (wid &rest ignore)
(message "You select %S %s"
(widget-type wid)
(widget-value wid)))
'(item "One")
'(item "Two")
'(item "Three"))
(widget-insert "\n")
;; checklist
(widget-demo-create-anchor "checklist")
(widget-insert "Checklist is used for multiple choices from a list.\n")
(widget-create 'checklist
:notify (lambda (wid &rest ignore)
(message "The value is %S" (widget-value wid)))
'(item "one")
'(item "two")
'(item "three")))
;;}}}
;;{{{ Widget tree
(defun widget-tree-ancestor (widget)
(let ((parent (car (get widget 'widget-type))))
(if parent
(cons widget (widget-tree-ancestor parent)))))
(defvar widget-tree-list nil
"Inherit tree of all widget")
(defun widget-tree-build ()
(let (list seen ancestor tree-list)
(mapatoms (lambda (a)
(and (get a 'widget-type)
(push a list)))
obarray)
(setq list (remq 'default list))
(while list
(setq ancestor (nreverse (widget-tree-ancestor (car list))))
(setq parent 'default)
(dolist (type ancestor)
(unless (member type seen)
(setq alist (assoc parent tree-list)
tree-list (delq alist tree-list)
alist (cons parent (cons type (cdr alist)))
tree-list (cons alist tree-list)
list (delq type list))
(push type seen))
(setq parent type)))
(setq widget-tree-list tree-list)))
(defun widget-tree-browse (but &rest ignore)
(if (= (length (window-list)) 1)
(split-window))
(save-selected-window
(other-window 1)
(widget-browse (intern (widget-get but :tag)))))
(defun widget-tree-widget (type)
(let ((list (assoc type widget-tree-list)))
(if list
`(tree-widget
:node (push-button
:tag ,(symbol-name type)
:format "%[%t%]\n"
:notify widget-tree-browse)
:dynargs widget-tree-expand)
`(push-button
:format "%[%t%]\n"
:tag ,(symbol-name type)
:notify widget-tree-browse))))
(defun widget-tree-expand (tree)
(or (widget-get tree :args)
(let ((type (intern (widget-get (tree-widget-node tree) :tag))))
(mapcar 'widget-tree-widget
(cdr (assoc type widget-tree-list))))))
(defun widget-tree ()
(widget-insert
"This is a list of all defined widget. The tree-widget show the
inherit relationship of the widget.\n\n")
(widget-insert " You can click the button to browse the widget.\n\n")
(unless widget-tree-list
(widget-tree-build))
(widget-apply-action
(widget-create (widget-tree-widget 'default)))
(if (require 'tree-mode nil t)
(tree-minor-mode t)
(widget-insert "\n\n")
(widget-insert " I recommend you use ")
(widget-create 'url-link
:button-prefix ""
:button-suffix ""
:format "%[tree-mode%]"
:button-face 'info-xref
"http://www.emacswiki.org/cgi-bin/wiki/tree-mode.el")
(widget-insert " to browse tree-widget.\n\n")))
;;}}}
(provide 'widget-demo)
;;; widget-demo.el ends here

View File

@ -0,0 +1,317 @@
;;; dtmacs-theme.el --- Theme
;; Copyright (C) 2023 ,
;; Author: Derek Taylor (DT)
;; Version: 0.1
;; Package-Requires: ((emacs "24.1"))
;; Created with ThemeCreator, https://github.com/mswift42/themecreator.
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;; This file is not part of Emacs.
;;; Commentary:
;;; dtmacs-theme was created by Derek Taylor in 2023
;;; Code:
(deftheme dtmacs)
(let ((class '((class color) (min-colors 89)))
(fg1 "#d3eaf4")
(fg2 "#cadae2")
(fg3 "#748895")
(fg4 "#4f545a")
(fg6 "#c4c4c4")
(bg1 "#192428")
(bg2 "#24343e")
(bg3 "#0c191d")
(bg4 "#0d6f9f")
(builtin "#41b2ea")
(keyword "#9bee8b")
(const "#96defa")
(comment "#7a95a0")
(func "#a094fb")
(str "#89e14b")
(type "#68cee8")
(var "#ff6ba9")
(bufid "#ffffff")
(selection "#e81050")
(warning "#e81050")
(warning2 "#e86310")
(todo "#c897ff")
(done "#d6ff97")
(unspec (when (>= emacs-major-version 29) 'unspecified)))
(custom-theme-set-faces
'dtmacs
`(default ((,class (:background ,bg1 :foreground ,fg1))))
`(dashboard-footer ((,class (:foreground ,var :italic t))))
`(dashboard-heading ((,class (:foreground ,const :weight bold))))
`(dashboard-text-banner ((,class (:foreground ,fg1 :weight bold))))
`(dashboard-banner-logo-title ((,class (:foreground ,str :weight bold))))
`(font-lock-builtin-face ((,class (:foreground ,builtin))))
`(font-lock-comment-face ((,class (:italic t :foreground ,comment))))
`(font-lock-negation-char-face ((,class (:foreground ,const))))
`(font-lock-reference-face ((,class (:foreground ,const))))
`(font-lock-constant-face ((,class (:foreground ,const))))
`(font-lock-doc-face ((,class (:foreground ,comment))))
`(font-lock-function-name-face ((,class (:foreground ,func ))))
`(font-lock-keyword-face ((,class (:bold ,class :foreground ,keyword))))
`(font-lock-string-face ((,class (:foreground ,str))))
`(font-lock-type-face ((,class (:foreground ,type ))))
`(font-lock-variable-name-face ((,class (:foreground ,var))))
`(font-lock-warning-face ((,class (:foreground ,warning :background ,bg2))))
`(term-color-black ((,class (:foreground ,fg2 :background ,unspec))))
;; `(region ((,class (:background ,fg1 :foreground ,bg1))))
`(region ((,class (:background ,selection))))
`(highlight ((,class (:foreground ,fg3 :background ,bg3))))
`(hl-line ((,class (:background ,bg2))))
`(fringe ((,class (:background ,bg1 :foreground ,fg4))))
`(cursor ((,class (:background ,fg4))))
`(isearch ((,class (:bold t :foreground ,warning :background ,bg3))))
`(mode-line ((,class (:box (:line-width 4 :color ,bg2) :bold t :foreground ,fg3 :background ,bg2))))
`(mode-line-inactive ((,class (:box (:line-width 4 :color ,bg3) :foreground ,fg3 :background ,bg3 :weight bold))))
`(mode-line-buffer-id ((,class (:box nil :bold t :foreground ,bufid :background ,unspec))))
`(mode-line-highlight ((,class (:box nil :foreground ,selection :weight bold))))
`(mode-line-emphasis ((,class (:foreground ,fg1))))
`(vertical-border ((,class (:foreground ,fg3))))
`(minibuffer-prompt ((,class (:bold t :foreground ,builtin))))
`(default-italic ((,class (:italic t))))
`(link ((,class (:foreground ,const :underline t))))
`(org-code ((,class (:foreground ,fg2))))
`(org-hide ((,class (:foreground ,fg4))))
`(org-level-1 ((,class (:bold t :foreground ,builtin :height 1.7))))
`(org-level-2 ((,class (:bold t :foreground ,str :height 1.6))))
`(org-level-3 ((,class (:bold t :foreground ,var :height 1.5))))
`(org-level-4 ((,class (:bold t :foreground ,func :height 1.4))))
`(org-level-5 ((,class (:bold t :foreground ,const :height 1.3))))
`(org-level-6 ((,class (:bold t :foreground ,keyword :height 1.2))))
`(org-level-7 ((,class (:bold t :foreground ,builtin :height 1.1))))
`(org-level-8 ((,class (:bold t :foreground ,str :height 1.0))))
`(org-date ((,class (:underline t :foreground ,var) )))
`(org-footnote ((,class (:underline t :foreground ,fg4))))
`(org-link ((,class (:underline t :foreground ,type ))))
`(org-special-keyword ((,class (:foreground ,func))))
`(org-block ((,class (:foreground ,fg2))))
`(org-quote ((,class (:inherit org-block :slant italic))))
`(org-verse ((,class (:inherit org-block :slant italic))))
`(org-todo ((,class (:foreground ,todo :bold t :italic t))))
`(org-done ((,class (:foreground ,done :bold t :italic t))))
`(org-warning ((,class (:underline t :foreground ,warning))))
`(org-agenda-structure ((,class (:weight bold :foreground ,fg3 :box (:color ,fg4) :background ,bg3))))
`(org-agenda-date ((,class (:foreground ,var :height 1.1 ))))
`(org-agenda-date-weekend ((,class (:weight normal :foreground ,fg4))))
`(org-agenda-date-today ((,class (:weight bold :foreground ,keyword :height 1.4))))
`(org-agenda-done ((,class (:foreground ,bg4))))
`(org-scheduled ((,class (:foreground ,type))))
`(org-scheduled-today ((,class (:foreground ,func :weight bold :height 1.2))))
`(org-ellipsis ((,class (:foreground ,builtin))))
`(org-verbatim ((,class (:foreground ,str))))
`(org-document-info-keyword ((,class (:foreground ,func))))
`(font-latex-bold-face ((,class (:foreground ,type))))
`(font-latex-italic-face ((,class (:foreground ,var :italic t))))
`(font-latex-string-face ((,class (:foreground ,str))))
`(font-latex-match-reference-keywords ((,class (:foreground ,const))))
`(font-latex-match-variable-keywords ((,class (:foreground ,var))))
`(ido-only-match ((,class (:foreground ,warning))))
`(org-sexp-date ((,class (:foreground ,fg4))))
`(ido-first-match ((,class (:foreground ,keyword :bold t))))
`(ivy-current-match ((,class (:foreground ,fg3 :inherit highlight :underline t))))
`(gnus-header-content ((,class (:foreground ,keyword))))
`(gnus-header-from ((,class (:foreground ,var))))
`(gnus-header-name ((,class (:foreground ,type))))
`(gnus-header-subject ((,class (:foreground ,func :bold t))))
`(mu4e-view-url-number-face ((,class (:foreground ,type))))
`(mu4e-cited-1-face ((,class (:foreground ,fg2))))
`(mu4e-cited-7-face ((,class (:foreground ,fg3))))
`(mu4e-header-marks-face ((,class (:foreground ,type))))
`(ffap ((,class (:foreground ,fg4))))
`(js2-private-function-call ((,class (:foreground ,const))))
`(js2-jsdoc-html-tag-delimiter ((,class (:foreground ,str))))
`(js2-jsdoc-html-tag-name ((,class (:foreground ,var))))
`(js2-external-variable ((,class (:foreground ,type ))))
`(js2-function-param ((,class (:foreground ,const))))
`(js2-jsdoc-value ((,class (:foreground ,str))))
`(js2-private-member ((,class (:foreground ,fg3))))
`(js3-warning-face ((,class (:underline ,keyword))))
`(js3-error-face ((,class (:underline ,warning))))
`(js3-external-variable-face ((,class (:foreground ,var))))
`(js3-function-param-face ((,class (:foreground ,fg2))))
`(js3-jsdoc-tag-face ((,class (:foreground ,keyword))))
`(js3-instance-member-face ((,class (:foreground ,const))))
`(warning ((,class (:foreground ,warning))))
`(ac-completion-face ((,class (:underline t :foreground ,keyword))))
`(info-quoted-name ((,class (:foreground ,builtin))))
`(info-string ((,class (:foreground ,str))))
`(icompletep-determined ((,class :foreground ,builtin)))
`(undo-tree-visualizer-current-face ((,class :foreground ,builtin)))
`(undo-tree-visualizer-default-face ((,class :foreground ,fg2)))
`(undo-tree-visualizer-unmodified-face ((,class :foreground ,var)))
`(undo-tree-visualizer-register-face ((,class :foreground ,type)))
`(slime-repl-inputed-output-face ((,class (:foreground ,type))))
`(trailing-whitespace ((,class :foreground ,unspec :background ,warning)))
`(rainbow-delimiters-depth-1-face ((,class :foreground ,fg1)))
`(rainbow-delimiters-depth-2-face ((,class :foreground ,type)))
`(rainbow-delimiters-depth-3-face ((,class :foreground ,var)))
`(rainbow-delimiters-depth-4-face ((,class :foreground ,const)))
`(rainbow-delimiters-depth-5-face ((,class :foreground ,keyword)))
`(rainbow-delimiters-depth-6-face ((,class :foreground ,fg1)))
`(rainbow-delimiters-depth-7-face ((,class :foreground ,type)))
`(rainbow-delimiters-depth-8-face ((,class :foreground ,var)))
`(magit-item-highlight ((,class :background ,bg3)))
`(magit-section-heading ((,class (:foreground ,keyword :weight bold))))
`(magit-hunk-heading ((,class (:background ,bg3))))
`(magit-section-highlight ((,class (:background ,bg2))))
`(magit-hunk-heading-highlight ((,class (:background ,bg3))))
`(magit-diff-context-highlight ((,class (:background ,bg3 :foreground ,fg3))))
`(magit-diffstat-added ((,class (:foreground ,type))))
`(magit-diffstat-removed ((,class (:foreground ,var))))
`(magit-process-ok ((,class (:foreground ,func :weight bold))))
`(magit-process-ng ((,class (:foreground ,warning :weight bold))))
`(magit-branch ((,class (:foreground ,const :weight bold))))
`(magit-log-author ((,class (:foreground ,fg3))))
`(magit-hash ((,class (:foreground ,fg2))))
`(magit-diff-file-header ((,class (:foreground ,fg2 :background ,bg3))))
`(lazy-highlight ((,class (:foreground ,fg2 :background ,bg3))))
`(term ((,class (:foreground ,fg1 :background ,bg1))))
`(term-color-black ((,class (:foreground ,bg3 :background ,bg3))))
`(term-color-blue ((,class (:foreground ,func :background ,func))))
`(term-color-red ((,class (:foreground ,keyword :background ,bg3))))
`(term-color-green ((,class (:foreground ,type :background ,bg3))))
`(term-color-yellow ((,class (:foreground ,var :background ,var))))
`(term-color-magenta ((,class (:foreground ,builtin :background ,builtin))))
`(term-color-cyan ((,class (:foreground ,str :background ,str))))
`(term-color-white ((,class (:foreground ,fg2 :background ,fg2))))
`(rainbow-delimiters-unmatched-face ((,class :foreground ,warning)))
`(helm-header ((,class (:foreground ,fg2 :background ,bg1 :underline nil :box nil))))
`(helm-source-header ((,class (:foreground ,keyword :background ,bg1 :underline nil :weight bold))))
`(helm-selection ((,class (:background ,bg2 :underline nil))))
`(helm-selection-line ((,class (:background ,bg2))))
`(helm-visible-mark ((,class (:foreground ,bg1 :background ,bg3))))
`(helm-candidate-number ((,class (:foreground ,bg1 :background ,fg1))))
`(helm-separator ((,class (:foreground ,type :background ,bg1))))
`(helm-time-zone-current ((,class (:foreground ,builtin :background ,bg1))))
`(helm-time-zone-home ((,class (:foreground ,type :background ,bg1))))
`(helm-buffer-not-saved ((,class (:foreground ,type :background ,bg1))))
`(helm-buffer-process ((,class (:foreground ,builtin :background ,bg1))))
`(helm-buffer-saved-out ((,class (:foreground ,fg1 :background ,bg1))))
`(helm-buffer-size ((,class (:foreground ,fg1 :background ,bg1))))
`(helm-ff-directory ((,class (:foreground ,func :background ,bg1 :weight bold))))
`(helm-ff-file ((,class (:foreground ,fg1 :background ,bg1 :weight normal))))
`(helm-ff-executable ((,class (:foreground ,var :background ,bg1 :weight normal))))
`(helm-ff-invalid-symlink ((,class (:foreground ,warning2 :background ,bg1 :weight bold))))
`(helm-ff-symlink ((,class (:foreground ,keyword :background ,bg1 :weight bold))))
`(helm-ff-prefix ((,class (:foreground ,bg1 :background ,keyword :weight normal))))
`(helm-grep-cmd-line ((,class (:foreground ,fg1 :background ,bg1))))
`(helm-grep-file ((,class (:foreground ,fg1 :background ,bg1))))
`(helm-grep-finish ((,class (:foreground ,fg2 :background ,bg1))))
`(helm-grep-lineno ((,class (:foreground ,fg1 :background ,bg1))))
`(helm-grep-match ((,class (:foreground ,unspec :background ,unspec :inherit helm-match))))
`(helm-grep-running ((,class (:foreground ,func :background ,bg1))))
`(helm-moccur-buffer ((,class (:foreground ,func :background ,bg1))))
`(helm-source-go-package-godoc-description ((,class (:foreground ,str))))
`(helm-bookmark-w3m ((,class (:foreground ,type))))
`(company-echo-common ((,class (:foreground ,bg1 :background ,fg1))))
`(company-preview ((,class (:background ,bg1 :foreground ,var))))
`(company-preview-common ((,class (:foreground ,bg2 :foreground ,fg3))))
`(company-preview-search ((,class (:foreground ,type :background ,bg1))))
`(company-scrollbar-bg ((,class (:background ,bg3))))
`(company-scrollbar-fg ((,class (:foreground ,keyword))))
`(company-tooltip ((,class (:foreground ,fg2 :background ,bg2 :bold t))))
`(company-tooltop-annotation ((,class (:foreground ,const))))
`(company-tooltip-common ((,class ( :foreground ,fg3))))
`(company-tooltip-common-selection ((,class (:foreground ,str))))
`(company-tooltip-mouse ((,class (:inherit highlight))))
`(company-tooltip-selection ((,class (:background ,bg3 :foreground ,fg3))))
`(company-template-field ((,class (:inherit region))))
`(web-mode-builtin-face ((,class (:inherit ,font-lock-builtin-face))))
`(web-mode-comment-face ((,class (:inherit ,font-lock-comment-face))))
`(web-mode-constant-face ((,class (:inherit ,font-lock-constant-face))))
`(web-mode-keyword-face ((,class (:foreground ,keyword))))
`(web-mode-doctype-face ((,class (:inherit ,font-lock-comment-face))))
`(web-mode-function-name-face ((,class (:inherit ,font-lock-function-name-face))))
`(web-mode-string-face ((,class (:foreground ,str))))
`(web-mode-type-face ((,class (:inherit ,font-lock-type-face))))
`(web-mode-html-attr-name-face ((,class (:foreground ,func))))
`(web-mode-html-attr-value-face ((,class (:foreground ,keyword))))
`(web-mode-warning-face ((,class (:inherit ,font-lock-warning-face))))
`(web-mode-html-tag-face ((,class (:foreground ,builtin))))
`(jde-java-font-lock-package-face ((t (:foreground ,var))))
`(jde-java-font-lock-public-face ((t (:foreground ,keyword))))
`(jde-java-font-lock-private-face ((t (:foreground ,keyword))))
`(jde-java-font-lock-constant-face ((t (:foreground ,const))))
`(jde-java-font-lock-modifier-face ((t (:foreground ,fg2))))
`(jde-jave-font-lock-protected-face ((t (:foreground ,keyword))))
`(jde-java-font-lock-number-face ((t (:foreground ,var))))
`(yas-field-highlight-face ((t (:background ,selection)))))
;; Legacy
(if (< emacs-major-version 22)
(custom-theme-set-faces
'dtmacs
`(show-paren-match-face ((,class (:background ,warning))))) ;; obsoleted in 22.1, removed 2016
(custom-theme-set-faces
'dtmacs
`(show-paren-match ((,class (:foreground ,bg1 :background ,str))))
`(show-paren-mismatch ((,class (:foreground ,bg1 :background ,warning))))))
;; emacs >= 26.1
(when (>= emacs-major-version 26)
(custom-theme-set-faces
'dtmacs
`(line-number ((t (:inherit fringe))))
`(line-number-current-line ((t (:inherit fringe :foreground ,fg6 :weight bold))))))
;; emacs >= 27.1
(when (>= emacs-major-version 27)
(custom-theme-set-faces
'dtmacs
`(tab-line ((,class (:background ,bg2 :foreground ,fg4))))
`(tab-line-tab ((,class (:inherit tab-line))))
`(tab-line-tab-inactive ((,class (:background ,bg2 :foreground ,fg4))))
`(tab-line-tab-current ((,class (:background ,bg1 :foreground ,fg1))))
`(tab-line-highlight ((,class (:background ,bg1 :foreground ,fg2))))))
(when (>= emacs-major-version 28)
(custom-theme-set-faces
'dtmacs
`(line-number ((t (:inherit fringe))))
`(line-number-current-line ((t (:inherit fringe :foreground ,fg6 :weight bold))))))
;; emacs >= 27.1
(when (>= emacs-major-version 27)
(custom-theme-set-faces
'dtmacs
`(tab-line ((,class (:background ,bg2 :foreground ,fg4))))
`(tab-line-tab ((,class (:inherit tab-line))))
`(tab-line-tab-inactive ((,class (:background ,bg2 :foreground ,fg4))))
`(tab-line-tab-current ((,class (:background ,bg1 :foreground ,fg1))))
`(tab-line-highlight ((,class (:background ,bg1 :foreground ,fg2))))))
(when (>= emacs-major-version 28)
(custom-theme-set-faces
'dtmacs
`(tab-line-tab-modified ((,class (:foreground ,warning2 :weight bold))))))
(when (boundp 'font-lock-regexp-face)
(custom-theme-set-faces
'dtmacs
`(font-lock-regexp-face ((,class (:inherit font-lock-string-face :underline t)))))))
;;;###autoload
(when load-file-name
(add-to-list 'custom-theme-load-path
(file-name-as-directory (file-name-directory load-file-name))))
(provide-theme 'dtmacs)
;; Local Variables:
;; no-byte-compile: t
;; End:
;;; dtmacs-theme.el ends here

View File

@ -1,2 +1,2 @@
LastUsed=1693230388
LastUsed=1693238502
Message='Fully Updated'

View File

@ -1,86 +0,0 @@
<!DOCTYPE html><html><head><meta charset=UTF-8><title>bm v2021.04.05 : all your bookmarks</title>
<style type="text/css">
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
padding: 50px 0 5px 50px;
background: #1f1f1f url(/home/dt/.config/repomenu/bookmarks/.bm.shots/black-Linen.png);
font: 12px "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.bm {
position: relative;
float: left;
margin: 15px;
padding: 1px;
opacity: 1;
border: 15px solid black;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-webkit-transition: -webkit-box-shadow 600ms;
-moz-transition: -webkit-box-shadow 600ms;
-webkit-box-shadow: 0 0 1px 0 #555, 0 0 10px rgba(0,0,0,.5);
-moz-box-shadow: 0 0 1px 0 #555, 0 0 10px rgba(0,0,0,.5);
overflow: hidden;
}
.bm:hover {
-webkit-box-shadow: 0 0 40px #1ab0ff
, 0 0 3px #06bdff
, 0 1px 1px #4ee2ff
, 0 1px 0 #fff;
-moz-box-shadow: 0 0 40px #1ab0ff
, 0 0 3px #06bdff
, 0 1px 1px #4ee2ff
, 0 1px 0 #fff;
}
.bm:hover img {
opacity: 1;
}
.bm img {
width: 200px;
height: 150px;
opacity: .5;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-webkit-transition: opacity 200ms;
-moz-transition: opacity 200ms;
}
.bm p {
margin: 0;
padding: 10px;
width: 100%;
background: rgba(0,0,0,.75);
position: absolute;
left: 0;
color: white;
letter-spacing: 1px;
bottom: -50px;
-webkit-font-smoothing: antialiased;
-webkit-transition: bottom 200ms ease-in;
}
.bm:hover p {
bottom: 0;
}
</style>
</head><body>
<div class=bm>
<a href='https://arch.therepo.club'><img src='/home/dt/.config/repomenu/bookmarks/.bm.shots/ea6857115d7a4da89b340576c7213dfb.png' alt='https://arch.therepo.club' /></a>
<p>The Repo Club<br/><a href='/home/dt/.config/repomenu/bookmarks/.bm.shots/ea6857115d7a4da89b340576c7213dfb.png'>View image</a></p>
</div>
<div class=bm>
<a href='https://wheelspinmodels.co.uk/'><img src='/home/dt/.config/repomenu/bookmarks/.bm.shots/ffb961b75cf9b631d2b355c0f3a34b5b.png' alt='https://wheelspinmodels.co.uk/' /></a>
<p>Wheel Spin Models<br/><a href='/home/dt/.config/repomenu/bookmarks/.bm.shots/ffb961b75cf9b631d2b355c0f3a34b5b.png'>View image</a></p>
</div>
<div class=bm>
<a href='https://www.sslforfree.com/'><img src='/home/dt/.config/repomenu/bookmarks/.bm.shots/7df87cd59ea99c775fd21d273cdf17cb.png' alt='https://www.sslforfree.com/' /></a>
<p>SSL For Free<br/><a href='/home/dt/.config/repomenu/bookmarks/.bm.shots/7df87cd59ea99c775fd21d273cdf17cb.png'>View image</a></p>
</div>
<div class=bm>
<a href='https://www.photopea.com/'><img src='/home/dt/.config/repomenu/bookmarks/.bm.shots/2c49342a6cd7d00cb86e161fbbee17ab.png' alt='https://www.photopea.com/' /></a>
<p>Photopea<br/><a href='/home/dt/.config/repomenu/bookmarks/.bm.shots/2c49342a6cd7d00cb86e161fbbee17ab.png'>View image</a></p>
</div>
</body></html>

View File

@ -1,4 +0,0 @@
ea6857115d7a4da89b340576c7213dfb|2021-04-05T15:29:24Z|:1|https://arch.therepo.club|The Repo Club|default
ffb961b75cf9b631d2b355c0f3a34b5b|2021-04-05T16:46:06Z|:2|https://wheelspinmodels.co.uk/|Wheel Spin Models|default
7df87cd59ea99c775fd21d273cdf17cb|2021-04-05T16:46:58Z|:3|https://www.sslforfree.com/|SSL For Free|default
2c49342a6cd7d00cb86e161fbbee17ab|2021-04-05T16:47:25Z|:4|https://www.photopea.com/|Photopea|default