Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!allegra.UUCP!kautz From: kautz@allegra.UUCP Newsgroups: comp.emacs Subject: better insert file function version 2 Message-ID: <8709121333.AA25500@EDDIE.MIT.EDU> Date: Sat, 12-Sep-87 09:15:10 EDT Article-I.D.: EDDIE.8709121333.AA25500 Posted: Sat Sep 12 09:15:10 1987 Date-Received: Sun, 13-Sep-87 09:20:41 EDT Sender: daemon@eddie.MIT.EDU Lines: 24 A couple of days ago I posted a "better insert file function". I just determined (blush) that it didn't always work as well as it might for pathnames which include "~" (namely /usr/name would not match against ~). So this version fixes that difficulty. (defun insert-file-name-tail (name) "Prompts for a file or directory name and inserts that name after point. Does not include unnecessary directory path prefixes. The name may be non-existent. Useful in Shell mode." (interactive "FInsert file name: ") (if (string-match (concat "^" (expand-file-name default-directory)) (expand-file-name name)) (setq name (substring (expand-file-name name) (match-end 0)))) (insert name)) ---- Henry Kautz :uucp: allegra!kautz :csnet: kautz@allegra.att.com :arpa: kautz%allegra%btl.csnet@csnet-relay.arpa :mail: AT&T Bell Laboratories Room 3C-402A 600 Mountain Ave. Murray Hill, N.J. 07974 :office phone: (201) 582-2815