f.el icon indicating copy to clipboard operation
f.el copied to clipboard

Uniquify fix

Open Fuco1 opened this issue 6 years ago • 8 comments

This is continuation of #63

I've extracted the function @FrancisMurillo wrote and changed some of the operations to Emacs primitives so it's faster and then applied it to the f--uniquify problem instead of a lambda funcall.

Fuco1 avatar Mar 01 '18 11:03 Fuco1

There's a bunch of other changes related to the readme/docs, I can split it out but meh... ? :D

Fuco1 avatar Mar 01 '18 14:03 Fuco1

As long as they are separate commits, I'm good.

rejeep avatar Mar 01 '18 15:03 rejeep

Oh damn, directory-name-p is emacs 25 only. Are we cool with compat/polyfills or should I reimplement it somehow else?

The implementation is

(defsubst directory-name-p (name)
  "Return non-nil if NAME ends with a directory separator character."
  (let ((len (length name))
        (lastc ?.))
    (if (> len 0)
        (setq lastc (aref name (1- len))))
    (or (= lastc ?/)
        (and (memq system-type '(windows-nt ms-dos))
             (= lastc ?\\)))))

Fuco1 avatar Mar 01 '18 15:03 Fuco1

I trust you judgement 🙂

rejeep avatar Mar 01 '18 15:03 rejeep

I've added f-directory-name? which exposes this to older versions of Emacs. So it is stand-alone function while not shadowing the "global" so that we have a "unified" API for all versions. On E25+ it simply aliases.

Fuco1 avatar Mar 01 '18 17:03 Fuco1

@rejeep There seems to be some issue with the build regarding the snapshot emacs version. I stalls and never produces any error. I've added Emacs 25.2 and 25.3 to the build to cover all released versions.

Are you comfortable merging this with failing build on the snapshot? I'm not quite sure what is there to do about that :O

Fuco1 avatar Mar 06 '18 10:03 Fuco1

@Fuco1 I think we should allow failures for snapshot.

rejeep avatar Mar 12 '18 12:03 rejeep

Ugh... I think I will reimplement the function in some other way, this breaks quite spectacularly with remote file names. And it shouldn't as this is purely string manipulation so we don't actually even need to connect to the remote host.

Fuco1 avatar Mar 12 '18 12:03 Fuco1