diff --git a/ha-programming-python.org b/ha-programming-python.org index 6ef95c8..0f35ec4 100644 --- a/ha-programming-python.org +++ b/ha-programming-python.org @@ -33,8 +33,9 @@ While Emacs supplies a Python editing environment, we’ll still use =use-packag #+begin_src emacs-lisp (use-package python :after flycheck - :mode ("[./]flake8\\'" . conf-mode) - :mode ("/Pipfile\\'" . conf-mode) + :mode (((rx ".flake8" eol) . conf-mode) + ((rx "Pipfile" eol) . conf-mode) + ((rx ".wsgi" eol) . python-mode)) :init (setq python-indent-guess-indent-offset-verbose nil flycheck-flake8-maximum-line-length 120) diff --git a/ha-programming.org b/ha-programming.org index b2ae4d0..6f7a7d7 100644 --- a/ha-programming.org +++ b/ha-programming.org @@ -138,10 +138,10 @@ I appreciate calling =hi-lock-face-symbol-at-point= (or =highlight-symbol-at-poi :config (setq ahs-idle-interval 0.1) - (set-face-attribute ahs-face nil :foreground nil :background nil + (set-face-attribute ahs-face nil :foreground 'unspecified :background 'unspecified :weight 'ultra-bold :slant 'italic) - (set-face-attribute ahs-plugin-default-face nil :foreground nil - :background nil :weight 'bold :slant 'normal)) + (set-face-attribute ahs-plugin-default-face nil :foreground 'unspecified + :background 'unspecified :weight 'bold :slant 'normal)) #+end_src Instead of calling =global-auto-highlight-symbol-mode=, we should just hook it to the =prog-mode=: @@ -370,7 +370,7 @@ Normally, you would need to add all the projects to directory clones in =~/src= https://github.com/tree-sitter/tree-sitter-go https://github.com/tree-sitter/tree-sitter-javascript https://github.com/tree-sitter/tree-sitter-templ - https://github.com/ikatyang/tree-sitter-yaml + https://github.com/tree-sitter-grammars/tree-sitter-yaml https://github.com/tree-sitter/tree-sitter-json https://github.com/tree-sitter/tree-sitter-css https://github.com/tree-sitter/tree-sitter-python @@ -422,7 +422,7 @@ In most cases,the =npm install= /usually/ works, but I may work on some sort of #+end_src At this point, we can now parse stuff using: =tree-sitter parse = **** Emacs Part -However, Emacs already has the ability to download and install grammars, so following instructions from Mickey Petersen’s essay on [[https://www.masteringemacs.org/article/combobulate-structured-movement-editing-treesitter][using Tree-sitter with Combobulate]]: +Note that Emacs already has the ability to download and install grammars, so following instructions from Mickey Petersen’s essay on [[https://www.masteringemacs.org/article/combobulate-structured-movement-editing-treesitter][using Tree-sitter with Combobulate]]: #+begin_src emacs-lisp (when (treesit-available-p) (use-package treesit @@ -460,7 +460,7 @@ However, Emacs already has the ability to download and install grammars, so foll (toml "https://github.com/tree-sitter/tree-sitter-toml") ;; (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src") ;; (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src") - (yaml "https://github.com/ikatyang/tree-sitter-yaml"))) + (yaml "https://github.com/tree-sitter-grammars/tree-sitter-yaml"))) (defun mp-setup-install-grammars () "Install Tree-sitter grammars if they are absent." diff --git a/ha-remoting.org b/ha-remoting.org index 61bc287..41c78a1 100644 --- a/ha-remoting.org +++ b/ha-remoting.org @@ -50,16 +50,19 @@ Will Schenk has [[https://willschenk.com/articles/2020/tramp_tricks/][a simple e (tramp-remote-shell-args ("-i") ("-c")))) tramp-methods) - (defadvice tramp-completion-handle-file-name-all-completions - (around dotemacs-completion-docker activate) - "(tramp-completion-handle-file-name-all-completions \"\" \"/docker:\" returns - a list of active Docker container names, followed by colons." - (if (equal (ad-get-arg 1) "/docker:") + (defun ha-tramp-completion-docker (orig-fun &rest args) + "Advice for `tramp-completion-handle-file-name-all-completions`. + Return active Docker container names when completing for `/docker:`." + (if (equal (nth 1 args) "/docker:") (let* ((command "docker ps --format '{{.Names}}:'") (dockernames-raw (shell-command-to-string command)) - (dockernames (split-string dockernames-raw "\n"))) - (setq ad-return-value dockernames)) - ad-do-it))) + (dockernames (split-string dockernames-raw "\n" t))) + dockernames) + ;; Call the original function + (apply orig-fun args))) + + (advice-add 'tramp-completion-handle-file-name-all-completions + :around #'ha-tramp-completion-docker) #+end_src Keep in mind you need to /name/ your Docker session, with the =—name= option. I actually do more docker work on remote systems (as Docker seems to make my fans levitate my laptop over the desk). Granted, the =URL= is a bit lengthy, for instance: