mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
* yasnippet-debug.el: Use advice-add
i.s.o defadvice
.
Now that we use `add-function`, we may as well avoid using the deprecated `defadvice` (cl-flet): Remove confusing `cl-flet` fallback, always provided by `cl-lib`. (yas--snippet-parse-create, yas--commit-snippet): Use `advice-add` i.s.o `defadvice`.
This commit is contained in:
parent
e991530108
commit
009322196c
@ -1,6 +1,6 @@
|
|||||||
;;; yasnippet-debug.el --- debug functions for yasnippet -*- lexical-binding: t -*-
|
;;; yasnippet-debug.el --- debug functions for yasnippet -*- lexical-binding: t -*-
|
||||||
|
|
||||||
;; Copyright (C) 2010, 2013-2014, 2017-2018 Free Software Foundation, Inc.
|
;; Copyright (C) 2010-2023 Free Software Foundation, Inc.
|
||||||
|
|
||||||
;; Author: João Távora
|
;; Author: João Távora
|
||||||
;; Keywords: emulations, convenience
|
;; Keywords: emulations, convenience
|
||||||
@ -40,9 +40,6 @@
|
|||||||
;; Don't require '-L <path>' when debugging.
|
;; Don't require '-L <path>' when debugging.
|
||||||
(expand-file-name "yasnippet" yas--loaddir)))
|
(expand-file-name "yasnippet" yas--loaddir)))
|
||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
(eval-when-compile
|
|
||||||
(unless (fboundp 'cl-flet)
|
|
||||||
(defalias 'cl-flet 'flet)))
|
|
||||||
(require 'color nil t)
|
(require 'color nil t)
|
||||||
(require 'edebug)
|
(require 'edebug)
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
@ -224,13 +221,15 @@
|
|||||||
(setq yas-debug-undo value)
|
(setq yas-debug-undo value)
|
||||||
(yas--message 3 "debug undo %sabled" (if yas-debug-undo "en" "dis")))
|
(yas--message 3 "debug undo %sabled" (if yas-debug-undo "en" "dis")))
|
||||||
|
|
||||||
(defadvice yas--snippet-parse-create (before yas-debug-target-snippet (snippet))
|
(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))
|
(add-to-list 'yas-debug-target-snippets snippet))
|
||||||
|
|
||||||
(defadvice yas--commit-snippet (after yas-debug-untarget-snippet (snippet))
|
(advice-add 'yas--commit-snippet :after #'yas-debug--untarget-snippet)
|
||||||
|
(defun yas-debug--untarget-snippet (snippet)
|
||||||
(setq yas-debug-target-snippets
|
(setq yas-debug-target-snippets
|
||||||
(remq snippet yas-debug-target-snippets))
|
(remq snippet yas-debug-target-snippets))
|
||||||
(maphash (lambda (k color-ov)
|
(maphash (lambda (_k color-ov)
|
||||||
(delete-overlay (cdr color-ov)))
|
(delete-overlay (cdr color-ov)))
|
||||||
yas-debug-live-indicators)
|
yas-debug-live-indicators)
|
||||||
(clrhash yas-debug-live-indicators))
|
(clrhash yas-debug-live-indicators))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user