Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter entries? #527

Open
drishal opened this issue May 6, 2024 · 6 comments
Open

filter entries? #527

drishal opened this issue May 6, 2024 · 6 comments

Comments

@drishal
Copy link

drishal commented May 6, 2024

is there a way to prevent some entries from being displayed? Like say if the length of the file name (with path) exceeds certain characters or if it starts with some other character (like say /ssh:) it should not display in say, recent files

@jcs090218
Copy link
Member

You can delete entries from the recent files.

@drishal
Copy link
Author

drishal commented May 9, 2024

You can delete entries from the recent files.

I mean I wanted to keep it in recentf but prevent some of those from displaying and breaking the dashboard specially if file names are too long

@jcs090218
Copy link
Member

This is not possible at the moment. 🤔 Feel free to open PR for this.

@ricardoricho
Copy link
Contributor

Hi, if the length of the file is the problem there is dashboard-path-style to truncate the file path, also you can customize dashboard-path-max-length and even dashboard-path-shorten-string.
Does this help, or you think we still need the filter function?

@drishal
Copy link
Author

drishal commented May 20, 2024

Hi, if the length of the file is the problem there is dashboard-path-style to truncate the file path, also you can customize dashboard-path-max-length and even dashboard-path-shorten-string. Does this help, or you think we still need the filter function?

Probably add the filter function just for excluding some directories or ssh paths

@ricardoricho
Copy link
Contributor

Hi @drishal I think there's no need for the filter function, at least not in the dashboard. I was looking to recentf-mode and there is recentf-exclude that is:

List of regexps and predicates for filenames excluded from the recent list.
...
A predicate is a function that is passed a filename to check and that must return non-nil to exclude it.

So, you could define a function to filter those files just for the dashboard:

(defun dashboard-recentf-filter (file)
  "Add to ~recentf-exclude~ to filter recent files in dashboard buffer."
  (when (eq (get-buffer dashboard-buffer-name)
            (current-buffer))
    (string-match "^/ssh:" file)))

Add it to the recentf-exclude list:

(add-to-list 'recentf-exclude 'dashboard-recentf-filter)

Hope this help.

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

No branches or pull requests

3 participants