diff --git a/emacs/init.org b/emacs/init.org index 3448968..2c49cbf 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -2802,11 +2802,31 @@ Emacs support for the Language Server Protocol (add-hook 'python-mode-hook #'disable-tab-insert) #+END_SRC -Elpy is a python IDE package: +Font-lock for f-strings: #+BEGIN_SRC emacs-lisp - ;; (use-package elpy - ;; :init (elpy-enable) - ;; :config (setq elpy-rpc-python-command "python3")) + (with-eval-after-load 'python + (setq python-font-lock-keywords + (append python-font-lock-keywords + '(;; this is the full string. + ;; group 1 is the quote type and a closing quote is matched + ;; group 2 is the string part + ("f\\(['\"]\\{1,3\\}\\)\\(.+?\\)\\1" + ;; these are the {keywords} + ("{[^}]*?}" + ;; Pre-match form + (progn (goto-char (match-beginning 0)) (match-end 0)) + ;; Post-match form + (goto-char (match-end 0)) + ;; face for this match + (0 font-lock-variable-name-face t))))))) +#+END_SRC + + +Elpy is a python IDE package: +#+BEGIN_SRC emacs-lisp :tangle no + (use-package elpy + :init (elpy-enable) + :config (setq elpy-rpc-python-command "python3")) #+END_SRC Alternatively, use the LSP python client: