Comments (6)
Thanks a lot!!! Closing the issue as fixed.
from xeft.
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.
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.
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.
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.
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)
- Add MS-Windows support ? HOT 17
- how to exclude a given directory HOT 2
- How to use xeft on macOS? Thank you very much. HOT 1
- xapian didn't support long file path HOT 4
- Description typo HOT 1
- How to exclude indexing folders? Thank you very much. HOT 2
- How to use xeft-file-list-function correctly? HOT 4
- backup usage HOT 8
- :PROPERTIES: or --- Extracted as Title on all files listed rather than #+TITLE or yaml frontmatter title: HOT 4
- Show file name in xeft buffer HOT 2
- Show preview for all files as one goes through each one HOT 5
- Numbers/digits in query are ignored HOT 4
- -<token> does not work HOT 5
- face highlighting on random entry when opening left HOT 2
- Could xeft support arm64? HOT 9
- Having trouble previewing files with xeft? HOT 1
- xeft isn't finding the dynamic's module path HOT 2
- how to use it with org-roam HOT 1
- xeft not working on Ubuntu 24.04 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xeft.