all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: "56754@debbugs.gnu.org" <56754@debbugs.gnu.org>
Subject: bug#56754: 28.1; Please move general stuff from `ffap.el' to `files.el'
Date: Tue, 26 Jul 2022 15:00:00 +0000	[thread overview]
Message-ID: <CO6PR10MB5473CA4D5F0375DC98A9462FF3949@CO6PR10MB5473.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87y1wg11jz.fsf@gnus.org>

> > One example of such a function: `ffap-all-subdirs' (and its internal
> > helper function `ffap-all-subdirs-loop').
> 
> I don't think ffap-all-subdirs is generally useful:

Did you understand that the request is not about
`ffap-all-subdirs'?  If not, please read it again.

[ And see the comment in ffap.el under "File Name
  Handling": "Too many features here."  That's
  essentially a "TODO".  And the example is set
  there by commenting out the general functions
  `ffap-last' and `ffap-splice'.

  And see the comment with `ffap-locate-file',
  which cries out for `locate-library' to accept
  an optional arg to override suffixes. ]

> ---
> Directories beginning with \".\" are ignored, and directory
> symlinks are listed but never searched (to avoid loops).
> ---

Ignoring symlinks by default is what you
generally want from a function that gives you a
list of directories under/within the current one.

If you're really interested in a more general
function that lets you get or not get symlinks,
then define it.

The point is that such a general function doesn't
belong in `ffap.el'.  `ffap.el' could just make
use of it (ditto, `dired.el' or any other library).

Here's one such general function from Dired+, for
instance:

 diredp-directories-within is a Lisp function in 'dired+.el'.

 (diredp-directories-within &optional DIRECTORY NO-SYMLINKS-P
 PREDICATE)

 List of accessible directories within DIRECTORY.
 Directories in `vc-directory-exclusion-list' are skipped.

 Optional arg DIRECTORY defaults to the value of `default-directory'.
 Non-nil optional arg NO-SYMLINKS-P means do not follow symbolic links.
 Non-nil optional arg PREDICATE must be a function that accepts a
  file-name argument.  Only directories that satisfy PREDICATE are
  included in the result.

And yes, that's similarly more general than Dired.
Such a function really belongs in `files.el', not
in `ffap.el' or `dired.el'.

> It's well-suited for what ffap does, though, 
> which is why it lives in that file.

Nah.  It lives in `ffap.el' for hysterical raisins.

What about other `ffap.el' functions (and vars)
that, like `ffap-all-subdirs', aren't particularly
related to ffap?  E.g.:

 ffap-list-env
 ffap-reduce-path
 ffap-locate-file
 ffap-symbol-value
 ffap-file-suffix
 ffap-file-exists-string
 ffap-file-remote-p
 ffap-machine-p
 ffap-machine-at-point
 ffap-host-to-filename
 ffap-fixup-machine
 ffap-url-p
 ffap-url-unwrap-local
 ffap-url-unwrap-remote
 ffap-fixup-url
 ffap-read-file-or-url

There's a bunch of stuff in `ffap.el' that isn't
specifically related to picking up a file/url/*
name at point.

It's there because such picking-up needs it -
because _it isn't defined elsewhere_, in a more
general, always-loaded library.  That it's used
in `ffap.el' doesn't mean its definition belongs
there.

And why do some of the `ffap.el' commands that
open Dired have names with prefix `ffap-dired-',
but others have only prefix `dired-'?
Hysterical raisins?  

> Closing.

Too bad.  `ffap.el' needs cleanup.  Other files
could take advantage of its too-general stuff.
File-general functions belong in a library such
as `files.el'.





      reply	other threads:[~2022-07-26 15:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-24 23:40 bug#56754: 28.1; Please move general stuff from `ffap.el' to `files.el' Drew Adams
2022-07-26 12:49 ` Lars Ingebrigtsen
2022-07-26 15:00   ` Drew Adams [this message]

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=CO6PR10MB5473CA4D5F0375DC98A9462FF3949@CO6PR10MB5473.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=56754@debbugs.gnu.org \
    --cc=larsi@gnus.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.