From 400d4ec56f3bcbcf2a184061d5ece214fe54126b Mon Sep 17 00:00:00 2001 From: JSDurand Date: Fri, 26 Feb 2021 20:36:42 +0800 Subject: 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. --- elfeed-conf.el | 8 +++++++- 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 @@ -59,6 +59,40 @@ See `eshell-j' for the actual functionality." :usage "[-hra] [short-cut]") (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. @@ -104,6 +138,10 @@ supposed to leave the global state alone as well. sequence) (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. @@ -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 -- cgit v1.2.3-18-g5258