Giter Site home page Giter Site logo

Comments (6)

rdiaz02 avatar rdiaz02 commented on August 22, 2024 1

Thanks a lot!!! Closing the issue as fixed.

from xeft.

casouri avatar casouri commented on August 22, 2024

Xeft uses file-name-extension to get the extension of a file, interestingly, it removes "backup version strings" at the end of an extension. so all the "tat~", "txt~" etc becomes "tat", "txt" when xeft compares them to xeft-ignore-extension.

Perhaps it's better to inhibit this "back version" cleaning, hmm...

from xeft.

rdiaz02 avatar rdiaz02 commented on August 22, 2024

Thanks for your reply.

I assume most people will not want their backup files indexed. But I guess the ideal thing would be to allow using extensions without having the ~ removed. But this does not seem straightforward.

from xeft.

rdiaz02 avatar rdiaz02 commented on August 22, 2024

How about changing the use of file-name-extension by this simple alternative:

(defun file-name-extension-no-rm-bckp (file)
  "Return FILENAME’s final \"extension\" without removing backup version strings."
  (substring
   (file-name-nondirectory file)
   (1+ (string-match "\\." (file-name-nondirectory file)))))

Nope, I just tried it and it breaks somewhere else. Sorry for the noise. My elisp is rather limited and I have no idea what is going on.

from xeft.

rdiaz02 avatar rdiaz02 commented on August 22, 2024

This works for me. Define file-name-extension-no-rm-bckp as

(defun file-name-extension-no-rm-bckp (filename &optional period)
  "Return FILENAME's final \"extension\" including backup version strings.
The extension, in a file name, is the part that begins with the last `.',
except that a leading `.' of the file name, if there is one, doesn't count.
This function is the same as `file-name-extension', except it does not call
`file-name-sans-versions' (the function responsible of removing
any parts that indicate backup versions and
version strings.
Return nil for extensionless file names such as `foo'.
Return the empty string for file names such as `foo.' that end in a period.

By default, the returned value excludes the period that starts the
extension, but if the optional argument PERIOD is non-nil, the period
is included in the value, and in that case, if FILENAME has no
extension, the value is \"\"."
  (save-match-data
    (let ((file  (file-name-nondirectory filename)))
      (if (and (string-match "\\.[^.]*\\'" file)
	       (not (eq 0 (match-beginning 0))))
          (substring file (+ (match-beginning 0) (if period 0 1)))
	(if period
	    "")))))

and, then, in xeft-default-file-filter, instead of (not (member (file-name-extension file) we have (not (member (file-name-extension-no-rm-bckp file).

from xeft.

casouri avatar casouri commented on August 22, 2024

Thanks, I thought about this a bit and it's probably more intuitive if we don't remove the "version strings", so I added a function like you suggested.

from xeft.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.