 
 ;;; ..:: Customization variables ::..
 
+;;;###autoload
+(defun danylo/make-path (rel-path)
+  "Prepend emacs home directory to relative path in the home
+directory."
+  (expand-file-name rel-path user-emacs-directory))
+
+(defconst danylo/emacs-custom-lisp-dir
+  `,(danylo/make-path "lisp/")
+  "Location of additional custom Lisp code directory.")
+
+(defconst danylo/emacs-backup-dir
+  `,(danylo/make-path "backups/")
+  "Location where backup files are saved.")
+
 (use-package danylo-custom-variables
   ;; Customization variables for init file.
   :ensure nil
-  :load-path "lisp/")
+  :load-path danylo/emacs-custom-lisp-dir)
 
 ;;; ..:: General helper functions ::..
 

    (run-hooks 'mu4e-message-changed-hook)))

;;;###autoload
(defun message-kill-buffer ()
  "Patched message-kill-buffer from gnus/message.el.gz.
This version deletes backup files without asking."
  (interactive)

				  :inherit 'mode-line)))
  ;;;; Custom modeline definitions
  ;; Default mode line
  (doom-modeline-def-modeline 'danylo/mode-line
    '(bar danylo/matches buffer-info remote-host buffer-position parrot selection-info)
    '(danylo/mu4e input-method debug lsp major-mode vcs))
  (add-hook 'doom-modeline-mode-hook
	    (lambda () (doom-modeline-set-modeline 'danylo/mode-line 'default)))
  ;; Helm mode line
  (doom-modeline-def-modeline 'helm
    '(bar helm-buffer-id helm-number helm-follow helm-prefix-argument) '())
  ;; Dashboard mode line
  (doom-modeline-def-modeline 'dashboard
    '(bar window-number buffer-default-directory-simple) '(danylo/mu4e))
  ;; Messages and scratch buffer mode line
  (doom-modeline-def-modeline 'danylo/bare-modeline
    '(bar window-number buffer-info-simple) '(danylo/mu4e))
  (add-hook 'after-init-hook
	    (lambda ()
	      (dolist (bname '("*scratch*" "*Messages*"))
		(if (buffer-live-p (get-buffer bname))
		    (with-current-buffer bname
		      (doom-modeline-set-modeline 'danylo/bare-modeline)))))))

;; Activate the Doom modeline mode
(add-hook 'after-init-hook (lambda () (doom-modeline-mode 1)))

;;;###autoload
(defun danylo/doom-modeline-multiple-cursors ()
  "Show the number of multiple cursors."
  (cl-destructuring-bind (count . face)
      (cond ((bound-and-true-p multiple-cursors-mode)
             (cons (mc/num-cursors)
                   (if (doom-modeline--active)
		       'doom-modeline-panel
                     'mode-line-inactive)))
            ((bound-and-true-p evil-mc-cursor-list)
             (cons (length evil-mc-cursor-list)
                   (cond ((not (doom-modeline--active)) 'mode-line-inactive)
			 (evil-mc-frozen 'doom-modeline-bar)
			 ('doom-modeline-panel))))
            ((cons nil nil)))
    (when count
      (concat (propertize " mc:" 'face face)
	      (propertize (format "%d " count) 'face face)))))

;;;###autoload
(defun danylo/doom-modeline-update-vcs-icon (orig-fun &rest args)
  "Update icon of vcs state in mode-line.
Patched for my own icons."
  (setq doom-modeline--vcs-icon
        (when (and vc-mode buffer-file-name)
          (let* ((backend (vc-backend buffer-file-name))
                 (state   (vc-state buffer-file-name backend)))
            (cond ((memq state '(edited added))
		   (propertize (danylo/octicon "git-compare") 'face
   		    	       `(:family ,(all-the-icons-octicon-family)
					 :inherit doom-modeline-warning)))
                  ((eq state 'needs-merge)
                   (propertize (danylo/octicon "git-merge") 'face
   		    	       `(:family ,(all-the-icons-octicon-family)
					 :inherit doom-modeline-warning)))
                  ((eq state 'needs-update)
                   (propertize (danylo/octicon "arrow-down") 'face
   		    	       `(:family ,(all-the-icons-octicon-family)
					 :inherit doom-modeline-warning)))
                  ((memq state '(removed conflict unregistered))
                   (propertize (danylo/octicon "alert") 'face
   		    	       `(:family ,(all-the-icons-octicon-family)
					 :inherit doom-modeline-warning)))
                  (t
		   (propertize (danylo/octicon "git-branch") 'face
   		    	       `(:family ,(all-the-icons-octicon-family)
					 :inherit doom-modeline-warning))))))))

(advice-add 'doom-modeline-update-vcs-icon
	    :around #'danylo/doom-modeline-update-vcs-icon)

(use-package danylo-text-font-lock
  ;; Personal minor mode for text document highlighting
  :ensure nil
  :load-path danylo/emacs-custom-lisp-dir
  :hook ((LaTeX-mode . danylo-text-font-lock-mode)
	 (org-mode . danylo-text-font-lock-mode)))

(use-package danylo-prog-font-lock
  ;; Personal minor mode for code highlighting
  :ensure nil
  :load-path danylo/emacs-custom-lisp-dir
  :hook ((python-mode . danylo-prog-font-lock-mode)
	 (julia-mode . danylo-prog-font-lock-mode)))
(require 'danylo-prog-font-lock)

;;; ..:: Code editing ::..

