From 04c1d1d01c2dc07eed801563e6f38e65e349020f Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sat, 21 Oct 2023 16:03:42 +0200 Subject: [PATCH] updated yasnippet --- .../yasnippet-autoloads.el | 61 -------------- elpa/yasnippet-20191222.2206/yasnippet-pkg.el | 2 - .../yasnippet-autoloads.el | 82 +++++++++++++++++++ elpa/yasnippet-20200604.246/yasnippet-pkg.el | 12 +++ .../yasnippet.el | 73 +++++++++++------ 5 files changed, 140 insertions(+), 90 deletions(-) delete mode 100644 elpa/yasnippet-20191222.2206/yasnippet-autoloads.el delete mode 100644 elpa/yasnippet-20191222.2206/yasnippet-pkg.el create mode 100644 elpa/yasnippet-20200604.246/yasnippet-autoloads.el create mode 100644 elpa/yasnippet-20200604.246/yasnippet-pkg.el rename elpa/{yasnippet-20191222.2206 => yasnippet-20200604.246}/yasnippet.el (98%) diff --git a/elpa/yasnippet-20191222.2206/yasnippet-autoloads.el b/elpa/yasnippet-20191222.2206/yasnippet-autoloads.el deleted file mode 100644 index 2659fe88..00000000 --- a/elpa/yasnippet-20191222.2206/yasnippet-autoloads.el +++ /dev/null @@ -1,61 +0,0 @@ -;;; yasnippet-autoloads.el --- automatically extracted autoloads -;; -;;; Code: - -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) - - -;;;### (autoloads nil "yasnippet" "yasnippet.el" (0 0 0 0)) -;;; Generated autoloads from yasnippet.el - -(autoload 'yas-minor-mode "yasnippet" "\ -Toggle YASnippet mode. - -When YASnippet mode is enabled, `yas-expand', normally bound to -the TAB key, expands snippets of code depending on the major -mode. - -With no argument, this command toggles the mode. -positive prefix argument turns on the mode. -Negative prefix argument turns off the mode. - -Key bindings: -\\{yas-minor-mode-map} - -\(fn &optional ARG)" t nil) - -(defvar yas-global-mode nil "\ -Non-nil if Yas-Global mode is enabled. -See the `yas-global-mode' command -for a description of this minor mode. -Setting this variable directly does not take effect; -either customize it (see the info node `Easy Customization') -or call the function `yas-global-mode'.") - -(custom-autoload 'yas-global-mode "yasnippet" nil) - -(autoload 'yas-global-mode "yasnippet" "\ -Toggle Yas minor mode in all buffers. -With prefix ARG, enable Yas-Global mode if ARG is positive; -otherwise, disable it. If called from Lisp, enable the mode if -ARG is omitted or nil. - -Yas minor mode is enabled in all buffers where -`yas-minor-mode-on' would do it. -See `yas-minor-mode' for more information on Yas minor mode. - -\(fn &optional ARG)" t nil) -(autoload 'snippet-mode "yasnippet" "A mode for editing yasnippets" t nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "yasnippet" '("yas" "help-snippet-def" "snippet-mode-map"))) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; coding: utf-8 -;; End: -;;; yasnippet-autoloads.el ends here diff --git a/elpa/yasnippet-20191222.2206/yasnippet-pkg.el b/elpa/yasnippet-20191222.2206/yasnippet-pkg.el deleted file mode 100644 index ad2af9d4..00000000 --- a/elpa/yasnippet-20191222.2206/yasnippet-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "yasnippet" "20191222.2206" "Yet another snippet extension for Emacs" '((cl-lib "0.5")) :commit "3bf9a3b1af37174a004798b7195826af0123fa6a" :keywords '("convenience" "emulation") :maintainer '("Noam Postavsky" . "npostavs@gmail.com") :url "http://github.com/joaotavora/yasnippet") diff --git a/elpa/yasnippet-20200604.246/yasnippet-autoloads.el b/elpa/yasnippet-20200604.246/yasnippet-autoloads.el new file mode 100644 index 00000000..47700629 --- /dev/null +++ b/elpa/yasnippet-20200604.246/yasnippet-autoloads.el @@ -0,0 +1,82 @@ +;;; yasnippet-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + +;;; Code: + +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + + + +;;; Generated autoloads from yasnippet.el + +(autoload 'yas-minor-mode "yasnippet" "\ +Toggle YASnippet mode. + +When YASnippet mode is enabled, `yas-expand', normally bound to +the TAB key, expands snippets of code depending on the major +mode. + +With no argument, this command toggles the mode. +positive prefix argument turns on the mode. +Negative prefix argument turns off the mode. + +Key bindings: +\\{yas-minor-mode-map} + +This is a minor mode. If called interactively, toggle the `yas +minor mode' mode. If the prefix argument is positive, enable the +mode, and if it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable +the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `yas-minor-mode'. + +The mode's hook is called both when the mode is enabled and when +it is disabled. + +(fn &optional ARG)" t) +(put 'yas-global-mode 'globalized-minor-mode t) +(defvar yas-global-mode nil "\ +Non-nil if Yas-Global mode is enabled. +See the `yas-global-mode' command +for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `yas-global-mode'.") +(custom-autoload 'yas-global-mode "yasnippet" nil) +(autoload 'yas-global-mode "yasnippet" "\ +Toggle Yas minor mode in all buffers. +With prefix ARG, enable Yas-Global mode if ARG is positive; otherwise, +disable it. + +If called from Lisp, toggle the mode if ARG is `toggle'. +Enable the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +Yas minor mode is enabled in all buffers where `yas-minor-mode-on' +would do it. + +See `yas-minor-mode' for more information on Yas minor mode. + +(fn &optional ARG)" t) +(autoload 'snippet-mode "yasnippet" "A mode for editing yasnippets" t nil) +(register-definition-prefixes "yasnippet" '("help-snippet-def" "snippet-mode-map" "yas")) + +;;; End of scraped data + +(provide 'yasnippet-autoloads) + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; no-native-compile: t +;; coding: utf-8-emacs-unix +;; End: + +;;; yasnippet-autoloads.el ends here diff --git a/elpa/yasnippet-20200604.246/yasnippet-pkg.el b/elpa/yasnippet-20200604.246/yasnippet-pkg.el new file mode 100644 index 00000000..baf8518b --- /dev/null +++ b/elpa/yasnippet-20200604.246/yasnippet-pkg.el @@ -0,0 +1,12 @@ +(define-package "yasnippet" "20200604.246" "Yet another snippet extension for Emacs" + '((cl-lib "0.5")) + :commit "5cbdbf0d2015540c59ed8ee0fcf4788effdf75b6" :maintainers + '(("Noam Postavsky" . "npostavs@gmail.com")) + :maintainer + '("Noam Postavsky" . "npostavs@gmail.com") + :keywords + '("convenience" "emulation") + :url "http://github.com/joaotavora/yasnippet") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/yasnippet-20191222.2206/yasnippet.el b/elpa/yasnippet-20200604.246/yasnippet.el similarity index 98% rename from elpa/yasnippet-20191222.2206/yasnippet.el rename to elpa/yasnippet-20200604.246/yasnippet.el index 914d5e3f..78ef38ac 100644 --- a/elpa/yasnippet-20191222.2206/yasnippet.el +++ b/elpa/yasnippet-20200604.246/yasnippet.el @@ -6,7 +6,6 @@ ;; Noam Postavsky ;; Maintainer: Noam Postavsky ;; Version: 0.14.0 -;; Package-Version: 20191222.2206 ;; X-URL: http://github.com/joaotavora/yasnippet ;; Keywords: convenience, emulation ;; URL: http://github.com/joaotavora/yasnippet @@ -1506,7 +1505,7 @@ Also tries to work around Emacs Bug#30931." (let ((result (eval form))) (when result (format "%s" result)))))) - ((debug error) (cdr oops))))) + ((debug error) (error-message-string oops))))) (defun yas--eval-for-effect (form) (yas--safely-call-fun (apply-partially #'eval form))) @@ -3502,7 +3501,8 @@ This renders the snippet as ordinary text." ;; (let ((previous-field (yas--snippet-previous-active-field snippet))) (when (and yas-snippet-end previous-field) - (yas--advance-end-maybe previous-field yas-snippet-end))) + (yas--advance-end-maybe-previous-fields + previous-field yas-snippet-end (cdr yas--active-snippets)))) ;; Convert all markers to points, ;; @@ -3850,14 +3850,9 @@ field start. This hook does nothing if an undo is in progress." (setf (yas--field-modified-p field) t) ;; Adjust any pending active fields in case of stacked ;; expansion. - (let ((pfield field) - (psnippets (yas--gather-active-snippets - overlay beg end t))) - (while (and pfield psnippets) - (let ((psnippet (pop psnippets))) - (cl-assert (memq pfield (yas--snippet-fields psnippet))) - (yas--advance-end-maybe pfield (overlay-end overlay)) - (setq pfield (yas--snippet-previous-active-field psnippet))))) + (yas--advance-end-maybe-previous-fields + field (overlay-end overlay) + (yas--gather-active-snippets overlay beg end t)) ;; Update fields now, but delay auto indentation until ;; post-command. We don't want to run indentation on ;; the intermediate state where field text might be @@ -4111,7 +4106,9 @@ for normal snippets, and a list for command snippets)." (overlay-get yas--active-field-overlay 'yas--field)))) (when existing-field (setf (yas--snippet-previous-active-field snippet) existing-field) - (yas--advance-end-maybe existing-field (overlay-end yas--active-field-overlay)))) + (yas--advance-end-maybe-previous-fields + existing-field (overlay-end yas--active-field-overlay) + (cdr yas--active-snippets)))) ;; Exit the snippet immediately if no fields. (unless (yas--snippet-fields snippet) @@ -4171,21 +4168,27 @@ Returns the newly created snippet." (yas--letenv expand-env ;; Put a single undo action for the expanded snippet's ;; content. - (let ((buffer-undo-list t) - (inhibit-modification-hooks t)) - ;; Some versions of cc-mode fail when inserting snippet - ;; content in a narrowed buffer, so make sure to insert - ;; before narrowing. Furthermore, call before and after - ;; change functions manually, otherwise cc-mode's cache can - ;; get messed up. + (let ((buffer-undo-list t)) (goto-char begin) - (run-hook-with-args 'before-change-functions begin begin) - (insert content) - (setq end (+ end (length content))) - (narrow-to-region begin end) - (goto-char (point-min)) - (yas--snippet-parse-create snippet) - (run-hook-with-args 'after-change-functions (point-min) (point-max) 0)) + ;; Call before and after change functions manually, + ;; otherwise cc-mode's cache can get messed up. Don't use + ;; `inhibit-modification-hooks' for that, that blocks + ;; overlay and text property hooks as well! FIXME: Maybe + ;; use `combine-change-calls'? (Requires Emacs 27+ though.) + (run-hook-with-args 'before-change-functions begin end) + (let ((before-change-functions nil) + (after-change-functions nil)) + ;; Some versions of cc-mode (might be the one with Emacs + ;; 24.3 only) fail when inserting snippet content in a + ;; narrowed buffer, so make sure to insert before + ;; narrowing. + (insert content) + (narrow-to-region begin (point)) + (goto-char (point-min)) + (yas--snippet-parse-create snippet)) + (run-hook-with-args 'after-change-functions + (point-min) (point-max) + (- end begin))) (when (listp buffer-undo-list) (push (cons (point-min) (point-max)) buffer-undo-list)) @@ -4337,6 +4340,13 @@ exit-marker have identical start and end markers." ((yas--exit-p fom) (yas--advance-start-maybe (yas--fom-next fom) newend)))) +(defun yas--advance-end-maybe-previous-fields (field end snippets) + "Call `yas--advance-end-maybe' on FIELD, and previous fields on SNIPPETS." + (dolist (snippet snippets) + (cl-assert (memq field (yas--snippet-fields snippet))) + (yas--advance-end-maybe field end) + (setq field (yas--snippet-previous-active-field snippet)))) + (defun yas--advance-start-maybe (fom newstart) "Maybe advance FOM's start to NEWSTART if it needs it. @@ -4715,6 +4725,13 @@ SAVED-QUOTES is the in format returned by `yas--save-backquotes'." yas--indent-markers)) (setq yas--indent-markers (nreverse yas--indent-markers))) +(defun yas--scan-for-field-end () + (while (progn (re-search-forward "\\${\\|}") + (when (eq (char-before) ?\{) + ;; Nested field. + (yas--scan-for-field-end)))) + (point)) + (defun yas--field-parse-create (snippet &optional parent-field) "Parse most field expressions in SNIPPET, except for the simple one \"$n\". @@ -4731,7 +4748,9 @@ When multiple expressions are found, only the last one counts." ;; (save-excursion (while (re-search-forward yas--field-regexp nil t) - (let* ((brace-scan (yas--scan-sexps (1+ (match-beginning 0)) 1)) + (let* ((brace-scan (save-match-data + (goto-char (match-beginning 2)) + (yas--scan-for-field-end))) ;; if the `brace-scan' didn't reach a brace, we have a ;; snippet with invalid escaping, probably a closing ;; brace escaped with two backslashes (github#979). But -- 2.47.3