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"> - + mos emacs howtos @@ -201,67 +201,67 @@

mos emacs howtos

Table of Contents

-
-

1. mo-emacs-config

+
+

1. mo-emacs-config

Ok, so this is my emacs config wiki

-
-

1.1. Keybindings/Prefix keys

+
+

1.1. Keybindings/Prefix keys

I use a us keyboard layout, so C-= is nicely reachable and a @@ -276,8 +276,8 @@

1.1. Keybindings/Prefi

-
-

1.1.1. Some of the bindings

+
+

1.1.1. Some of the bindings

(global-set-key (kbd "C-= d") 'find-name-dired)
@@ -292,8 +292,8 @@ 

1.1.1. Some of the bin

-
-

1.2. recent-files

+
+

1.2. recent-files

;; recent files
@@ -304,8 +304,8 @@ 

1.2. recent-files

-
-

1.3. emacs server

+
+

1.3. emacs server

start a server if there isn't already one running: @@ -319,8 +319,8 @@

1.3. emacs server

-
-

1.4. my multiple cursors shortcuts

+
+

1.4. my multiple cursors shortcuts

I think MCs are cool but I don't use them much. I neither pretend @@ -347,12 +347,12 @@

1.4. my multiple curso

-
-

1.5. Ansi-Term

+
+

1.5. Ansi-Term

-
-

1.5.1. pasting

+
+

1.5.1. pasting

There is a function called term-paste, but it is bound to S-insert @@ -372,8 +372,8 @@

1.5.1. pasting

-
-

1.5.2. tmacs

+
+

1.5.2. tmacs

To conveniently open files from terminal even on remote machines, I @@ -395,8 +395,8 @@

1.5.2. tmacs

-
-

1.5.3. emacsclient

+
+

1.5.3. emacsclient

Add to your ~/.bashrc: @@ -416,12 +416,12 @@

1.5.3. emacsclient

-
-

1.5.4. troubleshooting

+
+

1.5.4. troubleshooting

    -
  1. slow scrolling (emacs 26.1 has this problem)
    +
  2. slow scrolling (emacs 26.1 has this problem)

    In older emacs versions ansi-term was allegedly very slow clearing the @@ -441,7 +441,7 @@

    1.5.4. troubleshooting

  3. -
  4. terminal resizing (emacs 26.1 has this problem)
    +
  5. terminal resizing (emacs 26.1 has this problem)

    Resizing the terminal in which emacs runs doesn't inform inferior @@ -458,26 +458,147 @@

    1.5.4. troubleshooting

-
-

1.6. flymake

+
+

1.6. flymake

-
-

1.6.1. json (new version)

+
+

1.6.1. json (new version)

-
-

1.6.2. TODO toml

+
+

1.6.2. toml

+
+
+
(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))
+
+
+
+ +
    +
  1. 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
    +
    +
    +
    +
  2. +
-
-

1.6.3. TODO yaml

+ +
+

1.6.3. yaml

+
+
+
(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)
+
+
+ +

+https://github.com/shaohme/flymake-yamllint +

-
-

1.6.4. python

+
+ +
+

1.6.4. python

see https://github.com/mokrates/flymaker @@ -486,15 +607,15 @@

1.6.4. python

-
-

1.7. ide stuff, languages

+
+

1.7. ide stuff, languages

-For flymaker, see 1.6 +For flymaker, see 1.6

-
-

1.7.1. python

+
+

1.7.1. python

;;;;;;;; python
@@ -515,8 +636,8 @@ 

1.7.1. python

-
-

1.7.2. Golang

+
+

1.7.2. Golang

;; golang
@@ -527,27 +648,46 @@ 

1.7.2. Golang

-
-

1.8. TODO show git branch in modeline

+
+

1.8. show git branch in modeline

+
+
+
(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)
+
+
+
-
-

1.9. TODO ement.el (matrix client)

+
+

1.9. TODO ement.el (matrix client)

-
-

2. HOWTOs

+
+

2. HOWTOs

-
-

2.1. Fonts

+
+

2.1. Fonts

-
-

2.1.1. how to let emacs find a font for you

+
+

2.1.1. how to let emacs find a font for you

customize-face expects from you that you know the name and all @@ -573,8 +713,8 @@

2.1.1. how to let emac

-
-

2.1.2. troubleshooting

+
+

2.1.2. troubleshooting

Sometimes emacs loses the fonts you define. That seems to happen with @@ -592,8 +732,8 @@

2.1.2. troubleshooting

-
-

2.2. How to build an input method

+
+

2.2. How to build an input method

I built one. See here: quail classic german @@ -618,8 +758,8 @@

Footnotes:

Author: mokrates

-

Created: 2023-10-01 So 01:08

+

Created: 2023-12-19 Di 00:57

Validate

- + \ No newline at end of file