Article View: gnu.emacs.bug
Article #99554Re: tags rewrite/enhancement
From: Joe Wells
Date: Sat, 07 Jul 1990 00:52
Date: Sat, 07 Jul 1990 00:52
182 lines
8054 bytes
8054 bytes
jbw@zeb.uswest.com (Joe Wells) writes:
jbw@zeb.uswest.com (Joe Wells) writes:
This is a huge rewrite of lisp/tags.el
[rest of article deleted]
It turns out I posted an old version of symbol-syntax.el. Also I had
introduced some bugs in tags-fix.el just before posting it.
I'm including a patch to tags-fix.el which fixes the bugs that I spotted.
I'm also including the correct version of symbol-syntax.el. The version I
posted doesn't work at all.
Following Carl Witty's suggestion, I'm providing installation
instructions. Also, I'm including the missing file symlink-fix.el. These
are included after my signature.
Hopefully, this finally completes the package.
In case it was unclear, the package is a complete replacement for
lisp/tags.el. It integrates a lot of the enhancements to tags.el that
have been made by many different people.
If anyone would like to spend time filling in the missing documentation
strings, this would be very welcome. I won't have the time to properly
finish this thing until after this summer, so any help will speed it up.
Also, I welcome anyone sending me their private tags hacks. My goal is to
integrate all of the tags enhancements floating around out there so that
everyone can enjoy them.
Enjoy,
--
Joe Wells <jbw@uswest.com>
----------------------------------------------------------------------
Installation instructions:
Name the main file tags-fix.el.
Put tags-fix.el, symlink-fix.el, symbol-syntax.el in your load path.
Put the following code in your .emacs (or lisp/default.el)
(fmakunbound 'visit-tags-table) ; obsolete
(fmakunbound 'find-tag)
(autoload 'find-tag "tags-fix" nil t)
(fmakunbound 'find-tag-other-window)
(autoload 'find-tag-other-window "tags-fix" nil t)
(fmakunbound 'lisp-complete-symbol)
(autoload 'lisp-complete-symbol "tags-fix" nil t)
(fmakunbound 'tag-complete-symbol)
(autoload 'tag-complete-symbol "tags-fix" nil t)
(fmakunbound 'next-file)
(autoload 'next-file "tags-fix" nil t)
(fmakunbound 'tags-loop-continue)
(autoload 'tags-loop-continue "tags-fix" nil t)
(fmakunbound 'tags-search)
(autoload 'tags-search "tags-fix" nil t)
(fmakunbound 'tags-query-replace)
(autoload 'tags-query-replace "tags-fix" nil t)
(fmakunbound 'display-tag-info)
(autoload 'display-tag-info "tags-fix" nil t)
(fmakunbound 'pop-tag-mark)
(autoload 'pop-tag-mark "tags-fix" nil t)
(define-key esc-map "?" 'display-tag-info)
(define-key esc-map "*" 'pop-tag-mark)
;; The following are not really implemented:
;;(fmakunbound 'set-buffer-tag-table)
;;(autoload 'set-buffer-tag-table "tags-fix" nil t)
(fmakunbound 'list-tags)
;;(autoload 'list-tags "tags-fix" nil t)
(fmakunbound 'tags-apropos)
;;(autoload 'tags-apropos "tags-fix" nil t)
----------------------------------------------------------------------
;; symlink-fix: Fix to remove symbolic links from file pathnames.
;; Copyright (C) 1989 Free Software Foundation, Inc.
;; This file is not officially part of GNU Emacs, but is being donated
;; to the Free Software Foundation.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY. No author or distributor
;; accepts responsibility to anyone for the consequences of using it
;; or for whether it serves any particular purpose or works at all,
;; unless he says so in writing. Refer to the GNU Emacs General Public
;; License for full details.
;; Everyone is granted permission to copy, modify and redistribute
;; GNU Emacs, but only under the conditions described in the
;; GNU Emacs General Public License. A copy of this license is
;; supposed to have been given to you along with GNU Emacs so you
;; can know your rights and responsibilities. It should be in a
;; file named COPYING. Among other things, the copyright notice
;; and this notice must be preserved on all copies.
;; Created by: Joe Wells, joew@uswest.com
;; Created on: summer 1988
;; Last modified by: Joe Wells, jbw@dodge
;; Last modified on: Mon Jul 2 12:49:27 1990
;; Filename: symlink-fix.el
;; Purpose: remove symbolic links from pathnames
(or (fboundp 'original-expand-file-name)
(fset 'original-expand-file-name
(symbol-function 'expand-file-name)))
(defun symlink-expand-file-name (file-name &optional directory)
"Convert FILENAME to absolute, and canonicalize it.
Second arg DEFAULT is directory to start with if FILENAME is relative
\(does not start with slash); if DEFAULT is nil or missing,
the current buffer's value of default-directory is used.
Filenames containing . or .. as components are simplified;
initial ~ is expanded. See also the function substitute-in-file-name.
This has been modified to resolve all symbolic links from FILENAME.
The original function definition is stored on original-expand-file-name."
(let (left right split link)
(setq right (original-expand-file-name file-name directory))
(setq left "")
(while (not (equal right ""))
(setq split (split-file-name right))
(setq left (join-file-name left (car split)))
(setq right (cdr split))
(setq link (file-symlink-p left))
(if (null link)
nil
(if (eq 0 (length link)) (setq link "."))
(cond ((not (eq (aref link 0) ?/))
(setq split (split-file-name link))
(setq left (join-file-name (file-name-directory left)
(car split)))
(setq right (join-file-name (cdr split) right)))
(t
(setq right (join-file-name link right))
(setq left "")))))
(setq left (original-expand-file-name left))
(if (string-equal left file-name)
file-name
left)))
;; Concatenates LEFT and RIGHT, preserving at most one slash between them.
;; This horrible hack is necessary to work around the fact that
;; expand-file-name treats // specially.
(defun join-file-name (left right)
(let* ((llen (length left))
(rlen (length right))
(lend llen)
(rstart 0)
slash-found)
(while (and (> lend 0)
(eq ?/ (aref left (1- lend))))
(setq slash-found t
lend (1- lend)))
(while (and (< rstart rlen)
(eq ?/ (aref right rstart)))
(setq slash-found t
rstart (1+ rstart)))
(concat (if (eq lend llen) left (substring left 0 lend))
(if slash-found "/" "")
(if (eq rstart 0) right (substring right rstart rlen)))))
;; Splits FILENAME into two strings, and returns a list of the two
;; strings. The first string will be the first filename component in
;; FILENAME, plus any leading slashes, and the second string will be the
;; rest of FILENAME, possibly a string of length 0.
(defun split-file-name (file-name)
(if (string-match "\\`\\(/*[^/]+\\)\\(/.*\\)\\'" file-name)
(cons (substring file-name (match-beginning 1) (match-end 1))
(substring file-name (match-beginning 2) (match-end 2)))
(cons file-name "")))
;; Takes FILENAME and LINK and returns a string which substitutes LINK for
;; the last component of FILENAME.
;;(defun hack-local-link (file-name link)
;; (or (string-match "\\`\\(.*/\\)[^/]+\\'" file-name)
;; (error "hack-local-link bad argument: %s" file-name))
;; (concat (substring file-name (match-beginning 1) (match-end 1)) link))
(provide 'symlink-fix)
Technical Details
Message-ID:
<JBW.90Jul6185200@zeb.uswest.com>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!sunic!uupsi!njin!rutgers!usc!zaphod.mps.ohio-state.edu!ncar!boulder!uswat!jbwReferences:
<JBW.90Jul2094458@zeb.uswest.com> <JBW.90Jul2185257@zeb.uswest.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,95db7e2dab943068 X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1990-07-07 04:32:28 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!sunic!uupsi!njin!rutgers!usc!zaphod.mps.ohio-state.edu!ncar!boulder!uswat!jbw From: jbw@zeb.uswest.com (Joe Wells) Newsgroups: gnu.emacs.bug Subject: Re: tags rewrite/enhancement Message-ID: <JBW.90Jul6185200@zeb.uswest.com> Date: 7 Jul 90 00:52:00 GMT References: <JBW.90Jul2094458@zeb.uswest.com> <JBW.90Jul2185257@zeb.uswest.com> Sender: news@uswat.UUCP Organization: U S West Advanced Technologies Lines: 182 Posted: Sat Jul 7 01:52:00 1990 In-reply-to: jbw@zeb.uswest.com's message of 3 Jul 90 00:52:57 GMT