.emacs-my
changeset 1308 9076a617eaae
parent 1307 8d652d88c013
child 1309 00f80b2988a2
--- a/.emacs-my	Thu Nov 26 00:49:22 2015 +0200
+++ b/.emacs-my	Thu Nov 26 21:36:29 2015 +0200
@@ -1083,25 +1083,28 @@
   (put 'dired-find-alternate-file 'disabled nil)
   )
 
-(defun my-file-name-tmp-p (file)
-  (string-match
-   `,(concat
-    "\\(?:^#.*#\\|~\\|"
-    "\\." (regexp-opt '("base" "local" "orig" "other" "rej" "diff" "log" "stackdump" "pyc" "pyo"))
-    "\\)\\'")
-   (or (and (file-directory-p file) "") (file-name-nondirectory file))))
-
-(defun my-dired-flag-tmp-files ()
+(defvar my--file-name-tmp-refex
+  (concat
+   "\\(?:^#.*#"
+   "\\|~"
+   "\\|\\." (regexp-opt '("base" "local" "orig" "other" "rej" "diff" "log" "stackdump" "pyc" "pyo"))
+   "\\|\\.log\\.[0-9]+"
+   "\\)\\'")
+  "Rule to detect temp/backup files.")
+
+(defun my--file-name-tmp-p (file)
+  (string-match my--file-name-tmp-refex
+                (or (and (file-directory-p file) "") (file-name-nondirectory file))))
+
+(defun my--dired-flag-tmp-files ()
   "Flag all temporary files for deletion."
   (interactive)
   (dired-mark-if
    (let ( (fn (dired-get-filename 'verbatim t)) )
-     (and fn (my-file-name-tmp-p fn)) )
-   "backup file"
-   )
-  )
-
-(define-key dired-mode-map (kbd "`") 'my-dired-flag-tmp-files)
+     (and fn (my--file-name-tmp-p fn)) )
+   "backup file"))
+
+(define-key dired-mode-map (kbd "`") 'my--dired-flag-tmp-files)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "ls-lisp, dired ls")