[Emacs] Fewer regexes for recentf-exclude

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"
"conlanging/content" "eln-cache"
(* any) "conlanging/content"
(or "html" "pdf" "tex"))) "org/config"
(add-to-list 'recentf-exclude ".*/Mail/Sent.*") "/Mail/Sent"
(add-to-list 'recentf-exclude ".*\\.cache/.*") ".cache/")
(add-to-list 'recentf-exclude "/rsync.*")) (* any)
(? (or "html" "pdf" "tex" "epub")))
,(rx "/"
(or "rsync" "ssh" "tmp")
(* any)))))
#+end_src #+end_src
*** Screenshot *** Screenshot