summaryrefslogtreecommitdiff
path: root/emacs.org
diff options
context:
space:
mode:
Diffstat (limited to 'emacs.org')
-rwxr-xr-xemacs.org23
1 files changed, 19 insertions, 4 deletions
diff --git a/emacs.org b/emacs.org
index ceae17c..0ab6eea 100755
--- a/emacs.org
+++ b/emacs.org
@@ -318,16 +318,31 @@ Generate a random password between 20 and 40 characters
* Dired
** Functions
#+begin_src emacs-lisp
+ (require 'dired)
+
(defun dired-watch-video ()
+ "Watch play file with mpv."
(interactive)
(call-process-shell-command
(format "mpv \"%s\"" (dired-get-filename)) nil 0))
(defun dired-set-wallpaper ()
- "Set NAME as wallpaper."
- (interactive)
- (call-process-shell-command
- (format "feh --bg-scale %s" (dired-get-filename) nil 0)))
+ "Set NAME as wallpaper using feh."
+ (interactive)
+ (call-process-shell-command
+ (format "feh --bg-scale %s" (dired-get-filename)) nil 0))
+
+ (defun delete-files-except ()
+ "Delete all files inside directory except match."
+ (interactive)
+ (let* ((directory (read-directory-name "Select directory: "))
+ (files (directory-files directory t))
+ (except-match (read-string "Except the ones that have: ")))
+ (dolist (file files)
+ (unless (or (string= "." (substring file -1))
+ (string= ".." (substring file -2))
+ (string-match except-match file)
+ (dired-delete-file file t))))))
#+end_src
** Keybindings
#+begin_src emacs-lisp