]> git.donarmstrong.com Git - lib.git/blobdiff - emacs_el/configuration/don-configuration.org
add flycheck
[lib.git] / emacs_el / configuration / don-configuration.org
index a71ad339e6d5285a4e40cf279836dd26fe378d8e..6235cc871256b51bf0d5be3082728b4e4bd7ee6a 100644 (file)
@@ -1,4 +1,5 @@
 #+PROPERTY: header-args:emacs-lisp :tangle don-configuration.el
+#+OPTIONS: auto-id:f
 * Load debugger
 
 # if for some reason, things get pear-shaped, we want to be able to
@@ -7,6 +8,25 @@
 #+BEGIN_SRC emacs-lisp
 (setq debug-on-event 'siguser2)
 #+END_SRC
+* Paths
+** Update PATH
+#+BEGIN_SRC emacs-lisp
+  (add-to-list 'exec-path '"/usr/local/bin")
+  (add-to-list 'exec-path '"~/bin/")
+#+END_SRC
+** Add library paths
+#+BEGIN_SRC emacs-lisp
+(eval-when-compile
+  (let ((default-directory "~/var/emacs/elpa"))
+    (normal-top-level-add-subdirs-to-load-path))
+  )
+(add-to-list 'load-path '"~/lib/emacs_el/")
+(let ((default-directory "~/lib/emacs_el/"))
+  (normal-top-level-add-subdirs-to-load-path))
+(let ((default-directory "~/var/emacs/elpa"))
+  (normal-top-level-add-subdirs-to-load-path))
+(setq package-user-dir "~/var/emacs/elpa")
+#+END_SRC
 * Initial startup stuff
 ** Disable startup screen
 #+BEGIN_SRC emacs-lisp
 #+END_SRC
 * Package management
 ** package repositories and package manager
-Borrowed from https://github.com/nilcons/emacs-use-package-fast/ to
-load  [[https://github.com/jwiegley/use-package/][use-package]] even faster
-#+BEGIN_SRC emacs-lisp
-  (eval-and-compile
-    ;; add /etc/ssl/ca-global/ca-certificates.crt so that we can
-    ;; download packages when we're on Debian hosts which chop down the
-    ;; list of available certificates
-    (require 'gnutls)
-    (add-to-list 'gnutls-trustfiles "/etc/ssl/ca-global/ca-certificates.crt")
-    (setq package-enable-at-startup nil)
-    (setq package--init-file-ensured t)
-    (setq package-user-dir "~/var/emacs/elpa")
-    (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
-                             ("melpa" . "https://melpa.org/packages/")
-                             ("org" . "http://orgmode.org/elpa/")))
-    (setq use-package-verbose (not (bound-and-true-p byte-compile-current-file))))
-  (mapc #'(lambda (add) (add-to-list 'load-path add))
-    (eval-when-compile
-      (package-initialize)
-      (unless (package-installed-p 'use-package)
-        (package-refresh-contents)
-        (package-install 'use-package))
-      (let ((package-user-dir-real (file-truename package-user-dir)))
-        ;; The reverse is necessary, because outside we mapc
-        ;; add-to-list element-by-element, which reverses.
-        (nreverse (apply #'nconc
-                 ;; Only keep package.el provided loadpaths.
-                 (mapcar #'(lambda (path)
-                     (if (string-prefix-p package-user-dir-real path)
-                         (list path)
-                       nil))
-                     load-path))))))
-
-  ;;; fix up info paths for packages
-  (with-eval-after-load "info"
-    (info-initialize)
-    (dolist (dir (directory-files package-user-dir))
-      (let ((fdir (concat (file-name-as-directory package-user-dir) dir)))
-        (unless (or (member dir '("." ".." "archives" "gnupg"))
-                    (not (file-directory-p fdir))
-                    (not (file-exists-p (concat (file-name-as-directory fdir) "dir"))))
-          (add-to-list 'Info-directory-list fdir)))))
-
-
-  (eval-when-compile
-    (require 'use-package))
-  (require 'bind-key)
-  (require 'diminish)
+#+BEGIN_SRC emacs-lisp
+  (require 'use-package)
+(require 'gnutls)
+  (add-to-list 'gnutls-trustfiles "/etc/ssl/ca-global/ca-certificates.crt")
+  (setq package-enable-at-startup nil)
+  (setq package--init-file-ensured t)
+  (setq package-user-dir "~/var/emacs/elpa")
+  (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
+                          ("melpa" . "https://melpa.org/packages/")
+                          ("org" . "http://orgmode.org/elpa/")))
+  (setq use-package-verbose (not (bound-and-true-p byte-compile-current-file)))
+
 #+END_SRC
 ** Paradox
 #+BEGIN_SRC emacs-lisp
@@ -84,18 +68,6 @@ load  [[https://github.com/jwiegley/use-package/][use-package]] even faster
     (setq paradox-github-token t) ; I don't want to be prompted about this integration
     )
 #+END_SRC
-* Paths
-** Update PATH
-#+BEGIN_SRC emacs-lisp
-  (add-to-list 'exec-path '"/usr/local/bin")
-  (add-to-list 'exec-path '"~/bin/")
-#+END_SRC
-** Add library paths
-
-#+BEGIN_SRC emacs-lisp
-  (add-to-list 'load-path '"~/lib/emacs_el/")
-  (add-to-list 'load-path '"~/lib/emacs_el/magit-annex")
-#+END_SRC
 * Disable custom-vars
 #+BEGIN_SRC emacs-lisp
   ;; Set the custom file to /dev/null and don't bother to load it
@@ -169,6 +141,36 @@ load  [[https://github.com/jwiegley/use-package/][use-package]] even faster
     )
 
 #+END_SRC
+
+** Flycheck
+#+begin_src emacs-lisp :tangle yes
+(use-package flycheck
+  :ensure t
+  :diminish ðŸ¦‹
+  :if (version<= "24.4" emacs-version)
+  :commands flycheck-mode
+  :hook ((prog-mode . flycheck-mode)
+         )
+)
+;; Other pkgs
+(use-package flycheck-tip
+  :ensure t
+  :commands 'flycheck-tip-cycle
+  :after flycheck
+  :bind (:map flycheck-mode-map
+              ("C-c C-n" . flycheck-tip-cycle)))
+
+(use-package flycheck-package
+  :ensure t)
+
+(use-package flycheck-checkpatch
+  :ensure t
+  :config (flycheck-checkpatch-setup)
+  :config (setq flycheck-checkers (delete 'checkpatch
+  flycheck-checkers))
+  :config (add-to-list 'flycheck-checkers 'checkpatch t))
+#+end_src  
+
 ** Flymake
 #+begin_src emacs-lisp :tangle yes
   (use-package flymake
@@ -681,10 +683,12 @@ value, scrolling continues until there is no more output.
 ** SQL mode
 #+BEGIN_SRC emacs-lisp
   ; load sql-indent when sql is loaded
+(use-package sql-indent
+  :hook sql-mode
+  )
 (use-package sql
   :mode (("\\.sql\\'" . sql-mode))
-  :config
-  (require sql-indent))
+  )
 #+END_SRC
 ** Ediff
 #+BEGIN_SRC emacs-lisp
@@ -1325,9 +1329,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
     )
 #+END_SRC
 ** Multiple Cursors
-   :PROPERTIES:
-   :ID:       6fcf218b-a762-4c37-9339-a8202ddeb544
-   :END:
 [[https://github.com/magnars/multiple-cursors.el][Multiple Cursors]]
 #+BEGIN_SRC emacs-lisp
   (use-package multiple-cursors
@@ -1392,14 +1393,51 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
     (setq default-abbrev-mode t))
 #+END_SRC
 
+** Debugging (realgud)
+#+BEGIN_SRC emacs-lisp
+(use-package realgud
+  :ensure t
+  )
+#+END_SRC
 ** Python Programming
 #+BEGIN_SRC emacs-lisp
-  (use-package elpy
-    :ensure t
-    :init
-    (elpy-enable)
-    )
+(use-package python-mode
+  :hook
+  (python-mode . pyenv-mode)
+  (python-mode . flycheck-mode)
+  (python-mode . company-mode)
+  (python-mode . blacken-mode)
+  (python-mode . yas-minor-mode)
+  (python-mode . anaconda-mode)
+  )
+(use-package pyenv
+  :ensure t
+  )
+(use-package blacken
+  :init
+  (setq-default blacken-fast-unsafe t)
+  (setq-default blacken-line-length 80)
+  :ensure t)
+(use-package anaconda-mode
+  :ensure t
+  )
+
+(use-package elpy
+  :ensure t
+  :init
+  (elpy-enable)
+  )
 #+END_SRC
+# *** Jedi
+# #+BEGIN_SRC emacs-lisp
+#   (use-package company-jedi
+#     :ensure t
+#     :hook (python-mode . (add-to-list 'company-backends 'company-jedi))
+#     :hook (python-mode  . 'jedi:setup)
+#     :config
+#     (setq jedi:complete-on-dot t)
+#     )
+# #+END_SRC
 *** Black
 #+begin_src emacs-lisp :tangle yes
   (use-package python-black
@@ -1408,10 +1446,16 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 #+end_src
 *** Sphinx Documentation
 #+begin_src emacs-lisp :tangle yes
+  (use-package numpydoc
+    :ensure t
+    :after python
+    :bind (:map python-mode-map
+                ("C-c C-n" . numpydoc-generate)))
   (use-package sphinx-doc
     :ensure t
     :config
     (sphinx-doc-mode t)
+    (setq sphinx-doc-include-types t)
     :after python)
 #+end_src
 ** Go language
@@ -1791,22 +1835,27 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
   (setq org-use-fast-todo-selection t)
   (setq org-treat-S-cursor-todo-selection-as-state-change nil)
 
-  ; create function to create headlines in file. This comes from
-  ; http://stackoverflow.com/questions/13340616/assign-ids-to-every-entry-in-org-mode
-  (defun my/org-add-ids-to-headlines-in-file ()
-    "Add ID properties to all headlines in the current file which
-  do not already have one."
-    (interactive)
-    (org-map-entries 'org-id-get-create))
-  (defun dla/org-update-ids-to-headlines-in-file ()
-    "Add or replace ID properties to all headlines in the current file 
-  (or narrowed region)."
-    (interactive)
-    (org-map-entries '(lambda () (org-id-get-create t))))
-  ; if we wanted to do this to every buffer, do the following:
-  ; (add-hook 'org-mode-hook
-  ;           (lambda ()
-  ;             (add-hook 'before-save-hook 'my/org-add-ids-to-headlines-in-file nil 'local)))
+; create function to create headlines in file. This comes from
+; http://stackoverflow.com/questions/13340616/assign-ids-to-every-entry-in-org-mode
+(defun my/org-add-ids-to-headlines-in-file ()
+  "Add ID properties to all headlines in the current file which
+do not already have one."
+  (interactive)
+  (save-excursion
+    (widen)
+    (goto-char (point-min))
+    (when (not (re-search-forward "^#\\+OPTIONS:.*auto-id:f" (point-max) t))
+      (org-map-entries 'org-id-get-create))))
+(defun dla/org-update-ids-to-headlines-in-file ()
+  "Add or replace ID properties to all headlines in the current file 
+(or narrowed region)."
+  (interactive)
+
+  (org-map-entries '(lambda () (org-id-get-create t))))
+; if we wanted to do this to every buffer, do the following:
+(add-hook 'org-mode-hook
+          (lambda ()
+            (add-hook 'before-save-hook 'my/org-add-ids-to-headlines-in-file nil 'local)))
 #+END_SRC
 ** Org ID locations
 #+BEGIN_SRC emacs-lisp
@@ -2058,9 +2107,6 @@ Maildir, or by Message-ID."
 
 #+END_SRC
 ** LaTeX configuration
-   :PROPERTIES:
-   :ID:       7135ba17-6a50-4eed-84ca-b90afa5b12f8
-   :END:
 #+BEGIN_SRC emacs-lisp
 (use-package ox-extra
   :config
@@ -2283,7 +2329,7 @@ as the default task."
   ;; We're in the agenda
   ;;
   (let* ((marker (org-get-at-bol 'org-hd-marker))
-         (tags (org-with-point-at marker (org-get-tags-at))))
+         (tags (org-with-point-at marker (org-get-tags))))
     (if (and (eq arg 4) tags)
         (org-agenda-clock-in '(16))
       (bh/clock-in-organization-task-as-default)))
@@ -2592,18 +2638,15 @@ same directory as the org-buffer and insert a link to this file."
           (string-equal system-type "windows")
           )
       (progn
-        (setq x-select-enable-clipboard t)
-        (setq x-select-enable-primary nil)
+        (setq select-enable-clipboard t)
+        (setq select-enable-primary nil)
         )
     (progn
-      (setq x-select-enable-clipboard nil)
-      (setq x-select-enable-primary t)
+      (setq select-enable-clipboard nil)
+      (setq select-enable-primary t)
       ))
   ; (setq mouse-drag-copy-region t)
 
-  (fset 'perl-mode 'cperl-mode)
-  ;;(load-file "cperl-mode.el")
-
   ;; tramp configuration
   (setq tramp-use-ssh-controlmaster-options nil)