Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
1039 lines (862 sloc) 33 KB

ddavis dotfiles

emacs init file

Emacs init written with org-mode to have at least a little bit of organization. Lot’s of use-package use going on here.

setup MELPA

(require 'package)

(unless (string= system-name "")
  (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                      (not (gnutls-available-p))))
         (proto (if no-ssl "http" "https")))
    (when no-ssl
      (warn "no ssl bad :("))
    ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
    (add-to-list 'package-archives (cons "melpa" (concat proto "://")) t)
    (add-to-list 'package-archives (cons "org" (concat proto "://")) t)
    (when (< emacs-major-version 24)
      ;; For important compatibility libraries like cl-lib
      (add-to-list 'package-archives (cons "gnu" (concat proto "://"))))))

(when (string= system-name "")
  (add-to-list 'package-archives (cons "melpa" "") t)
  (add-to-list 'package-archives (cons "org" "") t))

(when (version< emacs-version "27.0.50")

ensure use-package

(unless (package-installed-p 'use-package)
  (package-install 'use-package))

(eval-when-compile (require 'use-package))

(setq use-package-always-ensure t)


(use-package auto-package-update
  :ensure t
  (setq auto-package-update-delete-old-versions t
        auto-package-update-interval 3)

machine dependent vars

Set some machine dependent variables that we’ll use later. Defaults are set to macOS setup. Doing this all in one place to isolate all of the when/if calls that would be spread out otherwise.

(defvar ddavis-font '(font . "Roboto Mono for Powerline-12")
  "default font to use")
(defvar ddavis-clang-exe "/usr/local/opt/llvm/bin/clang"
  "clang executable path")
(defvar ddavis-clangd-exe "/usr/local/opt/llvm/bin/clangd"
  "clangd executable path")
(defvar ddavis-rg-exe "/usr/local/bin/rg"
  "ripgrep executable")
(defvar ddavis-default-python "~/Software/Python/anaconda3/bin/python3"
  "default python exe")
(defvar ddavis-default-ipython "~/Software/Python/anaconda3/bin/ipython3"
  "default ipython exe")
(defvar ddavis-default-pyls "~/Software/Python/anaconda3/bin/pyls"
  "default pyls")

;;(when (eq system-type 'darwin)
;;  (mac-auto-operator-composition-mode))

(when (string= (system-name) "")
  (setq ddavis-font '(font . "Ubuntu Mono-12")
        ddavis-clang-exe "~/Software/LLVM/releases/8.0.0/bin/clang"
        ddavis-clangd-exe "~/Software/LLVM/releases/8.0.0/bin/clangd"
        ddavis-rg-exe "~/.cargo/bin/rg")
  (setq browse-url-browser-function 'browse-url-generic
        browse-url-generic-program "google-chrome"))

(when (string= (system-name) "cc7")
  (setq ddavis-font '(font . "Ubuntu Mono-12")
        ddavis-clang-exe "~/Software/LLVM/releases/8.0.0/bin/clang"
        ddavis-clangd-exe "~/Software/LLVM/releases/8.0.0/bin/clangd"
        ddavis-rg-exe "~/.cargo/bin/rg")
  (setq browse-url-browser-function 'browse-url-generic
        browse-url-generic-program "google-chrome"))

(when (string= (system-name) "pion")
  (setq ddavis-font '(font . "-*-fira code retina-medium-*-normal-*-*-120-120-100-m-0-*-*")
        ddavis-rg-exe (executable-find "rg")
        ddavis-clang-exe "~/Software/LLVM/releases/HEAD/bin/clang"
        ddavis-clangd-exe "~/Software/LLVM/releases/HEAD/bin/clangd"))


(setq custom-file (concat user-emacs-directory "/custom.el"))
(setq inhibit-startup-screen t)
(when (eq system-type 'darwin)
  (setq mac-right-command-modifier 'super)
  ;; (setq mac-left-option-modifier 'meta)
  (setq mac-option-modifier 'meta)
  (setq mac-command-modifier 'super))


(when (eq system-type 'darwin)
  (use-package exec-path-from-shell
    :ensure t
    (when (memq window-system '(mac ns x))
(use-package shell-pop)


initial setup

(defun ddavis/mu4e-machines ()
  (bool-vector (eq system-type 'darwin)
               (string= (system-name) "pion")
               (string= (system-name) "")))

(setq ddavis-use-mu4e
      (> (bool-vector-count-population
          (ddavis/mu4e-machines)) 0))

(when ddavis-use-mu4e

  ;;(setq mu4e-view-use-gnus t)

  (setq mu4e-change-filenames-when-moving t)
  (setq mu4e-get-mail-command "mbsync standard")

  (setq mu4e-update-interval 90
        mu4e-maildir "~/.mail"
        message-send-mail-function 'message-send-mail-with-sendmail)

  (when (eq system-type 'darwin)
    (add-to-list 'load-path "~/Software/localbase/share/emacs/site-lisp/mu4e")
    (setq sendmail-program "~/Software/localbase/bin/msmtp"
          mu4e-get-mail-command "~/Software/localbase/bin/mbsync standard"
          mu4e-mu-binary "~/Software/localbase/bin/mu"))

  (when (string= (system-name) "")
    (add-to-list 'load-path "~/Software/localbase/share/emacs/site-lisp/mu4e")
    (setq sendmail-program "/usr/bin/msmtp"
          mu4e-mu-binary "~/Software/localbase/bin/mu"))

  (when (string= (system-name) "pion")
    (add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
    (setq sendmail-program "/usr/bin/msmtp"
          mu4e-mu-binary "/usr/bin/mu"))

  (require 'mu4e)

  (setq message-kill-buffer-on-exit t)

  (define-key global-map (kbd "C-c 4") 'mu4e)
  (define-key mu4e-headers-mode-map (kbd "C-c k") 'mu4e-kill-update-mail)
  (define-key mu4e-view-mode-map (kbd "C-c k") 'mu4e-kill-update-mail)
  (define-key mu4e-main-mode-map (kbd "C-c k") 'mu4e-kill-update-mail))


(when ddavis-use-mu4e
  (setq mu4e-contexts
        `( ,(make-mu4e-context
             :name "cern"
             :enter-func (lambda () (mu4e-message "Entering CERN context"))
             :leave-func (lambda () (mu4e-message "Leaving CERN context"))
             :match-func (lambda (msg)
                           (when msg
                             (string-match-p "^/cern" (mu4e-message-field msg :maildir))))
             :vars '( ( user-mail-address      . "" )
                      ( user-email-address     . "" )
                      ( user-full-name         . "Douglas Davis" )
                      ( mu4e-trash-folder      . "/cern/Trash" )
                      ( mu4e-sent-folder       . "/cern/Sent" )
                      ( mu4e-drafts-folder     . "/cern/Drafts" )
                      ( mu4e-reply-to-address  . "" )))

             :name "duke"
             :enter-func (lambda () (mu4e-message "Entering Duke context"))
             :leave-func (lambda () (mu4e-message "Leaving Duke Context"))
             :match-func (lambda (msg)
                           (when msg
                             (string-match-p "^/duke" (mu4e-message-field msg :maildir))))
             :vars '( ( user-mail-address       . "" )
                      ( user-email-address      . "" )
                      ( user-full-name          . "Douglas Davis" )
                      ( mu4e-trash-folder       . "/duke/Trash" )
                      ( mu4e-sent-folder        . "/duke/Sent" )
                      ( mu4e-drafts-folder      . "/duke/Drafts" )
                      ( mu4e-reply-to-address   . "" ))))))

(when (and (eq system-type 'darwin) ddavis-use-mu4e)
  (add-to-list 'mu4e-contexts
                :name "fastmail"
                :enter-func (lambda () (mu4e-message "Entering FastMail context"))
                :leave-func (lambda () (mu4e-message "Leaving FastMail context"))
                :match-func (lambda (msg)
                              (when msg
                                (string-match-p "^/fastmail" (mu4e-message-field msg :maildir))))
                :vars '( ( user-mail-address      . "" )
                         ( user-email-address     . "" )
                         ( user-full-name         . "Doug Davis" )
                         ( mu4e-trash-folder      . "/fastmail/Trash" )
                         ( mu4e-sent-folder       . "/fastmail/Sent" )
                         ( mu4e-drafts-folder     . "/fastmail/Drafts" )
                         ( mu4e-reply-to-address  . "" )))))


(when ddavis-use-mu4e
  (setq mu4e-bookmarks ())
  (add-to-list 'mu4e-bookmarks
                :name "The week"
                :query ""
                :key ?7))
  (add-to-list 'mu4e-bookmarks
                :name "Unread"
                :query "flag:unread AND NOT flag:trashed"
                :key ?u))
  (add-to-list 'mu4e-bookmarks
                :name "Today and yesterday INBOXes"
                :query " and (m:/duke/INBOX or m:/cern/INBOX or m:/fastmail/INBOX)"
                :key ?t))
  (add-to-list 'mu4e-bookmarks
                :name "Yesterday's and Today's Messages"
                :query ""
                :key ?y))
  (add-to-list 'mu4e-bookmarks
                :name "Last 3 days"
                :query ""
                :key ?3))
  (add-to-list 'mu4e-bookmarks
                :name "Duke today"
                :query " and m:/duke*"
                :key ?d))
  (add-to-list 'mu4e-bookmarks
                :name "Last day's work"
                :query " and not m:/fastmail*"
                :key ?w))
  (add-to-list 'mu4e-bookmarks
                :name "Recent work"
                :query " and not m:/fastmail*"
                :key ?r))
  (add-to-list 'mu4e-bookmarks
                :name "FastMail today"
                :query " and m:/fastmail*"
                :key ?f))
  (add-to-list 'mu4e-bookmarks
                :name "CERN today"
                :query " and m:/cern*"
                :key ?c)))


This code is taken from this gist.

   (when ddavis-use-mu4e

     ;; Refactored from

     (defun mu4e~headers-msg-unread-p (msg)
	 "Check if MSG is unread."
	 (let ((flags (mu4e-message-field msg :flags)))
	   (and (member 'unread flags) (not (member 'trashed flags)))))

     (defvar mu4e-headers-folding-slug-function
	 (lambda (headers) (format " (%d)" (length headers)))
	 "Function to call to generate the slug that will be appended to folded threads.
   This function receives a single argument HEADERS, which is a list
   of headers about to be folded.")

     (defun mu4e~headers-folded-slug (headers)
	 "Generate a string to append to the message line indicating the fold status.
   HEADERS is a list with the messages being folded (including the root header)."
	 (funcall mu4e-headers-folding-slug-function headers))

     (defun mu4e~headers-fold-make-overlay (beg end headers)
	 "Hides text between BEG and END using an overlay.
   HEADERS is a list with the messages being folded (including the root header)."
	 (let ((o (make-overlay beg end)))
	   (overlay-put o 'mu4e-folded-thread t)
	   (overlay-put o 'display (mu4e~headers-folded-slug headers))
	   (overlay-put o 'evaporate t)
	   (overlay-put o 'invisible t)))

     (defun mu4e~headers-fold-find-overlay (loc)
	 "Find and return the 'mu4e-folded-thread overlay at LOC, or return nil."
	 (cl-dolist (o (overlays-in (1- loc) (1+ loc)))
	   (when (overlay-get o 'mu4e-folded-thread)
	     (cl-return o))))

     (defun mu4e-headers-fold-all ()
	 "Fold all the threads in the current view."
	 (let ((thread-id "") msgs fold-start fold-end)
	    (lambda (msg)
	      (push msg msgs)
	      (let ((this-thread-id (mu4e~headers-get-thread-info msg 'thread-id)))
		(if (string= thread-id this-thread-id)
		    (setq fold-end (point))
		  (when (< 1 (length msgs))
		    (mu4e~headers-fold-make-overlay fold-start fold-end (nreverse msgs)))
		  (setq fold-start (point)
			fold-end (point)
			msgs nil
			thread-id this-thread-id)))))
	   (when (< 1 (length msgs))
	     (mu4e~headers-fold-make-overlay fold-start fold-end (nreverse msgs)))))

     (defun mu4e-headers-toggle-thread-folding (&optional subthread)
	 "Toggle the folding state for the thread at point.
   If SUBTHREAD is non-nil, only fold the current subthread."
	 ;; Folding is accomplished using an overlay that starts at the end
	 ;; of the parent line and ends at the end of the last descendant
	 ;; line. If there's no overlay, it means it isn't folded
	 (interactive "P")
	 (if-let ((o (mu4e~headers-fold-find-overlay (point-at-eol))))
		 (delete-overlay o)
		 (let* ((msg (mu4e-message-at-point))
			(thread-id (mu4e~headers-get-thread-info msg 'thread-id))
			(path-re (concat "^" (mu4e~headers-get-thread-info msg 'path)))
			msgs first-marked-point last-marked-point)
		    (lambda (submsg)
		      (when (and (string= thread-id (mu4e~headers-get-thread-info submsg 'thread-id))
				 (or (not subthread)
				     (string-match-p path-re (mu4e~headers-get-thread-info submsg 'path))))
			(push msg msgs)
			(setq last-marked-point (point-at-eol))
			(unless first-marked-point
			  (setq first-marked-point last-marked-point)))))
		   (when (< 1 (length msgs))
		     (mu4e~headers-fold-make-overlay first-marked-point last-marked-point (nreverse msgs))))))

     (define-key 'mu4e-headers-mode-map (kbd "TAB") 'mu4e-headers-toggle-thread-folding)
     (define-key 'mu4e-headers-mode-map (kbd "C-c TAB") 'mu4e-headers-fold-all))


(when ddavis-use-mu4e
  (setq mu4e-compose-reply-ignore-address
(when ddavis-use-mu4e
  (defun ddavis/mu4e-toggle-gnus ()
    (setq mu4e-view-use-gnus (not mu4e-view-use-gnus)))
  (define-key mu4e-headers-mode-map (kbd "C-c g") 'ddavis/mu4e-toggle-gnus))

(use-package mu4e-maildirs-extension :ensure t :after mu4e :config (mu4e-maildirs-extension))

(when ddavis-use-mu4e
  (setq w3m-default-desplay-inline-images t)
  (defun mu4e-action-view-in-w3m ()
    "View the body of the message in emacs w3m."
    (w3m-browse-url (concat "file://"
                            (mu4e~write-body-to-html (mu4e-message-at-point t)))))
  (define-key mu4e-view-mode-map (kbd "M") 'mu4e-action-view-in-w3m))

(when ddavis-use-mu4e (use-package visual-fill-column :ensure t :after mu4e :hook ((visual-line-mode . visual-fill-column-mode) (mu4e-view-mode . visual-line-mode)) :config (add-hook ‘mu4e-view-mode-hook (lambda () (setq-local fill-column 98)))))


(use-package projectile
  :ensure t
  (after-init . projectile-mode))


(use-package helm
  :ensure t
  (setq helm-autoresize-max-height 50)
  (setq helm-autoresize-min-height 30)
  (require 'helm-config)
  (setq helm-split-window-in-side-p t
        helm-split-window-default-side 'below
        helm-idle-delay 0.0
        helm-input-idle-delay 0.01
        helm-quick-update t
        helm-ff-skip-boring-files t)
  (helm-autoresize-mode 1)
  (helm-mode 1)
  :bind (("C-x C-f" . helm-find-files)
         ("C-x C-t" . find-file)
         ("C-x b" . helm-buffers-list)
         ("C-x r b" . helm-bookmarks)
         ("C-x m" . helm-M-x)
         :map helm-map
         ("<tab>" . helm-execute-persistent-action)))

(use-package helm-projectile
  :ensure t
  (setq projectile-completion-system 'helm)
  (require 'helm-projectile)
  (define-key global-map (kbd "C-c h p") 'helm-projectile)
  (setq helm-split-window-in-side-p t))

(use-package helm-rg
  :ensure t
  (setq helm-rg-ripgrep-executable ddavis-rg-exe)
  (require 'helm-rg)
  (define-key global-map (kbd "C-c s r") 'helm-projectile-rg))


(use-package which-key
  :ensure t
  (after-init . which-key-mode))

tramp fix

(defun ddavis/lets-use-tramp ()
  (define-key global-map (kbd "C-x C-f") 'find-file)
  (define-key global-map (kbd "C-x b") 'switch-to-buffer))


(use-package yasnippet
  :ensure t
  (require 'yasnippet)
  (yas-global-mode 1))

(use-package yasnippet-snippets
  :ensure t
  (require 'yasnippet-snippets))


(use-package iedit
  :ensure t
  :bind ("C-c ;" . 'iedit-mode))


(when window-system
  (use-package solarized-theme
    :ensure t
    (setq custom-safe-themes t)
    (setq solarized-scale-org-headlines nil)
    ;; make the fringe stand out from the background
    (setq solarized-distinct-fringe-background t)
    ;; Don't change the font for some headings and titles
    (setq solarized-use-variable-pitch nil)
    ;; Avoid all font-size changes
    (setq solarized-height-minus-1 1.0)
    (setq solarized-height-plus-1 1.0)
    (setq solarized-height-plus-2 1.0)
    (setq solarized-height-plus-3 1.0)
    (setq solarized-height-plus-4 1.0)
    (load-theme 'solarized-light)
    (let ((line (face-attribute 'mode-line :underline)))
      (set-face-attribute 'mode-line           nil :overline   line)
      (set-face-attribute 'mode-line-inactive  nil :overline   line)
      (set-face-attribute 'mode-line-inactive  nil :underline  line)
      (set-face-attribute 'mode-line           nil :box        nil)
      (set-face-attribute 'mode-line-inactive  nil :box        nil)
      (set-face-attribute 'mode-line-buffer-id nil :box        nil))))

moody and minions

(use-package moody
  :ensure t
  (setq x-underline-at-descent-line t)
  (if (eq system-type 'darwin)
      (setq moody-slant-function #'moody-slant-apple-rgb))

(use-package minions :ensure t :config (minions-mode 1))

tabs are spaces

(setq-default indent-tabs-mode nil)


Not liking this right now so dont use

(setq split-width-threshold 0
      split-height-threshold nil)

no ring

(setq ring-bell-function 'ignore)


(fset 'yes-or-no-p 'y-or-n-p)


(setq echo-keystrokes 0.001)

{menu,tool,scroll} bar off

(scroll-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)
(menu-bar-mode -1)

line numbers

(when (version<= "26.0.50" emacs-version)
(setq column-number-mode t)

window size

(add-to-list 'default-frame-alist '(height . 74))
(add-to-list 'default-frame-alist '(width . 216))


(setq show-paren-delay 0)
(show-paren-mode 1)


(defun ddavis/auto-follow-symlinks ()
  (setq vc-follow-symlinks t))


(use-package magit
  :ensure t
  :bind ("C-c m s" . 'magit-status))

save and lock files

;; put ~ files in ~/.saves
 backup-by-copying t
 '(("." . "~/.saves"))
 delete-old-versions t
 kept-new-versions 3
 kept-old-versions 2
 version-control t)
(setq create-lockfiles nil)


(add-to-list 'default-frame-alist ddavis-font)
(set-face-italic 'font-lock-comment-face nil)
(when (string= (system-name) "")
  (set-face-attribute 'region nil :background "white" :foreground "dim gray" :inverse-video t))
;; See the following for more details
;; and also see the following on a recent GNU/Linux or similar system:
;;     /usr/share/doc/fontconfig/fontconfig-user.html
;; for the explanation of spacing=100
;; also see the following UNIX StackExchange answer:
(defun ddavis/compare-monospace-font-families ()
  "Display a list of all monospace font faces. Tested on GNU/Linux."
  (pop-to-buffer "*Monospace Fonts*")
  (dolist (font-name (seq-filter (lambda (font)
                                   (when-let ((info (font-info font)))
                                     (string-match-p "spacing=100" (aref info 1))))
      (concat "1 l; 0 O o [ < = > ] " font-name ")\n")
      'font-lock-face `((:family
                         ,(format "%s" (font-get (font-spec :name font-name) :family))))))))



(use-package org
  :bind (("<A-down>" . 'org-move-subtree-down)
         ("<A-up>" . 'org-move-subtree-up)
         ("<A-left>" . 'org-promote-subtree)
         ("<A-right>" . 'org-demote-subtree))
  (setq org-src-fontify-natively t)
  (require 'org-tempo)
  (setq org-structure-template-alist
        (append org-structure-template-alist
                '(("el" . "src emacs-lisp :results silent")
                  ("py" . "src python :results silent")
                  ("cpp" . "src C++")))))

(use-package org-bullets
  :ensure t
  (org-mode . org-bullets-mode))


(use-package org-jira
  :ensure t
  (setq jiralib-url "")
  (require 'org-jira))

extra ox

(use-package ox-hugo
  :ensure t
  :after ox)
(use-package ox-reveal
  :ensure t
  :after ox)
(defun ddavis/fix-org-beamer ()
  (setq org-structure-template-alist
        (delete '("n" "#+BEGIN_NOTES\n?\n#+END_NOTES")
(add-hook 'org-mode-hook 'ddavis/fix-org-beamer)


 '((python . t)))


(define-key global-map "\C-ca" 'org-agenda)
(setq org-agenda-files (list "~/Dropbox/org/agenda/"))

(setq org-agenda-custom-commands
      '(("c" "Simple agenda view"
         ((agenda "")
          (alltodo "")))))

html stuff

(use-package htmlize)


 (lambda (language-mode-hook)
   (add-hook language-mode-hook 'flyspell-mode))

executable scripts

dont use for now

(defun ddavis/force-scripts-executable () (interactive) (add-hook ‘after-save-hook ‘executable-make-buffer-file-executable-if-script-p)) (ddavis/force-scripts-executable)



(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.icc\\'" . c++-mode))

IDE via eglot

(defun ddavis/projectile-proj-find-function (dir)
  (let ((root (projectile-project-root dir)))
    (and root (cons 'transient root))))

(defun ddavis/cpp-eglot-setup ()
  "enable variables and hooks for eglot cpp IDE"
  (use-package eglot
    :ensure t
    (require 'eglot))
  (setq company-backends (cons 'company-capf (remove 'company-capf company-backends)))
  (projectile-mode t)
  (with-eval-after-load 'project
    (add-to-list 'project-find-functions 'ddavis/projectile-proj-find-function))
  (add-to-list 'eglot-server-programs
               `((c++-mode) ,ddavis-clangd-exe)))



(setq python-shell-interpreter ddavis-default-python)

format with black

(use-package blacken
  :ensure t
  (setq blacken-executable "~/Software/Python/anaconda3/bin/black"))

IDE via eglot

(defun ddavis/python-eglot-enable ()
  "set variables and hook for eglot python IDE"
  (use-package eglot
    :ensure t
    (require 'eglot))
  (setq company-backends (cons 'company-capf (remove 'company-capf company-backends)))
  (add-to-list 'eglot-server-programs
               `((python-mode) ,ddavis-default-pyls)))


(defun ddavis/python-jupyter-use-twaml ()
  (use-package ein
    :ensure t
    (require 'ein))

  (setq ein:jupyter-default-server-command


(use-package lsp-mode
  :ensure t
  :commands lsp
  (setq lsp-clients-clangd-executable ddavis-clangd-exe)
  (setq lsp-enable-on-type-formatting nil)
  (setq lsp-auto-guess-root t))

(use-package lsp-ui
  :ensure t
  :commands lsp-ui-mode
  (setq lsp-ui-sideline-show-hover nil))

(use-package company-lsp
  :ensure t
  :commands company-lsp)

(defun ddavis/python-twaml ()
  (setq lsp-clients-python-command "~/Software/Python/anaconda3/envs/twaml/bin/pyls"))

(defun ddavis/python-pygramdev ()
  (setq lsp-clients-python-command "~/Software/Python/anaconda3/envs/pygramdev/bin/pyls"))

delete trailing white space

 (lambda (language-mode-hook)
   (add-hook language-mode-hook
             (lambda ()
               (add-to-list 'write-file-functions 'delete-trailing-whitespace))))


(use-package company
  (setq company-clang-executable ddavis-clang-exe)
  (add-hook 'emacs-lisp-mode-hook 'company-mode)
  (add-hook 'python-mode-hook 'company-mode)
  (add-hook 'mu4e-compose-mode-hook 'company-mode)
  (add-hook 'sh-mode-hook 'company-mode)
  (add-hook 'LaTeX-mode-hook 'company-mode))


(use-package spaceline :ensure t :hook (after-init . spaceline-helm-mode) :config (require ‘spaceline-config) (spaceline-emacs-theme))

cua selection

(defun ddavis/enable-cua-selection ()
  "turn on cua-selection-mode"
  (cua-selection-mode t))


(use-package elfeed
  :ensure t
  :bind ("C-x w" . 'elfeed)
  (setq elfeed-feeds
  (setq-default elfeed-search-filter "@4-weeks-ago"))


(use-package flymd
  :ensure t
  (require 'flymd)
  (if (eq system-type 'darwin)
      (defun my-flymd-browser-function (url)
        (let ((process-environment (browse-url-process-environment)))
          (apply 'start-process
                 (concat "firefox " url)
                 (list "-a" "firefox" url))))
    (setq flymd-browser-open-function 'my-flymd-browser-function)

    (defun my-flymd-browser-function (url)
      (let ((browse-url-browser-function 'browse-url-firefox))
        (browse-url url)))
    (setq flymd-browser-open-function 'my-flymd-browser-function)))

move lines

(defun ddavis/move-line-up ()
  "Move up the current line."
  (transpose-lines 1)
  (forward-line -2)

(defun ddavis/move-line-down ()
  "Move down the current line."
  (forward-line 1)
  (transpose-lines 1)
  (forward-line -1)

(when (eq system-type 'darwin)
  (global-set-key [(meta shift up)]  'ddavis/move-line-up)
  (global-set-key [(meta shift down)]  'ddavis/move-line-down))


You can’t perform that action at this time.