* Path Operations: Concatenation (concat), Extraction of sub-paths, etc.
@ 2007-04-26 15:53 Nordlöw
2007-04-27 6:47 ` Kai Grossjohann
[not found] ` <mailman.2578.1177656828.7795.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 3+ messages in thread
From: Nordlöw @ 2007-04-26 15:53 UTC (permalink / raw)
To: help-gnu-emacs
Hey again, Emacs Powerusers!
I am looking for convenience functions for path operations, typically
- concatenation of paths: (path-concat "/usr/" "/lib") => "/usr/lib/"
- extraction of sub-paths: (path-before "/usr/lib/" "/lib/") => "usr/"
- extraction of sub-paths: (path-after "/usr/lib/X11" "lib") => "X11/"
- full path to local file name: (path-local "/etc/passwd") => "passwd"
- full path to containing directory path: (path-dir "/etc/passwd") =>
"/etc/"
If possible results should be standardized/canonicalized, that is
- directories always end with "/"
- non-absolute paths always begin directly with the top-most directory
name without the "/"
/Nordlöw
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Path Operations: Concatenation (concat), Extraction of sub-paths, etc.
2007-04-26 15:53 Path Operations: Concatenation (concat), Extraction of sub-paths, etc Nordlöw
@ 2007-04-27 6:47 ` Kai Grossjohann
[not found] ` <mailman.2578.1177656828.7795.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 3+ messages in thread
From: Kai Grossjohann @ 2007-04-27 6:47 UTC (permalink / raw)
To: help-gnu-emacs
Nordlöw <per.nordlow@gmail.com> writes:
> - concatenation of paths: (path-concat "/usr/" "/lib") => "/usr/lib/"
Not exactly, but close: expand-file-name
> - extraction of sub-paths: (path-before "/usr/lib/" "/lib/") => "usr/"
Not exactly, but close, perhaps: file-name-directory,
file-name-nondirectory.
> - extraction of sub-paths: (path-after "/usr/lib/X11" "lib") => "X11/"
See above.
> - full path to local file name: (path-local "/etc/passwd") => "passwd"
file-name-nondirectory
> - full path to containing directory path: (path-dir "/etc/passwd") =>
> "/etc/"
file-name-directory
> If possible results should be standardized/canonicalized, that is
> - directories always end with "/"
file-name-as-directory
> - non-absolute paths always begin directly with the top-most directory
> name without the "/"
Hm. There must be a function to strip leading "./" and "/./" in the
middle, but I don't know what it is. There is file-truename which
might do this as a side effect.
Kai
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Path Operations: Concatenation (concat), Extraction of sub-paths, etc.
[not found] ` <mailman.2578.1177656828.7795.help-gnu-emacs@gnu.org>
@ 2007-04-30 5:10 ` Stefan Monnier
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2007-04-30 5:10 UTC (permalink / raw)
To: help-gnu-emacs
>> - full path to local file name: (path-local "/etc/passwd") => "passwd"
> file-name-nondirectory
Or file-relative-name, depending.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-04-30 5:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-26 15:53 Path Operations: Concatenation (concat), Extraction of sub-paths, etc Nordlöw
2007-04-27 6:47 ` Kai Grossjohann
[not found] ` <mailman.2578.1177656828.7795.help-gnu-emacs@gnu.org>
2007-04-30 5:10 ` Stefan Monnier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).