From 5f904e50c32197e636e521120384d3658f53c794 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 23 Jun 2022 10:55:45 +0200 Subject: [PATCH] Revert "Allow shortening filenames in recentf-mode menu" This reverts commit 32906819addde1aa952d4718699d332d3a58b004. --- etc/NEWS | 5 ----- lisp/recentf.el | 22 +++++----------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 88ba7213841..f21f482c29a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1855,11 +1855,6 @@ Enabling this minor mode turns on hiding header material, like If non-nil, files untracked by a VCS are considered to be part of the project by a VC project based on that VCS. ---- -*** The 'recentf-mode' menu can now use shortened filenames. -Set the user option 'recentf-menu-filter' to -'recentf-show-abbreviated' to enable it. - --- ** The autoarg.el library is now marked obsolete. This library provides the 'autoarg-mode' and 'autoarg-kp-mode' minor diff --git a/lisp/recentf.el b/lisp/recentf.el index 05127cbf49b..8b05f48283e 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el @@ -187,8 +187,6 @@ A nil value means no filter. The following functions are predefined: Sort menu items by directories in ascending order. - `recentf-sort-directories-descending' Sort menu items by directories in descending order. -- `recentf-show-abbreviated' - Show shortened filenames. - `recentf-show-basenames' Show filenames sans directory in menu items. - `recentf-show-basenames-ascending' @@ -217,7 +215,6 @@ elements (see `recentf-make-menu-element' for menu element form)." (function-item recentf-sort-basenames-descending) (function-item recentf-sort-directories-ascending) (function-item recentf-sort-directories-descending) - (function-item recentf-show-abbreviated) (function-item recentf-show-basenames) (function-item recentf-show-basenames-ascending) (function-item recentf-show-basenames-descending) @@ -724,11 +721,14 @@ Compares directories then filenames to order the list." (recentf-menu-element-value e2) (recentf-menu-element-value e1))))) -(defun recentf--filter-names (l no-dir fun) +(defun recentf-show-basenames (l &optional no-dir) + "Filter the list of menu elements L to show filenames sans directory. +When a filename is duplicated, it is appended a sequence number if +optional argument NO-DIR is non-nil, or its directory otherwise." (let (filtered-names filtered-list full name counters sufx) (dolist (elt l (nreverse filtered-list)) (setq full (recentf-menu-element-value elt) - name (funcall fun full)) + name (file-name-nondirectory full)) (if (not (member name filtered-names)) (push name filtered-names) (if no-dir @@ -740,18 +740,6 @@ Compares directories then filenames to order the list." (setq name (format "%s(%s)" name sufx))) (push (recentf-make-menu-element name full) filtered-list)))) -(defun recentf-show-abbreviated (l &optional no-dir) - "Filter the list of menu elements L to show shortened filenames. -When a filename is duplicated, it is appended a sequence number if -optional argument NO-DIR is non-nil, or its directory otherwise." - (recentf--filter-names l no-dir #'abbreviate-file-name)) - -(defun recentf-show-basenames (l &optional no-dir) - "Filter the list of menu elements L to show filenames sans directory. -When a filename is duplicated, it is appended a sequence number if -optional argument NO-DIR is non-nil, or its directory otherwise." - (recentf--filter-names l no-dir #'file-name-nondirectory)) - (defun recentf-show-basenames-ascending (l) "Filter the list of menu elements L to show filenames sans directory. Filenames are sorted in ascending order. -- 2.39.2