From f6a91e549fe34f047acdb03e806e0f7dce9ffce1 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Wed, 5 Feb 2025 19:25:11 +0100 Subject: Upgrade markdown-mode, rust-prog-mode and yasnippet --- .emacs.d/lisp/yasnippet.el | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to '.emacs.d/lisp/yasnippet.el') diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el index 782c440..602e74e 100644 --- a/.emacs.d/lisp/yasnippet.el +++ b/.emacs.d/lisp/yasnippet.el @@ -1,6 +1,6 @@ ;;; yasnippet.el --- Yet another snippet extension for Emacs -*- lexical-binding: t; -*- -;; Copyright (C) 2008-2024 Free Software Foundation, Inc. +;; Copyright (C) 2008-2025 Free Software Foundation, Inc. ;; Authors: pluskid , ;; João Távora , ;; Noam Postavsky @@ -1000,7 +1000,7 @@ Honour `yas-dont-activate-functions', which see." ;;; Major mode stuff (defvar yas--font-lock-keywords - (append '(("^#.*$" . font-lock-comment-face)) + (append '(("^#.*$" (0 'font-lock-comment-face))) (with-temp-buffer (let ((prog-mode-hook nil) (emacs-lisp-mode-hook nil)) @@ -1011,14 +1011,14 @@ Honour `yas-dont-activate-functions', which see." (cadr font-lock-keywords) font-lock-keywords)) '(("\\$\\([0-9]+\\)" - (0 font-lock-keyword-face) - (1 font-lock-string-face t)) + (0 'font-lock-keyword-face) + (1 'font-lock-string-face t)) ("\\${\\([0-9]+\\):?" - (0 font-lock-keyword-face) - (1 font-lock-warning-face t)) - ("\\(\\$(\\)" 1 font-lock-preprocessor-face) + (0 'font-lock-keyword-face) + (1 'font-lock-warning-face t)) + ("\\(\\$(\\)" 1 'font-lock-preprocessor-face) ("}" - (0 font-lock-keyword-face))))) + (0 'font-lock-keyword-face))))) (defvar snippet-mode-map (let ((map (make-sparse-keymap))) @@ -2784,18 +2784,20 @@ Return the `yas--template' object created" (defun yas-maybe-load-snippet-buffer () "Added to `after-save-hook' in `snippet-mode'." - (let* ((mode (intern (file-name-sans-extension - (file-name-nondirectory - (directory-file-name default-directory))))) - (current-snippet - (apply #'yas--define-snippets-2 (yas--table-get-create mode) - (yas--parse-template buffer-file-name))) - (uuid (yas--template-uuid current-snippet))) - (unless (equal current-snippet - (if uuid (yas--get-template-by-uuid mode uuid) - (yas--lookup-snippet-1 - (yas--template-name current-snippet) mode))) - (yas-load-snippet-buffer mode t)))) + (save-excursion ;; Issue #1146. Here or in `yas--parse-template`? + (let* ((mode (intern (file-name-sans-extension + (file-name-nondirectory + (directory-file-name default-directory))))) + (current-snippet + (apply #'yas--define-snippets-2 (yas--table-get-create mode) + ;; FIXME: `yas-load-snippet-buffer' will *re*parse! + (yas--parse-template buffer-file-name))) + (uuid (yas--template-uuid current-snippet))) + (unless (equal current-snippet + (if uuid (yas--get-template-by-uuid mode uuid) + (yas--lookup-snippet-1 + (yas--template-name current-snippet) mode))) + (yas-load-snippet-buffer mode t))))) (defun yas-load-snippet-buffer-and-close (table &optional kill) "Load and save the snippet, then `quit-window' if saved. -- cgit v1.3