Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: option to show file:line everytime echo is called?
- X-seq: zsh-users 22357
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: option to show file:line everytime echo is called?
- Date: Thu, 12 Jan 2017 23:57:49 -0800 (PST)
- Cc: Timothee Cour <timothee.cour2@xxxxxxxxx>
- In-reply-to: <20170113035730.GA1812@fujitsu.shahaf.local2>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CGME20170110091259epcas5p14d052ee1dc7ebb5c4dd74e4aa02a8d18@epcas5p1.samsung.com> <CANri+EzTiiKkfeDODR8PyBc=khLFONk738sFp7Vpo4uzwKMoXw@mail.gmail.com> <20170110093042.41111f8a@pwslap01u.europe.root.pri> <CANri+EwT3h8MkpeKSd-9_QLp9S=TEibmSgjS3r9mv0jY46dQAw__39244.7733007886$1484262699$gmane$org@mail.gmail.com> <20170113035730.GA1812@fujitsu.shahaf.local2>
- Reply-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
On Fri, 13 Jan 2017, Daniel Shahaf wrote:
> % echo() { set -x; builtin echo "$@" }
That's more output than he wanted.
echo() { print -n "$funcfiletrace> "; builtin echo "$@" }
is probably more like it.
Similarly
typeset -AgH whence_my_alias
alias() {
emulate -L zsh
local opts
zparseopts -D -a opts L g m r s
if [[ -z $opts[-m] && $1 = *=* ]] && whence_my_alias[${1%=*}]=$functrace
builtin alias $opts $*
}
whence() {
local whence="$(builtin whence "$@")"
case "$whence" in
(* is an alias for *)
local from="${whence_my_alias[${whence%% *}]}"
print -r -- "$whence" ${from:+from} "$from"
;;
(*) print -r -- "$whence";;
esac
}
Some edge cases possibly not caught.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author