diff options
author | JSDurand <mmemmew@gmail.com> | 2021-02-26 20:36:42 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-02-26 20:36:42 +0800 |
commit | 400d4ec56f3bcbcf2a184061d5ece214fe54126b (patch) | |
tree | eeac6d12acf999485cd901f8e93c0a83593944b9 | |
parent | 9e48aae2523b75c7913a1b665310fb35155fea76 (diff) |
Eshell and elfeed improvements
* elfeed-conf.el (elfeed-feeds): Add some more feeds.
* eshell-conf.el (eshell-j):
(eshell-mark-directory): Use a dedicated variable for better maintainability.
(eshell/mark): Conveniently add marks.
(eshell/marks): List the marks.
-rw-r--r-- | elfeed-conf.el | 8 | ||||
-rw-r--r-- | eshell-conf.el | 40 |
2 files changed, 46 insertions, 2 deletions
diff --git a/elfeed-conf.el b/elfeed-conf.el index 94c6f72..6ae8b41 100644 --- a/elfeed-conf.el +++ b/elfeed-conf.el @@ -35,7 +35,13 @@ (list "https://protesilaos.com/news.xml" 'prot 'news) (list "https://protesilaos.com/politics.xml" - 'prot 'politics))) + 'prot 'politics) + (list "https://www.youtube.com/feeds/videos.xml?channel_id=UCcXhhVwCT6_WqjkEniejRJQ" + 'wintergaten 'youtube) + (list "https://notrelated.xyz/rss" + 'lukesmith 'notrelated) + (list "https://lukesmith.xyz/peertube" + 'lukesmith 'youtube))) (define-key elfeed-search-mode-map (vector #x78) 'elfeed-search-exit) diff --git a/eshell-conf.el b/eshell-conf.el index 9ca592a..a1bdf68 100644 --- a/eshell-conf.el +++ b/eshell-conf.el @@ -60,6 +60,40 @@ See `eshell-j' for the actual functionality." (eshell-j args use-recent-p))) ;;;###autoload +(defun eshell/mark (&rest args) + "Add symbolic links to `eshell-mark-directory'. +The argument ARGS should be list of one string which names the +link name. If no argument is given, the base name of the current +directory is used." + ;; (setq args (cons default-directory args)) + ;; (setq args (durand-eshell-delete-dups args :test #'string=)) + (setq args (cond + ((consp args) (car (flatten-tree args))) + ((file-name-nondirectory + (directory-file-name + (file-name-directory default-directory)))))) + (eshell-command-result + (format "ln -sf %s %s" + default-directory (expand-file-name args eshell-mark-directory)))) + +;;;###autoload +(defun eshell/marks () + "List all symbolic links. +Just for the completeness." + (let* ((dirs (directory-files eshell-mark-directory nil + (rx-to-string '(seq bos (or (not ".") + (seq "." (not "."))))))) + (max-length (apply #'max (mapcar #'length dirs)))) + (mapconcat + (function + (lambda (mark) + (concat mark + (make-string (- max-length (length mark)) #x20) + " -> " + (file-truename (expand-file-name mark eshell-mark-directory))))) + dirs "\n"))) + +;;;###autoload (defun durand-eshell-delete-dups (sequence &rest args) "Delete duplicate elements in SEQUENCE. If the keyword argument TEST is non-nil, it should be a function @@ -105,6 +139,10 @@ supposed to leave the global state alone as well. (nreverse result))) ;;;###autoload +(defvar eshell-mark-directory (expand-file-name "~/.marks") + "The directory that stores links to other directories.") + +;;;###autoload (defun eshell-j (&optional short-cut use-recent-p) "Jump to SHORT-CUT. Where this jumps to is determined by the symbolic links in the @@ -114,7 +152,7 @@ if USE-RECENT-P is 'exclusive, then only list the recent directories as candidates, unless there are no recent directories, in which case it falls back to use the marks as the candidates." - (let* ((mark-directory (expand-file-name "~/.marks")) + (let* ((mark-directory eshell-mark-directory) (short-cut (eshell-flatten-and-stringify short-cut)) (links (delq nil (mapcar |