all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Function to normalize windows file name
@ 2021-02-16  8:56 yyoncho
  2021-02-16  9:36 ` Eli Zaretskii
  2021-02-16  9:54 ` Joost Kremers
  0 siblings, 2 replies; 6+ messages in thread
From: yyoncho @ 2021-02-16  8:56 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 213 bytes --]

Hi,

Is there emacs function that can be used to convert filename from
C:\foo\bar to C:\Foo\Bar where C:\Foo\Bar is the path that one will see in
native windows applications(e. g. Windows Explorer).

Thanks,
Ivan

[-- Attachment #2: Type: text/html, Size: 298 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Function to normalize windows file name
  2021-02-16  8:56 Function to normalize windows file name yyoncho
@ 2021-02-16  9:36 ` Eli Zaretskii
  2021-02-16 13:49   ` yyoncho
  2021-02-16  9:54 ` Joost Kremers
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2021-02-16  9:36 UTC (permalink / raw)
  To: emacs-devel, yyoncho, emacs-devel

On February 16, 2021 10:56:43 AM GMT+02:00, yyoncho <yyoncho@gmail.com> wrote:
> Hi,
> 
> Is there emacs function that can be used to convert filename from
> C:\foo\bar to C:\Foo\Bar where C:\Foo\Bar is the path that one will
> see in
> native windows applications(e. g. Windows Explorer).
> 
> Thanks,
> Ivan

I don't think I understand the request, since both file names you gave are identical except for the letter-case.

Is the issue the letter-case?  Or is it the backslashes instead of forward slashes?  Or something else?

Or maybe you could describe the actual issue you are trying to solve?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Function to normalize windows file name
  2021-02-16  8:56 Function to normalize windows file name yyoncho
  2021-02-16  9:36 ` Eli Zaretskii
@ 2021-02-16  9:54 ` Joost Kremers
  1 sibling, 0 replies; 6+ messages in thread
From: Joost Kremers @ 2021-02-16  9:54 UTC (permalink / raw)
  To: yyoncho; +Cc: emacs-devel


On Tue, Feb 16 2021, yyoncho wrote:
> Is there emacs function that can be used to convert filename from
> C:\foo\bar to C:\Foo\Bar where C:\Foo\Bar is the path that one will see in
> native windows applications(e. g. Windows Explorer).

`capitalize`?

-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Function to normalize windows file name
  2021-02-16  9:36 ` Eli Zaretskii
@ 2021-02-16 13:49   ` yyoncho
  2021-02-16 15:49     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: yyoncho @ 2021-02-16 13:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 953 bytes --]

Hi Eli,

The issue is the letter case because for one reason or another we often end
up with file names being downcased. Apparently, file-truename is able to
fix that issue(I was under the impression that it does not work that way).

Thanks,
Ivan

On Tue, Feb 16, 2021 at 11:36 AM Eli Zaretskii <eliz@gnu.org> wrote:

> On February 16, 2021 10:56:43 AM GMT+02:00, yyoncho <yyoncho@gmail.com>
> wrote:
> > Hi,
> >
> > Is there emacs function that can be used to convert filename from
> > C:\foo\bar to C:\Foo\Bar where C:\Foo\Bar is the path that one will
> > see in
> > native windows applications(e. g. Windows Explorer).
> >
> > Thanks,
> > Ivan
>
> I don't think I understand the request, since both file names you gave are
> identical except for the letter-case.
>
> Is the issue the letter-case?  Or is it the backslashes instead of forward
> slashes?  Or something else?
>
> Or maybe you could describe the actual issue you are trying to solve?
>

[-- Attachment #2: Type: text/html, Size: 1464 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Function to normalize windows file name
  2021-02-16 13:49   ` yyoncho
@ 2021-02-16 15:49     ` Eli Zaretskii
  2021-02-16 21:15       ` yyoncho
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2021-02-16 15:49 UTC (permalink / raw)
  To: yyoncho; +Cc: emacs-devel

> From: yyoncho <yyoncho@gmail.com>
> Date: Tue, 16 Feb 2021 15:49:38 +0200
> Cc: emacs-devel <emacs-devel@gnu.org>
> 
> The issue is the letter case because for one reason or another we often end up with file names being
> downcased. Apparently, file-truename is able to fix that issue(I was under the impression that it does not
> work that way). 

Yes, file-truename is the solution for the letter-case issue.

However, if the problem to solve is that you compare file names as
strings, and that's why downcasing gets in the way, I'd like to point
out a few related aspects:

  . first, file names aren't supposed to be downcased in Emacs, at
    least not by default, so figuring out why this happens could solve
    the issue more cleanly (file-truename can be expensive)
  . if there's no simple way to prevent downcasing, you could either
    compare file names case-insensitively or use file-equal-p



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Function to normalize windows file name
  2021-02-16 15:49     ` Eli Zaretskii
@ 2021-02-16 21:15       ` yyoncho
  0 siblings, 0 replies; 6+ messages in thread
From: yyoncho @ 2021-02-16 21:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1424 bytes --]

Hi Eli,

Our main issue is that we cannot use anything that involves file-truename
when we are handling server diagnostic events due to the method being too
slow. We avoid calling file-truename successfully - it just took us a lot
of iterations to end up with what we currently have.

>  compare file names case-insensitively

Hm, we use it for hashtable keys, so I guess we can create ht with a custom
hash/equal functions and avoid downcasing upfront. I will check if this
works because it will certainly yield better code.

Thanks,
Ivan

On Tue, Feb 16, 2021 at 5:48 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: yyoncho <yyoncho@gmail.com>
> > Date: Tue, 16 Feb 2021 15:49:38 +0200
> > Cc: emacs-devel <emacs-devel@gnu.org>
> >
> > The issue is the letter case because for one reason or another we often
> end up with file names being
> > downcased. Apparently, file-truename is able to fix that issue(I was
> under the impression that it does not
> > work that way).
>
> Yes, file-truename is the solution for the letter-case issue.
>
> However, if the problem to solve is that you compare file names as
> strings, and that's why downcasing gets in the way, I'd like to point
> out a few related aspects:
>
>   . first, file names aren't supposed to be downcased in Emacs, at
>     least not by default, so figuring out why this happens could solve
>     the issue more cleanly (file-truename can be expensive)
>
>

[-- Attachment #2: Type: text/html, Size: 2065 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-16 21:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-16  8:56 Function to normalize windows file name yyoncho
2021-02-16  9:36 ` Eli Zaretskii
2021-02-16 13:49   ` yyoncho
2021-02-16 15:49     ` Eli Zaretskii
2021-02-16 21:15       ` yyoncho
2021-02-16  9:54 ` Joost Kremers

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.