From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: Is there way to read function invoked and its parameters? Date: Mon, 28 Dec 2020 10:07:20 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2243"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0 (3d08634) (2020-11-07) Cc: Help GNU Emacs To: Yuri Khan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 28 08:09:39 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ktmew-0000Tt-ME for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 28 Dec 2020 08:09:38 +0100 Original-Received: from localhost ([::1]:36502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktmev-0005Cc-Ny for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 28 Dec 2020 02:09:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktmeL-0005CV-87 for help-gnu-emacs@gnu.org; Mon, 28 Dec 2020 02:09:01 -0500 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:54205) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktmeJ-0008HN-6J for help-gnu-emacs@gnu.org; Mon, 28 Dec 2020 02:09:00 -0500 Original-Received: from localhost ([::ffff:154.225.255.210]) (AUTH: PLAIN securesender, TLS: TLS1.2,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000005DD3D.000000005FE98487.000049DD; Mon, 28 Dec 2020 00:08:55 -0700 Mail-Followup-To: Yuri Khan , Help GNU Emacs Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126838 Archived-At: * Yuri Khan [2020-12-27 22:11]: > Firstly, ‘tabulated-list-mode’ should probably never be “called” as > such. Instead, modes should be derived from it. (In OOP terms, > ‘tabulated-list-mode’ should be treated as an abstract base class.) Alright, I am doing it that way. > ‘tabulated-list-mode’ is derived from ‘special-mode’ which binds the > ‘g’ key to ‘revert-buffer’. The behavior of ‘revert-buffer’ is > customized by setting ‘revert-buffer-function’ locally. > > ‘tabulated-list-mode’ sets ‘revert-buffer-function’ to > ‘tabulated-list-revert’. The behavior of ‘tabulated-list-revert’ is > customized by adding to ‘tabulated-list-revert-hook’. Good information, that is what I have to use. > Be aware that setting a major mode kills all local variables. So you > might want to structure your report mode and functions like this: > > (defvar-local my-report--context … > "…documentation…") > > (defun my-report--revert () > "…documentation…" > (setq tabulated-list-entries …something computed from > my-report--context…)) > > (define-derived-mode my-report-mode tabulated-list-mode "…" > "…documentation…" > (add-hook 'tabulated-list-revert #'my-report--revert)) The principle for refreshing or reverting is there, that is right. Only that it is very inconvenient especially if there is large number of functions. In the above example I would rather like to pass some dynamically defined function to add-hook then making many revert functions for each report. I am now thinking to employ something like this concept: (defun my-report (arg1 arg2 arg3) (cl-flet my-report--revert () (my-report arg1 arg2 arg3)) (invoke-other-function 'my-report--revert)) Then other function can set up hooks by using that function. Does this sound alright to you?