home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.lucid-emacs.help
- Path: sparky!uunet!boulder!news!grunwald
- From: grunwald@eclipse.cs.colorado.edu (Dirk Grunwald)
- Subject: x-find-selected-file
- Message-ID: <GRUNWALD.92Aug14115550@eclipse.cs.colorado.edu>
- Sender: news@colorado.edu (The Daily Planet)
- Nntp-Posting-Host: eclipse.cs.colorado.edu
- Reply-To: grunwald@foobar.cs.colorado.edu
- Organization: University of Colorado at Boulder
- Distribution: alt
- Date: 14 Aug 92 11:55:50
- Lines: 23
-
-
- Something like this might be a better choice for the ``open file''
- menubar item.
-
- (defun x-find-selected-file ()
- (interactive)
- (setq last-command nil)
- (let
- ((filename nil))
- (if (and (x-selection-owner-p) primary-selection-extent)
- (save-excursion
- (set-buffer (extent-buffer primary-selection-extent))
- (setq filename
- (buffer-substring
- (extent-start-position primary-selection-extent)
- (extent-end-position primary-selection-extent))))
- )
- (if (and filename (file-exists-p filename))
- (find-file filename)
- (call-interactively 'find-file)
- )
- )
- )
-