From 1f8b07d475671c3863a4dd68ba84f197ba6b7b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Lepage=20Vall=C3=A9e?= Date: Tue, 20 Jun 2017 20:06:32 -0400 Subject: [PATCH] debug: Add a signal for deprecation warnings (#1832) Fixes #1612. --- lib/gears/debug.lua | 8 ++++++++ luaa.c | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/gears/debug.lua b/lib/gears/debug.lua index 8d7b2da00..fb4d03e53 100644 --- a/lib/gears/debug.lua +++ b/lib/gears/debug.lua @@ -75,6 +75,10 @@ end local displayed_deprecations = {} --- Display a deprecation notice, but only once per traceback. +-- +-- This function also emits the `debug::deprecate` signal on the `awesome` +-- global object. +-- -- @param[opt] see The message to a new method / function to use. -- @tparam table args Extra arguments -- @tparam boolean args.raw Print the message as-is without the automatic context @@ -108,6 +112,10 @@ function debug.deprecate(see, args) end end debug.print_warning(msg .. ".\n" .. tb) + + if awesome then + awesome.emit_signal("debug::deprecation", msg, see, args) + end end --- Create a class proxy with deprecation messages. diff --git a/luaa.c b/luaa.c index 28b8aa3e6..2bd5e3047 100644 --- a/luaa.c +++ b/luaa.c @@ -88,8 +88,10 @@ extern const struct luaL_Reg awesome_mouse_meta[]; /** A deprecated Lua function was called. * - * @param hint String with a hint on what to use instead of the + * @tparam string hint String with a hint on what to use instead of the * deprecated functionality. + * @tparam[opt=nil] string|nil see The name of the newer API + * @tparam[opt=nil] table|nil args The name of the newer API * @signal debug::deprecation */