From 3ebcc1aa5ab02ab624b632c48e720473742d76d7 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 14 Nov 2008 12:09:35 +0100 Subject: [PATCH] luaa: add more deprecation information Signed-off-by: Julien Danjou --- client.c | 6 +++--- hooks.c | 2 +- lib/awful/client.lua.in | 8 ++++---- lib/awful/init.lua.in | 2 +- lib/awful/util.lua.in | 6 +++++- luaa.c | 6 +++--- luaa.h | 5 +++-- mouse.c | 2 +- screen.c | 2 +- statusbar.c | 2 +- titlebar.c | 2 +- widget.c | 4 ++-- 12 files changed, 26 insertions(+), 21 deletions(-) diff --git a/client.c b/client.c index 2aec5051..7a20fa95 100644 --- a/client.c +++ b/client.c @@ -943,7 +943,7 @@ luaA_client_visible_get(lua_State *L) luaA_checkscreen(screen); - deprecate(L); + deprecate(L, "awful.client.visible()"); lua_newtable(L); @@ -1186,7 +1186,7 @@ luaA_client_geometry(lua_State *L) static int luaA_client_coords(lua_State *L) { - deprecate(L); + deprecate(L, "client:geometry()"); return luaA_client_geometry(L); } @@ -1227,7 +1227,7 @@ luaA_client_fullgeometry(lua_State *L) static int luaA_client_fullcoords(lua_State *L) { - deprecate(L); + deprecate(L, "client:fullgeometry()"); return luaA_client_fullgeometry(L); } diff --git a/hooks.c b/hooks.c index 64e31f3b..1c288ca0 100644 --- a/hooks.c +++ b/hooks.c @@ -98,7 +98,7 @@ luaA_hooks_mouse_enter(lua_State *L) static int luaA_hooks_mouseover(lua_State *L) { - deprecate(L); + deprecate(L, "mouse_enter hook"); return luaA_hooks_mouse_enter(L); } diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in index 9387bc2c..94a9102d 100644 --- a/lib/awful/client.lua.in +++ b/lib/awful/client.lua.in @@ -307,12 +307,12 @@ function focus.bydirection(dir, c) end function focusbydirection(dir, c) - util.deprecate() + util.deprecate("focus.bydirection()") return focus.bydirection(dir, c) end function focusbyidx(i, c) - util.deprecate() + util.deprecate("focus.byidx()") return focus.byidx(i, c) end @@ -354,7 +354,7 @@ end -- Compatibility local function __swap(self, i, c) - util.deprecate() + util.deprecate("swap.byidx()") swap.byidx(i, c) end setmetatable(swap, { __call = __swap }) @@ -369,7 +369,7 @@ end --- Get the master window, deprecated, see getmaster(). function master(screen) - util.deprecate() + util.deprecate("getmaster()") return getmaster(screen) end diff --git a/lib/awful/init.lua.in b/lib/awful/init.lua.in index 9242757d..414f3373 100644 --- a/lib/awful/init.lua.in +++ b/lib/awful/init.lua.in @@ -37,7 +37,7 @@ local deprecated_functions = for k, v in ipairs(deprecated_functions) do _M[v] = function (...) - util.deprecate() + util.deprecate("awful.util functions") util[v](unpack(arg)) end end diff --git a/lib/awful/util.lua.in b/lib/awful/util.lua.in index 18070fb3..5cb5e709 100644 --- a/lib/awful/util.lua.in +++ b/lib/awful/util.lua.in @@ -22,8 +22,12 @@ local capi = --- Utility module for awful module("awful.util") -function deprecate() +function deprecate(see) io.stderr:write("W: awful: function is deprecated") + if see then + io.stderr:write(", see " .. see) + end + io.stderr:write("\n") io.stderr:write(debug.traceback()) end diff --git a/luaa.c b/luaa.c index eac73ee8..aa5acd93 100644 --- a/luaa.c +++ b/luaa.c @@ -152,7 +152,7 @@ luaA_restart(lua_State *L __attribute__ ((unused))) static int luaA_font_set(lua_State *L) { - deprecate(L); + deprecate(L, "awesome.font attribute"); if(lua_gettop(L) == 1) { const char *newfont = luaL_checkstring(L, 1); @@ -176,7 +176,7 @@ luaA_font_set(lua_State *L) static int luaA_colors(lua_State *L) { - deprecate(L); + deprecate(L, "awesome.fg and awesome.bg attributes"); if(lua_gettop(L) == 1) { const char *buf; @@ -728,7 +728,7 @@ luaA_spawn(lua_State *L) static int luaA_mouse_add(lua_State *L) { - deprecate(L); + deprecate(L, "awesome.buttons()"); return 0; } diff --git a/luaa.h b/luaa.h index 167b56a5..2c0dc740 100644 --- a/luaa.h +++ b/luaa.h @@ -35,8 +35,9 @@ /** Type for Lua function */ typedef int luaA_ref; -#define deprecate(L) luaA_warn(L, "%s: This function is deprecated and will be removed.", \ - __FUNCTION__) +#define deprecate(L, repl) \ + luaA_warn(L, "%s: This function is deprecated and will be removed, see %s", \ + __FUNCTION__, repl) #define DO_LUA_NEW(decl, type, prefix, lua_type, type_ref) \ decl int \ diff --git a/mouse.c b/mouse.c index c3bdb122..f39ab1da 100644 --- a/mouse.c +++ b/mouse.c @@ -1378,7 +1378,7 @@ luaA_mouse_coords(lua_State *L) static int luaA_mouse_new(lua_State *L) { - deprecate(L); + deprecate(L, "button()"); return luaA_button_new(L); } diff --git a/screen.c b/screen.c index aac41e80..45a78d12 100644 --- a/screen.c +++ b/screen.c @@ -502,7 +502,7 @@ luaA_screen_index(lua_State *L) switch(a_tokenize(buf, len)) { case A_TK_COORDS: - deprecate(L); + deprecate(L, "geometry attribute"); case A_TK_GEOMETRY: luaA_pusharea(L, s->geometry); break; diff --git a/statusbar.c b/statusbar.c index 81b7ea3b..5102d2f4 100644 --- a/statusbar.c +++ b/statusbar.c @@ -33,7 +33,7 @@ static int luaA_statusbar_new(lua_State *L) { - deprecate(L); + deprecate(L, "wibox"); return luaA_wibox_new(L); } diff --git a/titlebar.c b/titlebar.c index efc18a15..9bba1b8d 100644 --- a/titlebar.c +++ b/titlebar.c @@ -157,7 +157,7 @@ titlebar_geometry_compute(client_t *c, area_t geometry, area_t *res) static int luaA_titlebar_new(lua_State *L) { - deprecate(L); + deprecate(L, "wibox"); return luaA_wibox_new(L); } diff --git a/widget.c b/widget.c index d59caa76..8726434e 100644 --- a/widget.c +++ b/widget.c @@ -358,7 +358,7 @@ widget_invalidate_bywidget(widget_t *widget) static int luaA_widget_mouse_add(lua_State *L) { - deprecate(L); + deprecate(L, "widget:buttons()"); return 0; } @@ -392,7 +392,7 @@ luaA_widget_new(lua_State *L) if(!a_strcmp(type, "tasklist") || !a_strcmp(type, "taglist")) { - deprecate(L); + deprecate(L, "awful.widget.tasklist and awful.widget.taglist"); luaA_warn(L, "requesting old widgets, return a table to allow smooth execution.\n"); lua_newtable(L); lua_pushcfunction(L, luaA_widget_mouse_add); -- 2.11.4.GIT