Matthias wrote: > Hi, > > I have the following problem: How do I advice a function so that > within that function, the function `read-minibuffer' (for example) > calls the definition of another function, say `my-read-minibuffer'? > > I'm trying to use an advice around the function; the advice providing > a binding of the symbol `read-minibuffer' to the definition of > `my-read-minibuffer'. Like the following: > > (defadvice la-fonction > (around la-fonction-extended enable compile) > "Documentation" > (let (f1) > (fset 'f1 read-minibuffer) > (fset 'read-minibuffer my-read-minibuffer) > ad-do-it > (fset 'read-minibuffer f1))) > > Any comment? Is it silly? Is there a better way? Any idea? >
I asked the 'is there a better way' question not too long ago concerning the problem below and got no response so this might be as good as it gets. I do it slightly different from your example. I think you really don't need f1 in your advice code. ; I don't like bookmark mouse-2 opening the file in another window. ; There doesn't seem to be any other way to fix the problem. The ; theory here is to temporarily re-define the function that the mouse ; handler does call giving it the definition of the function I wish it ; would call. (defadvice bookmark-bmenu-other-window-with-mouse (around my-fix first () activate) ;rgb 2004 "Changes behavior to open file in same window, not other-window." (let (bookmark-bmenu-other-window) (fset 'bookmark-bmenu-other-window (symbol-function 'bookmark-bmenu-this-window)) ad-do-it)) _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs