help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Metaprogramming


From: Shyam Nath
Subject: Re: Metaprogramming
Date: Sun, 15 Sep 2019 19:39:54 +1000
User-agent: Zoho Mail

๐Ÿ–– Hello Teemu,



I am doing the 2โฟแตˆ option: https://stackoverflow.com/a/15725437



How can I access functions before they load?



LIVE LONG AND PROSPER \V/,
AGENT S.
๐Ÿ•ด
Migrating Infestive Bugs !!



---- On Sun, 15 Sep 2019 17:32:59 +1000 Teemu Likonen <tlikonen@iki.fi> wrote 
----


Shyam Nath [2019-09-15T13:13:09+10] wrote: 
 
> I want to redefine functions by manipulating the pre-existing 
> function; is there any way to do this? 
 
You can keep the original function code in a variable. Use that variable 
to define the global function first and later all modified versions of 
it. 
 
 
 (defvar function-code (lambda (...) ...)) 
 
 (setf (symbol-function 'modifiable-function) function-code) 
 
 
I think it is better to keep your defuns static and make them call 
other functions which are stored in a variable or other predefined 
place. 
 
 
 (defvar modifiable-function (lambda (...) ...)) 
 
 (defun static-function (...) 
 ;; ... 
 (funcall modifiable-function ...) 
 ;; ... 
 ) 
 
-- 
///  OpenPGP key: 4E1055DC84E9DFF613D78557719D69D324539450 
// https://keys.openpgp.org/search?q=tlikonen@iki.fi 
/ https://keybase.io/tlikonen https://github.com/tlikonen


reply via email to

[Prev in Thread] Current Thread [Next in Thread]