zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@cambridgesiliconradio.com>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: complete (real C) tags
Date: Wed, 17 May 2000 15:54:14 +0100	[thread overview]
Message-ID: <0FUP001EMLEECG@la-la.cambridgesiliconradio.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 606 bytes --]

I don't think I ever posted this; it allows the new completion system to
complete tags from a TAGS or tags file (i.e. the tags used by Emacs and vi,
nothing to do with completion tags).  I have it bound to ^Xt.

I was going to send it to zshu, until I realised it didn't use style tags,
and tried to make it by sticking the _wanted stuff in front, which failed,
so I took it off again.  Only one man will know why...

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


[-- Attachment #2: _complete_tag --]
[-- Type: text/plain, Size: 1404 bytes --]

#compdef -k complete-word \C-xt

# Complete tags using either TAGS or tags.  Looks up your directory
# hierarchy to find one.  If both exist, uses TAGS.
#
# You can override the choice of tags file with $TAGSFILE (for TAGS)
# or $tagsfile (for tags).
#
# Could be rewritten by some sed expert to use sed instead of perl.

# setopt localoptions xtrace

# Tags file to look for
local c_Tagsfile=${TAGSFILE:-TAGS} c_tagsfile=${tagsfile:-tags} expl
# Max no. of directories to scan up through
integer c_maxdir=10

local c_path=
integer c_idir
while [[ ! -f $c_path$c_Tagsfile &&
         ! -f $c_path$c_tagsfile && $c_idir -lt $c_maxdir ]]; do
  (( c_idir++ ))
  c_path=../$c_path
done

if [[ -f $c_path$c_Tagsfile ]]; then
  # prefer the more comprehensive TAGS, which unfortunately is a
  # little harder to parse.
  # could do this with sed, just can't be bothered to work out how,
  # after quarter of an hour of trying, except for
  #  rm -f =sed; ln -s /usr/local/bin/perl /usr/bin/sed
  # but that's widely regarded as cheating.
  # _wanted etags expl 'emacs tags'
  compadd - \
    $(perl -ne '/([a-zA-Z_0-9]+)[ \t:;,\(]*\x7f/ &&
	    print "$1\n"' $c_path$c_Tagsfile)
elif [[ -f $c_tagspath ]]; then
  # tags doesn't have as much in, but the tag is easy to find.
  # we can use awk here.
  # _wanted vtags expl 'vi tags'
  compadd - \
    $(awk '{ print $1 }' $c_path$c_Tagsfile)
else
  return 1
fi

             reply	other threads:[~2000-05-17 14:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-17 14:54 Peter Stephenson [this message]
2000-05-17 16:57 ` Bart Schaefer
2000-05-23 11:44   ` Peter Stephenson
2000-05-24 15:34     ` PATCH: RC_QUOTES Peter Stephenson
2000-05-24 15:52       ` Bart Schaefer
2000-05-24 16:16         ` Peter Stephenson
2000-05-23 12:33 complete (real C) tags Sven Wischnowsky
2000-05-23 12:56 ` Peter Stephenson

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=0FUP001EMLEECG@la-la.cambridgesiliconradio.com \
    --to=pws@cambridgesiliconradio.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).