Skip to content

Add projectile-files-transform-functions for file names collected as raw bytes - #2199

Open
attilayener wants to merge 2 commits into
bbatsov:masterfrom
attilayener:files-transform-functions
Open

attilayener wants to merge 2 commits into
bbatsov:masterfrom
attilayener:files-transform-functions

Conversation

@attilayener

Copy link
Copy Markdown

Fixes #1743

Problem

On platforms whose file-name coding system doesn't cover some characters
(e.g. Emacs on Windows with a legacy system code page), project file names
containing non-ASCII characters are collected as raw byte escapes like
\305\264\303\251. The escapes end up both in commands such as
projectile-find-file and in the persistent cache.

Solution

As discussed in #1743, this adds a new option -
projectile-files-transform-functions - that applies a list of functions
to every file name Projectile collects for a project. The transforms run
after indexing and before the list is cached and presented, so the
cache holds the final representation as well.

The default is nil: file names are used as collected and no extra work
is done, so nothing changes for existing users.

;; example: decode raw-byte file names as UTF-8
(setq projectile-files-transform-functions
      (list (lambda (file) (decode-coding-string file 'utf-8))))

All indexing methods (alien, hybrid, native) pass through the same
transform step.

Notes

  • documented in doc/modules/ROOT/pages/indexing.adoc
  • covered by tests in test/projectile-indexing-test.el
  • changelog entry added

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-latin characters in filenames

1 participant