Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: real time alias?



Hi Justin,

On Fri, Mar 16, 2018 at 12:19:03PM -0500, Justin M Wozniak wrote:
> Is there a way to have aliases work as macros?

the point i was trying to emphasize in my last mail is that
aliases really are macros (as preprocessor macros ...
not hygenic ones ...) that can be redefined
(from a user perspective: i rarely dove into the zsh code).

if you want to see that in action, `which` can help

    alias foo='echo this is it'
    bar () {
        print hello
        foo
    }
    alias foo=booog
    which bar

outputs the content of the function where you can see that
* there is no more mention of 'foo'
* foo is substitued with the value of foo at the time the function was
  defined

    bar () {
        print hello
        echo this is it
    }

is this what you asked for ?

> For example, can some
> modification of warn_ () be used to return from the calling function?

can you give an exemple of what you would like to get ?


hth
marc



Messages sorted by: Reverse Date, Date, Thread, Author