diff --git a/index.html b/index.html index e9c2bce..4a48e7b 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- +Ok, so this is my emacs config wiki
I use a us keyboard layout, so C-=
is nicely reachable and a
@@ -276,8 +276,8 @@
(global-set-key (kbd "C-= d") 'find-name-dired) @@ -292,8 +292,8 @@1.1.1. Some of the bin
;; recent files @@ -304,8 +304,8 @@1.2. recent-files
start a server if there isn't already one running: @@ -319,8 +319,8 @@
I think MCs are cool but I don't use them much. I neither pretend @@ -347,12 +347,12 @@
There is a function called term-paste
, but it is bound to S-insert
@@ -372,8 +372,8 @@
To conveniently open files from terminal even on remote machines, I @@ -395,8 +395,8 @@
Add to your ~/.bashrc
:
@@ -416,12 +416,12 @@
In older emacs versions ansi-term was allegedly very slow clearing the @@ -441,7 +441,7 @@
Resizing the terminal in which emacs runs doesn't inform inferior @@ -458,26 +458,147 @@
(load "~/.emacs.d/tomlcheck.el") +(add-hook 'conf-toml-mode-hook 'flymake-tomlcheck-setup) +(add-hook 'conf-toml-mode-hook 'flymake-mode) +(add-hook 'conf-toml-mode-hook 'trailing-whitespace-mode) + +;; if you want to add this automatically to .conf.j2 files +(add-to-list 'auto-mode-alist '("\\.conf\\.j2\\'" . conf-toml-mode)) ++
tomlcheck.el
;;; flymake-tomlcheck.el --- TOML linter with tomlcheck -*- lexical-binding: t; -*- + +;; replace /PATH/TO/TOMLCHECK.PY with actual path to tomlcheck.py +;; the contents should be: + +;;;;;;;;;;;; tomlcheck.py +;; #!/usr/bin/env python3 +;; # usage: python3 tomlcheck.py < something.toml +;; # pip3 install --user toml + +;; # emacs regex: "^\\(?3:[^(]*\\)(line \\(?1:[0-9]+\\) column \\(?2:[0-9]+\\) char [0-9]+)$" +;; # (match-string 1) = line, (match-string 2) = col, (match-string 3) = msg + +;; import sys +;; import toml + +;; try: +;; toml.load(sys.stdin) +;; except Exception as e: +;; print(e) +;;;;;;;;;;;;;;;;;; + +(require 'flymake) + +(defgroup flymake-tomlcheck nil + "Tomlcheck backend for Flymake." + :prefix "flymake-tomlcheck-" + :group 'tools) + +(defcustom flymake-tomlcheck-arguments + nil + "A list of strings to pass to the tomlcheck program as arguments." + :type '(repeat (string :tag "Argument"))) + +(defvar-local flymake-tomlcheck--proc nil) + +(defun flymake-tomlcheck (report-fn &rest _args) + "Flymake backend for tomlcheck report using REPORT-FN." + (when (process-live-p flymake-tomlcheck--proc) + (kill-process flymake-tomlcheck--proc) + (setq flymake-tomlcheck--proc nil)) + (let ((source (current-buffer))) + (save-restriction + (widen) + (setq + flymake-tomlcheck--proc + (make-process + :name "flymake-tomlcheck" :noquery t :connection-type 'pipe + :buffer (generate-new-buffer " *flymake-tomlcheck*") + :command `("/usr/bin/python" "/PATH/TO/TOMLCHECK.PY") + :sentinel + (lambda (proc _event) + (when (eq 'exit (process-status proc)) + (unwind-protect + (if (with-current-buffer source (eq proc flymake-tomlcheck--proc)) + (with-current-buffer (process-buffer proc) + (goto-char (point-min)) + (let ((diags)) + (while (search-forward-regexp "^\\(?3:[^(]*\\)(line \\(?1:[0-9]+\\) column \\(?2:[0-9]+\\) char [0-9]+)$" nil t) + (let ((region (flymake-diag-region source (string-to-number (match-string 1)) (string-to-number (match-string 2)))) + (error-type (match-string 3))) + ;; expect `region' to only have 2 values (start . end) + (when (and (car region) (cdr region)) + (push (flymake-make-diagnostic source + (car region) + (cdr region) + :error + (match-string 3)) + diags)))) + (funcall report-fn (reverse diags)))) + (flymake-log :warning "Canceling obsolete check %s" + proc)) + (kill-buffer (process-buffer proc))))))) + (process-send-region flymake-tomlcheck--proc (point-min) (point-max)) + (process-send-eof flymake-tomlcheck--proc)))) + +;;;###autoload +(defun flymake-tomlcheck-setup () + "Enable tomlcheck flymake backend." + (make-variable-buffer-local 'flymake-diagnostic-functions) + (add-hook 'flymake-diagnostic-functions #'flymake-tomlcheck nil t)) + +(provide 'flymake-tomlcheck) +;;; flymake-tomlcheck.el ends here ++
(load "~/.emacs.d/flymake-yamllint.el") +(add-hook 'yaml-mode-hook 'flymake-yamllint-setup) +(add-hook 'yaml-mode-hook 'flymake-mode) +(add-hook 'yaml-mode-hook 'trailing-whitespace-mode) ++
see https://github.com/mokrates/flymaker @@ -486,15 +607,15 @@
;;;;;;;; python @@ -515,8 +636,8 @@1.7.1. python
;; golang @@ -527,27 +648,46 @@1.7.2. Golang
(defun mo-term-git-mode--get-branch () + ;;(vc-call-backend 'git 'mode-line-string ".") ; doesn't work + ;;(let ((branches (vc-git-branches))) + (let ((branches (vc-call-backend 'git 'branches))) + (when branches (car branches)))) + +(define-minor-mode mo-term-git-mode + "show current branch in modeline in terminal-modes" + :lighter (:eval (let ((git-branch (mo-term-git-mode--get-branch))) + (if git-branch + (format " git:%s" git-branch) + "")))) + +(add-hook 'term-mode-hook 'mo-term-git-mode) ++
customize-face
expects from you that you know the name and all
@@ -573,8 +713,8 @@
Sometimes emacs loses the fonts you define. That seems to happen with @@ -592,8 +732,8 @@
I built one. See here: quail classic german @@ -618,8 +758,8 @@