[Emacs] Fewer regexes for recentf-exclude
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Lucien Cartier-Tilet 2022-05-06 19:48:12 +02:00
parent 7d04a5c41a
commit 446db02df4
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -675,6 +675,25 @@ focus the new window immediately.
(delete-window))) (delete-window)))
#+end_src #+end_src
** Extend ~add-to-list~
:PROPERTIES:
:CUSTOM_ID: Custom-Elisp-Extend-add-to-list-eh2325605gj0
:END:
One function I find missing regarding ~add-to-list~ is ~add-all-to-list~
so I can add multiple elements to a list at once. Instead, with
vanilla Emacs, I have to repeatedly call ~add-to-list~. Thats not very
clean. Lets declare this missing function:
#+begin_src emacs-lisp
(defun add-all-to-list (list-var elements &optional append compare-fn)
"Add ELEMENTS to the value of LIST-VAR if it isnt there yet.
ELEMENTS is a list of values. For documentation on the variables
APPEND and COMPARE-FN, see `add-to-list'."
(let (return)
(dolist (elt elements return)
(setq return (add-to-list list-var elt append compare-fn)))))
#+end_src
* Package Management * Package Management
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Package-Managementqpwkel6184j0 :CUSTOM_ID: Package-Managementqpwkel6184j0
@ -2760,16 +2779,20 @@ excluded files.
:straight (:build t :type built-in) :straight (:build t :type built-in)
:custom ((recentf-max-saved-items 2000)) :custom ((recentf-max-saved-items 2000))
:config :config
(add-to-list 'recentf-exclude (rx (* any) ;; no Elfeed or native-comp files
(or "elfeed-db" "eln-cache") (add-all-to-list 'recentf-exclude
(* any))) `(,(rx (* any)
(add-to-list 'recentf-exclude (rx (* any) (or "elfeed-db"
"eln-cache"
"conlanging/content" "conlanging/content"
"org/config"
"/Mail/Sent"
".cache/")
(* any) (* any)
(or "html" "pdf" "tex"))) (? (or "html" "pdf" "tex" "epub")))
(add-to-list 'recentf-exclude ".*/Mail/Sent.*") ,(rx "/"
(add-to-list 'recentf-exclude ".*\\.cache/.*") (or "rsync" "ssh" "tmp")
(add-to-list 'recentf-exclude "/rsync.*")) (* any)))))
#+end_src #+end_src
*** Screenshot *** Screenshot