shingo256 / trashed Goto Github PK
View Code? Open in Web Editor NEWViewing/editing system trash can in Emacs
Viewing/editing system trash can in Emacs
There is this newfangled repository at NonGNU Elpa. It's like ELPA but you don't need to be a card-carrying FSF member.
Submitting this package to NonGNU ELPA would make it accessible to future Emacs users (since NonGNU will be part of Emacs28+) and improve visibility!
Hi,
I noticed that some valid info files are rejected. For example, this one is skipped, apparently because of the spaces around the =
, even though it's a valid file:
[Trash Info]
Path = /home/me/src/emacs/melpa/sandbox
DeletionDate = 2019-09-09T19:45:50
I also added a fix for this in #1
Thanks.
Running trashed
throws an error if I have never used the trashcan:
trashed-read-files: Opening directory: No such file or directory, /home/akirakomamura/.local/share/Trash/files
Apparently this is caused by evaluating the following expression in the function:
(directory-files-and-attributes trashed-files-dir nil nil t)
It can be prevented by putting the expression inside (ignore-errors ...)
.
Hi. I had the suspicion that this package was mass-deleting my files sometimes and just now it happened again. I am now fairly certain it is this package. It always happens when I go to empty my trash that extra files and folders outside of trash get deleted.
I suspect this is related to Emacs 30.
Hi,
Great work converting to use tabulated-list-mode
!
Here's some code you might want to use that simplifies the implementation of trashed-read-files
a bit. I think it makes it easier to understand.
(defun trashed-read-files ()
(let* ((files (directory-files-and-attributes trashed-files-dir nil nil t))
(entries (cl-loop for (name . attrs) in files
unless (or (string= name ".") (string= name ".."))
collect (trashed-file-info name attrs))))
(setf tabulated-list-entries entries)))
(defun trashed-file-info (name attrs)
"Return list of name and vector for `tabulated-list-entries' for file NAME with ATTRS."
(-let* ((type (cl-typecase (file-attribute-type attrs)
(string "l")
(null "-")
(t "d")))
(size (number-to-string (file-attribute-size attrs)))
(info-file (expand-file-name (concat name ".trashinfo") trashed-info-dir))
((path deletion-ts) (trashed-trashinfo info-file))
(path (-> path url-unhex-string
(decode-coding-string 'utf-8 t)
(propertize 'mouse-face 'highlight)))
(deletion-ts (format-time-string "%Y-%m-%d %H:%M:%S" deletion-ts)))
(list name (vector type size deletion-ts path))))
(defun trashed-trashinfo (trashinfo-file)
"Return list of original file path and deletion timestamp for TRASHINFO-FILE."
(when (file-readable-p trashinfo-file)
(with-temp-buffer
(insert-file-contents trashinfo-file)
(let* ((path (when (re-search-forward (rx bol "Path"
(0+ blank) "=" (0+ blank)
(group (1+ nonl))) nil t)
(match-string 1)))
(deletion-ts (progn
(goto-char (point-min))
(when (re-search-forward (rx bol "DeletionDate"
(0+ blank) "=" (0+ blank)
(group (1+ nonl))) nil t)
(parse-iso8601-time-string (match-string 1))))))
(list path deletion-ts)))))
Also, in the header, it says Data & Time
instead of Date & Time
. You might want to use something more explicit like Deleted At
.
BTW, you might find this interesting. :) https://github.com/alphapapa/rubbish.py
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.