mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 05:03:04 +00:00
Misc fixes found via compilation warnings
* yasnippet-debug.el (yas-debug-snippets): Improve commit 009322196cfa. * yasnippet-tests.el (test-rebindings): Avoid `copy-keymap`.
This commit is contained in:
parent
03b1b11547
commit
5b315f1753
@ -1,6 +1,6 @@
|
||||
;;; yasnippet-debug.el --- debug functions for yasnippet -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2010-2023 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2010-2025 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: João Távora
|
||||
;; Keywords: emulations, convenience
|
||||
@ -221,11 +221,9 @@
|
||||
(setq yas-debug-undo value)
|
||||
(yas--message 3 "debug undo %sabled" (if yas-debug-undo "en" "dis")))
|
||||
|
||||
(advice-add 'yas--snippet-parse-create :before #'yas-debug--target-snippet)
|
||||
(defun yas-debug--target-snippet (snippet)
|
||||
(add-to-list 'yas-debug-target-snippets snippet))
|
||||
|
||||
(advice-add 'yas--commit-snippet :after #'yas-debug--untarget-snippet)
|
||||
(defun yas-debug--untarget-snippet (snippet)
|
||||
(setq yas-debug-target-snippets
|
||||
(remq snippet yas-debug-target-snippets))
|
||||
@ -270,10 +268,8 @@ buffer-locally, otherwise install it globally. If HOOK is
|
||||
do (printf "%S\n" undo-elem))))
|
||||
(when hook
|
||||
(setq yas-debug-target-buffer (current-buffer))
|
||||
(ad-enable-advice 'yas--snippet-parse-create 'before 'yas-debug-target-snippet)
|
||||
(ad-activate 'yas--snippet-parse-create)
|
||||
(ad-enable-advice 'yas--commit-snippet 'after 'yas-debug-untarget-snippet)
|
||||
(ad-activate 'yas--commit-snippet)
|
||||
(advice-add 'yas--snippet-parse-create :before #'yas-debug--target-snippet)
|
||||
(advice-add 'yas--commit-snippet :after #'yas-debug--untarget-snippet)
|
||||
(add-hook 'post-command-hook #'yas-debug-snippets
|
||||
nil (eq hook 'snippet-navigation))
|
||||
;; Window management is slapped together, it does what I
|
||||
|
@ -1,6 +1,6 @@
|
||||
;;; yasnippet-tests.el --- some yasnippet tests -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2012-2025 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: João Távora <joaot@siscog.pt>
|
||||
;; Keywords: emulations, convenience
|
||||
@ -1665,14 +1665,14 @@ TODO: be meaner"
|
||||
(should (eq (key-binding [backtab]) #'yas-prev-field))))))
|
||||
|
||||
(ert-deftest test-rebindings ()
|
||||
(let* ((yas-minor-mode-map (copy-keymap yas-minor-mode-map))
|
||||
(let* ((test-map (make-composed-keymap nil yas-minor-mode-map))
|
||||
(minor-mode-map-alist
|
||||
(cons `(yas-minor-mode . ,yas-minor-mode-map)
|
||||
(cons `(yas-minor-mode . ,test-map)
|
||||
(cl-remove 'yas-minor-mode minor-mode-map-alist
|
||||
:test #'eq :key #'car))))
|
||||
(define-key yas-minor-mode-map [tab] nil)
|
||||
(define-key yas-minor-mode-map (kbd "TAB") nil)
|
||||
(define-key yas-minor-mode-map (kbd "SPC") #'yas-expand)
|
||||
(define-key test-map [tab] nil)
|
||||
(define-key test-map (kbd "TAB") nil)
|
||||
(define-key test-map (kbd "SPC") #'yas-expand)
|
||||
(with-temp-buffer
|
||||
(yas-minor-mode 1)
|
||||
(should-not (eq (key-binding (kbd "TAB")) #'yas-expand))
|
||||
|
Loading…
x
Reference in New Issue
Block a user