all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: ffap: if file at point doesn't exist, but its directory does
Date: Mon, 17 Nov 2003 19:14:17 +0200	[thread overview]
Message-ID: <87y8uezzme.fsf@mail.jurta.org> (raw)
In-Reply-To: <87vfplcwmu.fsf@jidanni.org> (Dan Jacobson's message of "Sun, 16 Nov 2003 02:30:33 +0800")

Dan Jacobson <jidanni@jidanni.org> writes:
> Ffap gentlemen, assume your cursor is on
> "/usr/X11R6/lib/X11/xdm/Xreset" but the file doesn't exist, but the
> directory does.  Well, ffap should (optionally ask, and) take you to a
> dired of that directory... better than the current nothing.

I have another problem with ffap: it can't find a file if file name
contains spaces.  I fixed this problem by the new function:

(defun my-find-file-at-point-or-region (&optional arg)
  "Find filename at point or selected by region.
This function is useful, when filename contains spaces, and so can't
be fully matched by `find-file-at-point'.  In this case user should
manually select region around the full filename and invoke this command.
This function also maps UNIX filenames to Window$ filenames."
  (interactive "P")
  (let ((filename
         (if (and transient-mark-mode mark-active)
             (buffer-substring-no-properties (mark) (point))
           (ffap-string-at-point))))
    (and (eq system-type 'windows-nt)
         filename
         (string-match "^/dos/\\([A-Za-z]\\)\\(.*\\)" filename)
         (setq filename (concat (match-string 1 filename) ":"
                                (match-string 2 filename))))
    (or (and filename (file-exists-p filename))
        (setq filename (ffap-guesser)))
    (find-file-at-point (ffap-prompter filename))))

But I think it is not the right thing yet.  Ffap should be fixed
to pick up full file name with spaces without requiring the user
to select a region.

-- 
http://www.jurta.org/emacs/

  reply	other threads:[~2003-11-17 17:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-15 18:30 ffap: if file at point doesn't exist, but its directory does Dan Jacobson
2003-11-17 17:14 ` Juri Linkov [this message]
     [not found] <mailman.133.1068938260.399.bug-gnu-emacs@gnu.org>
2003-11-17 16:39 ` Kevin Rodgers
2003-11-21  0:25   ` Dan Jacobson

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=87y8uezzme.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=bug-gnu-emacs@gnu.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.