/
.0-TODO
97 lines (76 loc) · 4.15 KB
/
.0-TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
svg, scribble in emacs
https://lifeofpenguin.blogspot.com/2021/10/svg-widget-in-gnu-emacs.html
https://lifeofpenguin.blogspot.com/2021/11/spice-simulation-in-gnu-emacs-from.html
https://lifeofpenguin.blogspot.com/2021/08/scribble-notes-in-gnu-emacs.html
emacs on large files
https://github.com/m00natic/vlfi
emacs as hex editor
https://www.reddit.com/r/emacs/comments/qca1re/til_emacs_has_a_hex_editor/
multimedia popup functionality
https://github.com/manateelazycat/popweb
extend emacs graphic capabilities
https://github.com/emacs-eaf/emacs-application-framework
------------------------------------------------------------------------------
treemacs versus neotree (in hc-dir-tree.el)
------------------------------------------------------------------------------
http://pragmaticemacs.com/emacs/quickly-move-a-file-to-the-current-directory/
https://gist.github.com/benmaughan/b86ae9ad4cf5b59a99109f7788b3468b
https://github.com/magnars/dash.el
https://github.com/abo-abo/swiper
From: Ben Maughan <post@gwene.org>
Subject: Pragmatic Emacs: Quickly move a file to the current directory
Newsgroups: gwene.org.emacsen.planet
Date: Fri, 22 Apr 2016 00:56:00 +0200 (15 hours, 56 minutes, 32 seconds ago)
Often I’ll download a file in my browser, and then want to move that file to the
directory in which I am working in emacs. I wrote a little helper function to
streamline this, called bjm/move-file-here, given below or at this github gist.
Call the function and it will prompt you with a list of files in your starting
directory (defaulting to ~/downloads, but configurable with
bjm/move-file-here-start-dir) sorted to have the most recent first. The chosen
file will then be moved to the current directory if you are in dired, or else
the directory of the current buffer.
The function needs the packages dash.el and swiper installed. Here is the code –
comments are welcome.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; move file here ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'dash)
(require 'swiper)
;; start directory
(defvar bjm/move-file-here-start-dir (expand-file-name "~/downloads"))
(defun bjm/move-file-here ()
"Move file from somewhere else to here.
The file is taken from a start directory set by `bjm/move-file-here-start-dir' and moved to the current directory if invoked in dired, or else the directory containing current buffer. The user is presented with a list of files in the start directory, from which to select the file to move, sorted by most recent first."
(interactive)
(let (
;; clean directories from list but keep times
(file-list (-remove (lambda (x) (nth 1 x))
(directory-files-and-attributes bjm/move-file-here-start-dir)))
;; get target directory
;; http://ergoemacs.org/emacs/emacs_copy_file_path.html
(target-dir
(if (equal major-mode 'dired-mode)
(expand-file-name default-directory)
(if (null (buffer-file-name))
(user-error "Current buffer is not associated with a file.")
(file-name-directory (buffer-file-name))))))
;; sort list by most recent
;;http://stackoverflow.com/questions/26514437/emacs-sort-list-of-directories-files-by-modification-date
(let ((file-list-sort
(mapcar #'car
(sort file-list
#'(lambda (x y) (time-less-p (nth 6 y) (nth 6 x)))))))
;; use ivy to select start-file
(let ((start-file (ivy-read
(concat "Move selected file to " target-dir " :")
file-list-sort
:re-builder #'ivy--regex
:sort nil
:initial-input nil)))
;; add full path to start file and end-file
(let ((start-file-full
(concat bjm/move-file-here-start-dir "/" start-file))
(end-file
(concat target-dir (file-name-nondirectory start-file))))
(rename-file start-file-full end-file)
(message "moved %s to %s" start-file-full end-file))))))