Emacs-DotFiles-1

(message "Welcome to Vikid's Emacs Setups")

(defun load-init ()
  (interactive)
  (load-file "init.el"))
(global-set-key (kbd "C-c l") 'load-init)

(defun server-shutdown ()
  "Save some buffer and shutdown the server"
  (interactive)
  (save-some-buffers)
  (kill-emacs))

;Org-Bable
(message "Loading Org-babel")
(require 'org)
(org-babel-load-file (expand-file-name "mac-init.org" "~/.emacs.d/" ))

(org-babel-do-load-languages
 'org-babel-load-languages
 '((lisp . t)))

(setq org-babel-lisp-eval-fn 'sly-eval)
(message "End of Init")




(message "hi")
(load-theme 'leuven-dark)
(setq ring-bell-function 'ingore)
;;(set-message-beep 'silent)
(server-start)



(require 'package)
(add-to-list 'package-archives '("gnu"   . "https://elpa.gnu.org/packages/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)



(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(eval-and-compile
  (setq use-package-always-ensure t
        use-package-expand-minimally t))

(eval-when-compile
  ;; Following line is not needed if use-package.el is in ~/.emacs.d
  (add-to-list 'load-path "C:\Users\vukin\OneDrive\Documents")
  (require 'use-package))

(setq package-check-signature nil) ;;window error removal



(use-package which-key)
(which-key-mode)          ;;start which-key
;; (setq which-key-popup-type 'side-window)  ;;optional
(setq which-key-popup-type 'frame)

(use-package lsp-mode
  :init
  ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
  (setq lsp-keymap-prefix "C-c l")
  :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
         (XXX-mode . lsp)
         ;; if you want which-key integration
         (lsp-mode . lsp-enable-which-key-integration))
  :commands lsp)



(use-package markdown-mode
  :mode ("\.md\'" . markdown-mode))




(message "Evil Mode")
(use-package evil
  :ensure t
  :init
  (setq evil-want-integration t) ;; This is optional since it's already set to t by default.
  (setq evil-want-keybinding nil)
  :config
  (evil-mode 1)
  (use-package evil-leader
    :ensure t
    :config
    (global-evil-leader-mode t)
    (evil-leader/set-leader "<SPC>")
    (evil-leader/set-key
      "s s" 'swiper
      "d x w" 'delete-trailing-whitespace))

  (use-package evil-surround
    :ensure t
    :config (global-evil-surround-mode))

  (use-package evil-indent-textobject
    :ensure t)

  (use-package evil-org
    :ensure t
    :config
    (evil-org-set-key-theme
	  '(textobjects insert navigation additional shift todo heading))
    (add-hook 'org-mode-hook (lambda () (evil-org-mode))))

  (use-package powerline-evil
    :ensure t
    :config
    (powerline-evil-vim-color-theme)))

(message "Evil Collection")
(use-package evil-collection
  :after evil
  :ensure t
  :config
  (evil-collection-init))

### installing magit
install compat and transient first

(unless (package-installed-p 'compat)
  (package-refresh-contents)
  (package-install 'compat))

(unless (package-installed-p 'transient)
  (package-refresh-contents)
  (package-install 'transient))

(unless (package-installed-p 'with-editor)
  (package-refresh-contents)
  (package-install 'with-editor))

on macs, do the below:
bash
brew install makeinfo
brew install texinfo

sudo ln -s /Applications/Emacs.app/Contents/MacOS/Emacs /usr/local/bin/emacs
sudo ln -s /Applications/Emacs.app/Contents/MacOS/bin/emacsclient /usr/local/bin

on linux:
bash
sudo apt install info

clone and build magit
bash
git clone https://github.com/magit/magit.git ~/.emacs.d/site-lisp/magit
cd ~/.emacs.d/site-lisp/magit
make

then, add to your init file

(message "MAGIT")
(add-to-list 'load-path "~/.emacs.d/site-lisp/magit/lisp")
(require 'magit)
(with-eval-after-load 'info
  (info-initialize)
  (add-to-list 'Info-directory-list
               "~/.emacs.d/site-lisp/magit/Documentation/"))


(x-focus-frame nil) ;;what is this?

Save Place Mode and Uniquify

(message "Save Place Mode and Uniquify")
(save-place-mode 1)
(require 'uniquify)

Exec Path #experimental

(message "Exec Path ")
(defun set-exec-path-from-shell-PATH ()
  "Set up Emacs' `exec-path' and PATH environment variable to match
that used by the user's shell.

This is particularly useful under Mac OS X and macOS, where GUI
apps are not started from a shell."
  (interactive)
  (let ((path-from-shell (replace-regexp-in-string
			  "[ tn]*$" "" (shell-command-to-string
					  "$SHELL --login -c 'echo $PATH'"
						    ))))
    (setenv "PATH" path-from-shell)
    (setq exec-path (split-string path-from-shell path-separator))))

(set-exec-path-from-shell-PATH)



(message "Evil Set Initial State")
(evil-set-initial-state 'ibuffer-mode 'normal)
(evil-set-initial-state 'bookmark-bmenu-mode 'normal)
(evil-set-initial-state 'dired-mode 'emacs)
(evil-set-initial-state 'sunrise-mode 'emacs)
(evil-set-initial-state 'Info-mode 'emacs)

---
### Internal Links
- [[Emacs]]
- [[tree-sitter]]

---
### External Links
- [Sacha Chua's Emacs configuration](https://pages.sachachua.com/.emacs.d/Sacha.html#babel-init)
- [EmacsWiki: Exec Path](https://www.emacswiki.org/emacs/ExecPath)
- [Configure Emacs Writing Studio for authors](https://lucidmanager.org/productivity/configure-emacs/)
- [daviwil/emacs-from-scratch · GitHub](https://github.com/daviwil/emacs-from-scratch/blob/master/init.el)
- [GitHub - abrochard/emacs-config: Personal Emacs configuration files](https://github.com/abrochard/emacs-config)
- [Doom Emacs Configuration](https://tecosaur.github.io/emacs-config/config.html)
- [GNU Emacs configuration | Protesilaos Stavrou](https://protesilaos.com/emacs/dotemacs)
- [EmacsWiki: Example Configurations](https://www.emacswiki.org/emacs/ExampleConfigurations)
- [Emacs Config – Jamie Collinson](https://jamiecollinson.com/blog/my-emacs-config/)
- [dot-files/emacs/init.el at master · mina86/dot-files · GitHub](https://github.com/mina86/dot-files/blob/master/emacs/init.el
- [YouTube](https://www.youtube.com/live/Ex9zI4Fcirs?si=Ryt3uQWVsVFvP_b8) #YT
- [Installing from the Git Repository (Magit User Manual)](https://magit.vc/manual/magit/Installing-from-the-Git-Repository.html)
- [Tips And Tricks](https://emacsformacosx.com/tips)
-  [GitHub - emacs-evil/evil-collection: A set of keybindings for evil-mode](https://github.com/emacs-evil/evil-collection)
- [Emacs Config Redo - Evil & Use-Package | λ ryan. himmelwright. net](https://ryan.himmelwright.net/post/emacs-update-evil-usepackage/)
- [GitHub - noctuid/evil-guide: Draft of a guide for using emacs with evil](https://github.com/noctuid/evil-guide)
- [Disabling evil-mode for Nav in Emacs? Or any read-only buffers? - Stack Overflow](https://stackoverflow.com/questions/23798021/disabling-evil-mode-for-nav-in-emacs-or-any-read-only-buffers)

http:///wiki/?dotemacsscratchpad

05may24   admin