zsh-users
 help / color / mirror / code / Atom feed
From: Brandon Sandrowicz <brandon@sandrowicz.org>
To: czech@sonic.net
Cc: zsh-users@zsh.org
Subject: Re: Function not found
Date: Thu, 20 Dec 2012 04:03:05 -0500	[thread overview]
Message-ID: <20121220090305.GD1915@helium> (raw)
In-Reply-To: <37060.148.87.67.207.1355985863.squirrel@webmail.sonic.net>

On Wed, Dec 19, 2012 at 10:44:23PM -0800, czech@sonic.net wrote:
> Greetings!
> 
> I have a function I use to connect to remote hosts. I call my function _ssh:
> 
> _ssh() {
>     ssh -XC "czechar@$@"
> }
> 
> I keep my functions in a directory under my home dir. I call the directory
> .zfuncs. I read my functions in my .zshrc via autoload and add them to my
> fpath:
> 
> autoload -- ~/.zfunc/[^_]*(:t)
> fpath=( ~/.zfunc $fpath )

The autoload command you have here appears to be your problem. You
probably want something like:

    autoload _ssh
    fpath=( ~/.zfunc $fpath )

If your _ssh function is defined in the file ~/.zfunc/_ssh, your
original command *could* work, but you would have to remove the '[^_]'
which prevents files beginning with underscores.

To be clear, autoload wants the names of the *functions*, not the names
of the files. Your approach above could work so long as each function is
in a separate file, and both (file and function) share the same exact
name (i.e. can't be _ssh.zsh).

> But when I try to use _ssh, zsh tells me:
> 
> Grendel:czech:~> _ssh adc2201650
> zsh: correct '_ssh' to 'ssh' [nyae]?
> 
> I thought I had told zsh not to correct my spelling for ssh via:
> 
> alias ssh='nocorrect ssh'

I think that you have the wrong idea here. From my reading of the
manpage, nocorrect only disables correction for the current command.
What you're attempting to do with it, would have to be accomplished by:

    alias _ssh='nocorrect _ssh'

E.g.:

    $ function _ssh() { echo "HERE"; }
    $ alias _ssh='nocorrect _ssh'
    $ _ssh
    HERE

Now when you run the _ssh function, the alias will expand the call to
"nocorrect _ssh" forcing auto-correct to ignore '_ssh'.

> The function was working without issue until I ran compinstall. I have
> commented out the lines added to my .zshrc by compinstall, but the problem
> persists.
> 
> Any ideas on what the problem is here?
> 
> Thanks in advance.
> 
> 
> 
> Corwin

Disclaimer: I know none of this for sure as I don't use CORRECT or my own
autoloads/fpath. I just gleaned this from the manpages, and poking at it
in a shell, so it's entirely possible that I don't know what I'm talking
about as I'm no zshell wizard.
-- 
Brandon Sandrowicz


  reply	other threads:[~2012-12-20 14:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-19 15:22 forbidden variable in for loop Ray Andrews
2012-12-19 23:58 ` Danek Duvall
2012-12-19 16:03   ` Ray Andrews
2012-12-20  6:44     ` Function not found czech
2012-12-20  9:03       ` Brandon Sandrowicz [this message]
2012-12-20 11:02       ` Jérémie Roquet
2012-12-21 18:11         ` Bart Schaefer
2012-12-20  0:04 ` forbidden variable in for loop Frank Terbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121220090305.GD1915@helium \
    --to=brandon@sandrowicz.org \
    --cc=czech@sonic.net \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).