From c698dc986914d56851e68688164e5fe47599e4b4 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 30 May 2021 00:07:02 -0500 Subject: Move things from init.el to acdw.el and acdw-eshell.el Probably should've been 2 commits... --- lisp/acdw.el | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'lisp/acdw.el') diff --git a/lisp/acdw.el b/lisp/acdw.el index 94f3e64..f227c94 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -474,6 +474,37 @@ Then, build `browse-url-button-regexp' with the new protocol." (add-to-list 'acdw/button-protocols proto) (setq-default browse-url-button-regexp (acdw/build-button-url-regexp))) + +;;; Recentf renaming with dired +;; from ... somewhere. 'rjs', apparently? +;; I'm throwing these here because they look better here than in init.el. +;; Comments are "rjs"'s. + +;; Magic advice to rename entries in recentf when moving files in +;; dired. +(defun rjs/recentf-rename-notify (oldname newname &rest args) + (if (file-directory-p newname) + (rjs/recentf-rename-directory oldname newname) + (rjs/recentf-rename-file oldname newname))) + +(defun rjs/recentf-rename-file (oldname newname) + (setq recentf-list + (mapcar (lambda (name) + (if (string-equal name oldname) + newname + oldname)) + recentf-list))) + +(defun rjs/recentf-rename-directory (oldname newname) + ;; oldname, newname and all entries of recentf-list should already + ;; be absolute and normalised so I think this can just test whether + ;; oldname is a prefix of the element. + (setq recentf-list + (mapcar (lambda (name) + (if (string-prefix-p oldname name) + (concat newname (substring name (length oldname))) + name)) + recentf-list))) ;;; Minor modes -- cgit 1.4.1-21-gabe81