summaryrefslogblamecommitdiffstats
path: root/roles/edit/templates/emacsconf-edit.el
blob: 195170a4dcb9973fdb7a164b822f9800643539ae (plain) (tree)
1
2
3
4
5
6
7

                        




                                                                                                                                     












                                                                                        
                           








                                                                        



                                                                 

                            


                                             

                                   

                                                                          







                                                                                                                  
                                                             






                                                            



                                             


                                                     















                                                                                            
                
                                                                     

                                                  
                                                
                                               
                  
;; {{ ansible_managed }}

(progn (require 'package)
       (let ((packages (seq-remove #'package-installed-p '({% for package in emacsconf_edit_packages %}{{ package }} {% endfor %}))))
         (when packages
           (package-refresh-contents)
           (mapc #'package-install packages))))
;; Configuration
(vertico-mode)
(show-paren-mode)
(fset 'yes-or-no-p 'y-or-n-p)
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-x b") 'consult-buffer)
(global-set-key (kbd "M-g t") 'emacsconf-go-to-talk)
(global-set-key (kbd "C-.") 'embark-act)
(global-set-key (kbd "C-c .") 'embark-act)
(global-set-key (kbd "C-;") 'embark-act)
(modus-themes-load-vivendi)
(org-babel-do-load-languages  'org-babel-load-languages '((emacs-lisp . t) (shell . t)))
(setq backup-directory-alist '(("." . "~/.emacs.d/backups")))
(global-auto-revert-mode 1)
(with-eval-after-load 'projectile
  (projectile-mode +1)
  (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
  (setq projectile-completion-system 'default)
  (setq projectile-enable-caching t)
  (setq projectile-indexing-method 'alien)
  (add-to-list 'projectile-globally-ignored-files "node_modules")
  (add-to-list 'projectile-globally-ignored-files ".cache")
  (add-to-list 'projectile-globally-ignored-files "_cache"))

(setq completion-styles '(orderless))   
(setq completion-category-defaults nil) 
(setq completion-category-overrides '((file (styles orderless))))

(defhydra hydra-emacsconf ()
  ("aa" emacsconf-agenda "agenda")
  ("ad" (emacsconf-track-agenda "dev") "dev")
  ("ag" (emacsconf-track-agenda "gen") "gen")
  ("e" embark-act "embark")
  ("t" emacsconf-go-to-talk "talk")
  ("c" (find-file emacsconf-org-file) "conf.org")
  ("C" (let ((default-directory (file-name-directory emacsconf-org-file)))
     (call-interactively #'projectile-find-file))
   "org dir")
  ("w"
   (let ((default-directory emacsconf-directory))
     (call-interactively #'projectile-find-file))
   "wiki")
  ("o" (find-file (expand-file-name (concat emacsconf-year "/organizers-notebook/index.org") emacsconf-directory))
   "org notes")
  ("A" (let ((default-directory emacsconf-ansible-directory))
         (call-interactively #'projectile-find-file))
   "ansible")
  ("i" (switch-to-buffer (erc-get-buffer "#emacsconf-org")))
  ("l" (let ((default-directory "{{ emacsconf_el_dir }}"))
         (call-interactively #'projectile-find-file))
   "lisp")
  ("b" emacsconf-backstage-dired "backstage")
  ("i" emacsconf-stream-set-talk-info "info")
  ("m" emacsconf-stream-play-video "mpv")
  ("p" emacsconf-stream-open-pad "pad")
  ("q" emacsconf-stream-join-qa "qa")
  ("u" emacsconf-upload-dired "upload"))
(global-set-key (kbd "C-c e") #'hydra-emacsconf/body)

(setq erc-nick "{{ erc_user }}")
(setq erc-password "{{ erc_password }}")
(setq erc-server "{{ erc_server }}")
(setq erc-port "{{ erc_port }}")
(setq erc-autojoin-channels-alist '((".*"
                                     {% for channel in erc_channels %}
                                     "#{{ channel }}"
                                     {% endfor %}
                                     {% for track in emacsconf_tracks %}
                                     "#{{ track.channel }}"
                                     {% endfor %})))

(defun emacsconf-erc-connect ()
  (interactive)
  (erc-tls :server "{{ erc_server }}" :nick erc-nick :password erc-password :port erc-port))

(require 'ox-md)
(unless (and (boundp 'server-clients) server-clients) (server-start))

(find-file "{{ emacsconf_private_dir }}/conf.org")
(emacsconf-add-org-after-todo-state-change-hook)
(unless noninteractive (emacsconf-erc-connect))
(setq tab-width 2)