aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bard-lisp/hs-lint.el126
-rw-r--r--bookmarks20
-rw-r--r--catwithscarf.jpgbin0 -> 58165 bytes
-rw-r--r--packages.el183
4 files changed, 329 insertions, 0 deletions
diff --git a/bard-lisp/hs-lint.el b/bard-lisp/hs-lint.el
new file mode 100644
index 0000000..22352c4
--- /dev/null
+++ b/bard-lisp/hs-lint.el
@@ -0,0 +1,126 @@
+;;; hs-lint.el --- minor mode for HLint code checking
+
+;; Copyright 2009 (C) Alex Ott
+;;
+;; Author: Alex Ott <[email protected]>
+;; Keywords: haskell, lint, HLint
+;; Requirements:
+;; Status: distributed under terms of GPL2 or above
+
+;; Typical message from HLint looks like:
+;;
+;; /Users/ott/projects/lang-exp/haskell/test.hs:52:1: Eta reduce
+;; Found:
+;; count1 p l = length (filter p l)
+;; Perhaps:
+;; count1 p = length . filter p
+
+
+(require 'compile)
+
+(defgroup hs-lint nil
+ "Run HLint as inferior of Emacs, parse error messages."
+ :group 'tools
+ :group 'haskell)
+
+(defcustom hs-lint-command "hlint"
+ "The default hs-lint command for \\[hlint]."
+ :type 'string
+ :group 'hs-lint)
+
+(defcustom hs-lint-save-files t
+ "Save modified files when run HLint or no (ask user)"
+ :type 'boolean
+ :group 'hs-lint)
+
+(defcustom hs-lint-replace-with-suggestions nil
+ "Replace user's code with suggested replacements"
+ :type 'boolean
+ :group 'hs-lint)
+
+(defcustom hs-lint-replace-without-ask nil
+ "Replace user's code with suggested replacements automatically"
+ :type 'boolean
+ :group 'hs-lint)
+
+(defun hs-lint-process-setup ()
+ "Setup compilation variables and buffer for `hlint'."
+ (run-hooks 'hs-lint-setup-hook))
+
+;; regex for replace suggestions
+;;
+;; ^\(.*?\):\([0-9]+\):\([0-9]+\): .*
+;; Found:
+;; \s +\(.*\)
+;; Perhaps:
+;; \s +\(.*\)
+
+(defvar hs-lint-regex
+ "^\\(.*?\\):\\([0-9]+\\):\\([0-9]+\\): .*[\n\C-m]Found:[\n\C-m]\\s +\\(.*\\)[\n\C-m]Perhaps:[\n\C-m]\\s +\\(.*\\)[\n\C-m]"
+ "Regex for HLint messages")
+
+(defun make-short-string (str maxlen)
+ (if (< (length str) maxlen)
+ str
+ (concat (substring str 0 (- maxlen 3)) "...")))
+
+(defun hs-lint-replace-suggestions ()
+ "Perform actual replacement of suggestions"
+ (goto-char (point-min))
+ (while (re-search-forward hs-lint-regex nil t)
+ (let* ((fname (match-string 1))
+ (fline (string-to-number (match-string 2)))
+ (old-code (match-string 4))
+ (new-code (match-string 5))
+ (msg (concat "Replace '" (make-short-string old-code 30)
+ "' with '" (make-short-string new-code 30) "'"))
+ (bline 0)
+ (eline 0)
+ (spos 0)
+ (new-old-code ""))
+ (save-excursion
+ (switch-to-buffer (get-file-buffer fname))
+ (goto-line fline)
+ (beginning-of-line)
+ (setf bline (point))
+ (when (or hs-lint-replace-without-ask
+ (yes-or-no-p msg))
+ (end-of-line)
+ (setf eline (point))
+ (beginning-of-line)
+ (setf old-code (regexp-quote old-code))
+ (while (string-match "\\\\ " old-code spos)
+ (setf new-old-code (concat new-old-code
+ (substring old-code spos (match-beginning 0))
+ "\\ *"))
+ (setf spos (match-end 0)))
+ (setf new-old-code (concat new-old-code (substring old-code spos)))
+ (remove-text-properties bline eline '(composition nil))
+ (when (re-search-forward new-old-code eline t)
+ (replace-match new-code nil t)))))))
+
+(defun hs-lint-finish-hook (buf msg)
+ "Function, that is executed at the end of HLint execution"
+ (if hs-lint-replace-with-suggestions
+ (hs-lint-replace-suggestions)
+ (next-error 1 t)))
+
+(define-compilation-mode hs-lint-mode "HLint"
+ "Mode for check Haskell source code."
+ (set (make-local-variable 'compilation-process-setup-function)
+ 'hs-lint-process-setup)
+ (set (make-local-variable 'compilation-disable-input) t)
+ (set (make-local-variable 'compilation-scroll-output) nil)
+ (set (make-local-variable 'compilation-finish-functions)
+ (list 'hs-lint-finish-hook))
+ )
+
+(defun hs-lint ()
+ "Run HLint for current buffer with haskell source"
+ (interactive)
+ (save-some-buffers hs-lint-save-files)
+ (compilation-start (concat hs-lint-command " \"" buffer-file-name "\"")
+ 'hs-lint-mode))
+
+(provide 'hs-lint)
+;;; hs-lint.el ends here
diff --git a/bookmarks b/bookmarks
new file mode 100644
index 0000000..7f76c06
--- /dev/null
+++ b/bookmarks
@@ -0,0 +1,20 @@
+;;;; Emacs Bookmark Format Version 1;;;; -*- coding: utf-8-emacs; mode: lisp-data -*-
+;;; This format is meant to be slightly human-readable;
+;;; nevertheless, you probably don't want to edit it.
+;;; -*- End Of Bookmark File Format Version Stamp -*-
+(("conmerge"
+ (filename . "~/Code/conmerge/")
+ (front-context-string . "CHANGELOG.md\n d")
+ (rear-context-string . "80 Sep 8 18:24 ")
+ (position . 213))
+("Code"
+ (filename . "~/Code/")
+ (front-context-string . "conmerge\n drwxr")
+ (rear-context-string . "96 Sep 10 15:30 ")
+ (position . 204))
+("problems"
+ (filename . "~/Code/problems/")
+ (front-context-string . "codeforces\n drw")
+ (rear-context-string . "96 Sep 20 07:15 ")
+ (position . 210))
+)
diff --git a/catwithscarf.jpg b/catwithscarf.jpg
new file mode 100644
index 0000000..32a9e85
--- /dev/null
+++ b/catwithscarf.jpg
Binary files differ
diff --git a/packages.el b/packages.el
new file mode 100644
index 0000000..5e08d89
--- /dev/null
+++ b/packages.el
@@ -0,0 +1,183 @@
+;; |------------------------------------|
+;; | Packages |
+;; |------------------------------------|
+
+(require 'package)
+
+(setq package-archives '(("melpa" . "https://melpa.org/packages/")
+ ("org" . "https://orgmode.org/elpa/")
+ ("elpa" . "https://elpa.gnu.org/packages/")))
+
+(package-initialize)
+(unless package-archive-contents
+ (package-refresh-contents))
+
+;; Initialize use-package on non-Linux platforms
+(unless (package-installed-p 'use-package)
+ (package-install 'use-package))
+
+(require 'use-package)
+(setq use-package-always-ensure t)
+
+;; Ef-themes
+(use-package ef-themes
+ :ensure t
+ :config
+ ;;(load-theme 'ef-cyprus t)
+ (define-key global-map (kbd "<f5>") #'ef-themes-toggle)
+ (setq ef-themes-to-toggle '(ef-autumn ef-cyprus))
+ (setq ef-themes-headings
+ '((0 variable-pitch 1.8)
+ (1 variable-pitch 1.3)
+ (2 regular 1.2)
+ (3 1.1)
+ (agenda-structure variable-pitch 1.5)
+ (t variable-pitch))))
+
+(use-package tao-theme
+ :ensure t
+ :config
+ (load-theme 'tao-yin t))
+
+(use-package mixed-pitch
+ :ensure t
+ :hook
+ (olivetti-mode . mixed-pitch-mode))
+
+;; Multiple Cursors
+(use-package multiple-cursors
+ :ensure t)
+
+;; Magit
+(use-package magit
+ :ensure t)
+
+;; Vertico completion
+(use-package vertico
+ :ensure t
+ :init
+ (vertico-mode 1))
+
+;; Marginalia - works with vertico
+(use-package marginalia
+ :ensure t
+ :init
+ (marginalia-mode))
+
+(use-package company
+ :ensure t
+ :init
+ (global-company-mode 1))
+
+(use-package orderless
+ :ensure t)
+
+(use-package yasnippet
+ :init
+ (yas-global-mode)
+ :ensure t)
+
+(use-package yasnippet-snippets
+ :ensure t)
+
+(use-package which-key
+ :init
+ (which-key-mode 1)
+ :ensure t)
+
+(use-package org-roam
+ :ensure t
+ :custom
+ (org-roam-directory (file-truename "~/Notes/Org-Roam"))
+ :bind (("C-c n l" . org-roam-buffer-toggle)
+ ("C-c n f" . org-roam-node-find)
+ ("C-c n g" . org-roam-graph)
+ ("C-c n i" . org-roam-node-insert)
+ ("C-c n c" . org-roam-capture)
+ ("C-c n j" . org-roam-dailies-capture-today))
+ :config
+ (org-roam-db-autosync-mode 1))
+
+(use-package orderless
+ :ensure t
+ :custom
+ (completion-styles '(orderless basic))
+ (completion-category-overrides '((file (styles basic partial-completion)))))
+
+(use-package projectile
+ :ensure t)
+
+(use-package counsel
+ :ensure t
+ :config
+ (setq councel-rg-base-command "rg --no-heading --colors always %s .")
+ (setq counsel-rg-command-prefix "rg --no-heading --color always %s ."))
+
+(use-package dashboard
+ :ensure t
+ :config
+ (dashboard-setup-startup-hook)
+ (setq dashboard-startup-banner "~/.emacs.d/catwithscarf.jpg")
+ (setq dashboard-items '((recents . 5)
+ (projects . 5)))
+ (setq dashboard-banner-logo-title "An Old Farmer's Smile")
+ (setq dashboard-set-footer nil))
+
+;; Distraction-free writing
+(use-package olivetti
+ :config
+ (defun distraction-free ()
+ "Distraction-free writing environment using Olivetti package."
+ (interactive)
+ (if (equal olivetti-mode nil)
+ (progn
+ (window-configuration-to-register 1)
+ (delete-other-windows)
+ (text-scale-set 0.2)
+ (setq olivetti-body-width 120)
+ (olivetti-mode t))
+ (progn
+ (if (eq (length (window-list)) 1)
+ (jump-to-register 1))
+ (olivetti-mode 0)
+ (text-scale-set 0))))
+ :bind
+ (("<f9>" . distraction-free)))
+
+(use-package org-cliplink
+ :ensure t)
+
+(use-package hl-todo
+ :ensure t
+ :init
+ (global-hl-todo-mode t)
+ :config
+ (setq hl-todo-keyword-faces
+ '(("TODO" error bold)
+ ("FIXME" error bold)
+ ("WAIT" warning bold)
+ ("HACK" font-lock-constant-face bold)
+ ("DEPRECATED" font-lock-doc-face bold)
+ ("BUG" error bold))))
+
+(use-package pdf-tools
+ :ensure t)
+
+(use-package toc-org
+ :ensure t)
+
+(use-package expand-region
+ :ensure t
+ :bind ("C-=" . er/expand-region))
+
+(use-package clojure-mode
+ :ensure t)
+
+(use-package cider
+ :ensure t)
+
+(use-package clojure-snippets
+ :ensure t)
+
+(use-package haskell-mode
+ :ensure t)